From e7eb2db06d1b9c529f94f2da3a087c83c0498e05 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Mon, 19 Oct 2026 10:40:35 -0700 Subject: Turn off Store GVN with explaination --- .../src/main/java/com/seaofnodes/simple/node/StoreNode.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'chapter22/src/main/java') diff --git a/chapter22/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter22/src/main/java/com/seaofnodes/simple/node/StoreNode.java index ecda014b..18271929 100644 --- a/chapter22/src/main/java/com/seaofnodes/simple/node/StoreNode.java +++ b/chapter22/src/main/java/com/seaofnodes/simple/node/StoreNode.java @@ -167,4 +167,13 @@ public class StoreNode extends MemOpNode { return Parser.error("Cannot modify final field '"+_name+"'",_loc); return null; } + + // Do not GVN Stores. Two equal Stores on two of three paths are the easy + // failure: sharing them makes GCM place the Store on all three paths. + // Sharing is safe only if every exit path goes through an original Store, + // or GCM splits the shared Store to keep it on those paths. Stores must + // sink, not run on extra paths. GVN does not check this; GCM does not split. + // Identity also disables generic Phi factoring of Stores. + // The closed-loop Store sink is a separate peep and still applies. + @Override public boolean eq(Node n) { return this == n; } } -- cgit v1.2.3