summaryrefslogtreecommitdiff
path: root/chapter13/src/main
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-10-19 10:40:35 -0700
committerCliff Click <cliffc@acm.org>2026-10-19 10:40:35 -0700
commite7eb2db06d1b9c529f94f2da3a087c83c0498e05 (patch)
tree17a21219c7a28017b361bdeec011dda0afc562dc /chapter13/src/main
parentef8d9c4630db6af79c25526c8e80c54a48df4e39 (diff)
downloadSimple-e7eb2db06d1b9c529f94f2da3a087c83c0498e05.tar.gz
Simple-e7eb2db06d1b9c529f94f2da3a087c83c0498e05.zip
Turn off Store GVN with explaination
Diffstat (limited to 'chapter13/src/main')
-rw-r--r--chapter13/src/main/java/com/seaofnodes/simple/node/StoreNode.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/chapter13/src/main/java/com/seaofnodes/simple/node/StoreNode.java b/chapter13/src/main/java/com/seaofnodes/simple/node/StoreNode.java
index e9eaaf2e..e09c8fd3 100644
--- a/chapter13/src/main/java/com/seaofnodes/simple/node/StoreNode.java
+++ b/chapter13/src/main/java/com/seaofnodes/simple/node/StoreNode.java
@@ -85,4 +85,12 @@ public class StoreNode extends MemOpNode {
Type ptr = val()._type;
return _init || ptr.isa(_declaredType) ? null : "Cannot store "+ptr+" into field "+_declaredType+" "+_name;
}
+
+ // 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; }
}