Mercurial > hg > truffle
comparison graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java @ 18693:8d7ecba12c5d
Check for compatible stamps in read elimination.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 16 Dec 2014 14:04:51 +0100 |
parents | 12bd2b344b08 |
children | 220d7f242e57 |
comparison
equal
deleted
inserted
replaced
18692:d6c33eb93b9f | 18693:8d7ecba12c5d |
---|---|
60 } else { | 60 } else { |
61 ValueNode object = GraphUtil.unproxify(access.object()); | 61 ValueNode object = GraphUtil.unproxify(access.object()); |
62 LoadCacheEntry identifier = new LoadCacheEntry(object, access.field()); | 62 LoadCacheEntry identifier = new LoadCacheEntry(object, access.field()); |
63 ValueNode cachedValue = state.getCacheEntry(identifier); | 63 ValueNode cachedValue = state.getCacheEntry(identifier); |
64 if (node instanceof LoadFieldNode) { | 64 if (node instanceof LoadFieldNode) { |
65 if (cachedValue != null) { | 65 if (cachedValue != null && access.stamp().isCompatible(cachedValue.stamp())) { |
66 effects.replaceAtUsages(access, cachedValue); | 66 effects.replaceAtUsages(access, cachedValue); |
67 addScalarAlias(access, cachedValue); | 67 addScalarAlias(access, cachedValue); |
68 deleted = true; | 68 deleted = true; |
69 } else { | 69 } else { |
70 state.addCacheEntry(identifier, access); | 70 state.addCacheEntry(identifier, access); |
85 ReadNode read = (ReadNode) node; | 85 ReadNode read = (ReadNode) node; |
86 if (read.location() instanceof ConstantLocationNode) { | 86 if (read.location() instanceof ConstantLocationNode) { |
87 ValueNode object = GraphUtil.unproxify(read.object()); | 87 ValueNode object = GraphUtil.unproxify(read.object()); |
88 ReadCacheEntry identifier = new ReadCacheEntry(object, read.location()); | 88 ReadCacheEntry identifier = new ReadCacheEntry(object, read.location()); |
89 ValueNode cachedValue = state.getCacheEntry(identifier); | 89 ValueNode cachedValue = state.getCacheEntry(identifier); |
90 if (cachedValue != null) { | 90 if (cachedValue != null && read.stamp().isCompatible(cachedValue.stamp())) { |
91 if (read.getGuard() != null && !(read.getGuard() instanceof FixedNode)) { | 91 if (read.getGuard() != null && !(read.getGuard() instanceof FixedNode)) { |
92 effects.addFixedNodeBefore(ValueAnchorNode.create((ValueNode) read.getGuard()), read); | 92 effects.addFixedNodeBefore(ValueAnchorNode.create((ValueNode) read.getGuard()), read); |
93 } | 93 } |
94 effects.replaceAtUsages(read, cachedValue); | 94 effects.replaceAtUsages(read, cachedValue); |
95 addScalarAlias(read, cachedValue); | 95 addScalarAlias(read, cachedValue); |
120 UnsafeLoadNode load = (UnsafeLoadNode) node; | 120 UnsafeLoadNode load = (UnsafeLoadNode) node; |
121 if (load.offset().isConstant() && !load.getLocationIdentity().equals(LocationIdentity.ANY_LOCATION)) { | 121 if (load.offset().isConstant() && !load.getLocationIdentity().equals(LocationIdentity.ANY_LOCATION)) { |
122 ValueNode object = GraphUtil.unproxify(load.object()); | 122 ValueNode object = GraphUtil.unproxify(load.object()); |
123 UnsafeLoadCacheEntry identifier = new UnsafeLoadCacheEntry(object, load.offset(), load.getLocationIdentity()); | 123 UnsafeLoadCacheEntry identifier = new UnsafeLoadCacheEntry(object, load.offset(), load.getLocationIdentity()); |
124 ValueNode cachedValue = state.getCacheEntry(identifier); | 124 ValueNode cachedValue = state.getCacheEntry(identifier); |
125 if (cachedValue != null) { | 125 if (cachedValue != null && load.stamp().isCompatible(cachedValue.stamp())) { |
126 effects.replaceAtUsages(load, cachedValue); | 126 effects.replaceAtUsages(load, cachedValue); |
127 addScalarAlias(load, cachedValue); | 127 addScalarAlias(load, cachedValue); |
128 deleted = true; | 128 deleted = true; |
129 } else { | 129 } else { |
130 state.addCacheEntry(identifier, load); | 130 state.addCacheEntry(identifier, load); |