Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java @ 10090:ae6f0c381087
split MemoryCheckpoint interface into Single and Multi
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 19 Jun 2013 16:42:56 +0200 |
parents | b4f12c603be5 |
children | 34444b095a51 |
comparison
equal
deleted
inserted
replaced
10089:97e8cabe9064 | 10090:ae6f0c381087 |
---|---|
89 this.modifiedInLoops = modifiedInLoops; | 89 this.modifiedInLoops = modifiedInLoops; |
90 } | 90 } |
91 | 91 |
92 @Override | 92 @Override |
93 protected Set<LocationIdentity> processNode(FixedNode node, Set<LocationIdentity> currentState) { | 93 protected Set<LocationIdentity> processNode(FixedNode node, Set<LocationIdentity> currentState) { |
94 if (node instanceof MemoryCheckpoint) { | 94 if (node instanceof MemoryCheckpoint.Single) { |
95 for (LocationIdentity identity : ((MemoryCheckpoint) node).getLocationIdentities()) { | 95 currentState.add(((MemoryCheckpoint.Single) node).getLocationIdentity()); |
96 } else if (node instanceof MemoryCheckpoint.Multi) { | |
97 for (LocationIdentity identity : ((MemoryCheckpoint.Multi) node).getLocationIdentities()) { | |
96 currentState.add(identity); | 98 currentState.add(identity); |
97 } | 99 } |
98 } | 100 } |
99 return currentState; | 101 return currentState; |
100 } | 102 } |
141 | 143 |
142 @Override | 144 @Override |
143 protected MemoryMap processNode(FixedNode node, MemoryMap state) { | 145 protected MemoryMap processNode(FixedNode node, MemoryMap state) { |
144 if (node instanceof FloatableAccessNode) { | 146 if (node instanceof FloatableAccessNode) { |
145 processFloatable((FloatableAccessNode) node, state); | 147 processFloatable((FloatableAccessNode) node, state); |
146 } else if (node instanceof MemoryCheckpoint) { | 148 } else if (node instanceof MemoryCheckpoint.Single) { |
147 processCheckpoint((MemoryCheckpoint) node, state); | 149 processCheckpoint((MemoryCheckpoint.Single) node, state); |
148 } | 150 } else if (node instanceof MemoryCheckpoint.Multi) { |
151 processCheckpoint((MemoryCheckpoint.Multi) node, state); | |
152 } | |
153 assert MemoryCheckpoint.TypeAssertion.correctType(node) : node; | |
149 return state; | 154 return state; |
150 } | 155 } |
151 | 156 |
152 private static void processCheckpoint(MemoryCheckpoint checkpoint, MemoryMap state) { | 157 private static void processCheckpoint(MemoryCheckpoint.Single checkpoint, MemoryMap state) { |
158 LocationIdentity identity = checkpoint.getLocationIdentity(); | |
159 if (identity == ANY_LOCATION) { | |
160 state.lastMemorySnapshot.clear(); | |
161 } | |
162 state.lastMemorySnapshot.put(identity, (ValueNode) checkpoint); | |
163 } | |
164 | |
165 private static void processCheckpoint(MemoryCheckpoint.Multi checkpoint, MemoryMap state) { | |
153 for (LocationIdentity identity : checkpoint.getLocationIdentities()) { | 166 for (LocationIdentity identity : checkpoint.getLocationIdentities()) { |
154 if (identity == ANY_LOCATION) { | 167 if (identity == ANY_LOCATION) { |
155 state.lastMemorySnapshot.clear(); | 168 state.lastMemorySnapshot.clear(); |
156 } | 169 } |
157 state.lastMemorySnapshot.put(identity, (ValueNode) checkpoint); | 170 state.lastMemorySnapshot.put(identity, (ValueNode) checkpoint); |
221 MemoryMap result = new MemoryMap(oldState); | 234 MemoryMap result = new MemoryMap(oldState); |
222 if (node.predecessor() instanceof InvokeWithExceptionNode) { | 235 if (node.predecessor() instanceof InvokeWithExceptionNode) { |
223 /* | 236 /* |
224 * InvokeWithException cannot be the lastLocationAccess for a FloatingReadNode. | 237 * InvokeWithException cannot be the lastLocationAccess for a FloatingReadNode. |
225 * Since it is both the invoke and a control flow split, the scheduler cannot | 238 * Since it is both the invoke and a control flow split, the scheduler cannot |
226 * schedule anything immediately the invoke. It can only schedule in the normal or | 239 * schedule anything immediately after the invoke. It can only schedule in the |
227 * exceptional successor - and we have to tell the scheduler here which side it | 240 * normal or exceptional successor - and we have to tell the scheduler here which |
228 * needs to choose by putting in the location identity on both successors. | 241 * side it needs to choose by putting in the location identity on both successors. |
229 */ | 242 */ |
230 InvokeWithExceptionNode checkpoint = (InvokeWithExceptionNode) node.predecessor(); | 243 InvokeWithExceptionNode invoke = (InvokeWithExceptionNode) node.predecessor(); |
231 for (LocationIdentity identity : checkpoint.getLocationIdentities()) { | 244 result.lastMemorySnapshot.put(invoke.getLocationIdentity(), node); |
232 result.lastMemorySnapshot.put(identity, node); | |
233 } | |
234 } | 245 } |
235 return result; | 246 return result; |
236 } | 247 } |
237 | 248 |
238 @Override | 249 @Override |