summaryrefslogtreecommitdiff
path: root/chapter10/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'chapter10/src/main/java/com')
-rw-r--r--chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index 71eb0842..75d1a36f 100644
--- a/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter10/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -64,4 +64,12 @@ public class StoreNode extends MemOpNode {
return false;
}
+
+ // 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.
+ @Override boolean eq(Node n) { return this == n; }
}