summaryrefslogtreecommitdiff
path: root/chapter24/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'chapter24/src/main')
-rw-r--r--chapter24/src/main/java/com/seaofnodes/simple/node/StoreNode.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/chapter24/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter24/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index 4e1d7ce3..47f12d82 100644
--- a/chapter24/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter24/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -171,4 +171,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; }
}