src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java
equal
deleted
inserted
replaced
889 if (!guardsStage.allowsFloatingGuards()) { |
889 if (!guardsStage.allowsFloatingGuards()) { |
890 new GuardLoweringPhase().apply(snippetCopy, null); |
890 new GuardLoweringPhase().apply(snippetCopy, null); |
891 } |
891 } |
892 snippetCopy.setGuardsStage(guardsStage); |
892 snippetCopy.setGuardsStage(guardsStage); |
893 try (DebugContext.Scope s = debug.scope("LoweringSnippetTemplate", snippetCopy)) { |
893 try (DebugContext.Scope s = debug.scope("LoweringSnippetTemplate", snippetCopy)) { |
894 new LoweringPhase(new CanonicalizerPhase(), args.cacheKey.loweringStage).apply(snippetCopy, providers); |
894 new LoweringPhase(CanonicalizerPhase.create(), args.cacheKey.loweringStage).apply(snippetCopy, providers); |
895 } catch (Throwable e) { |
895 } catch (Throwable e) { |
896 throw debug.handle(e); |
896 throw debug.handle(e); |
897 } |
897 } |
898 |
898 |
899 ArrayList<StateSplit> curSideEffectNodes = new ArrayList<>(); |
899 ArrayList<StateSplit> curSideEffectNodes = new ArrayList<>(); |
928 new DeadCodeEliminationPhase(Required).apply(snippetCopy); |
928 new DeadCodeEliminationPhase(Required).apply(snippetCopy); |
929 |
929 |
930 assert checkAllVarargPlaceholdersAreDeleted(parameterCount, placeholders); |
930 assert checkAllVarargPlaceholdersAreDeleted(parameterCount, placeholders); |
931 |
931 |
932 new FloatingReadPhase(true, true).apply(snippetCopy); |
932 new FloatingReadPhase(true, true).apply(snippetCopy); |
933 new RemoveValueProxyPhase().apply(snippetCopy); |
933 |
|
934 if (!guardsStage.requiresValueProxies()) { |
|
935 new RemoveValueProxyPhase().apply(snippetCopy); |
|
936 } |
934 |
937 |
935 MemoryAnchorNode anchor = snippetCopy.add(new MemoryAnchorNode()); |
938 MemoryAnchorNode anchor = snippetCopy.add(new MemoryAnchorNode()); |
936 snippetCopy.start().replaceAtUsages(InputType.Memory, anchor); |
939 snippetCopy.start().replaceAtUsages(InputType.Memory, anchor); |
937 |
940 |
938 this.snippet = snippetCopy; |
941 this.snippet = snippetCopy; |
1057 // altogether |
1060 // altogether |
1058 LoopBeginNode loopBegin = explodeLoop.findLoopBegin(); |
1061 LoopBeginNode loopBegin = explodeLoop.findLoopBegin(); |
1059 if (loopBegin != null) { |
1062 if (loopBegin != null) { |
1060 LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin); |
1063 LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin); |
1061 Mark mark = snippetCopy.getMark(); |
1064 Mark mark = snippetCopy.getMark(); |
1062 LoopTransformations.fullUnroll(loop, providers, new CanonicalizerPhase()); |
1065 CanonicalizerPhase canonicalizer = null; |
1063 new CanonicalizerPhase().applyIncremental(snippetCopy, providers, mark, false); |
1066 if (GraalOptions.ImmutableCode.getValue(snippetCopy.getOptions())) { |
|
1067 canonicalizer = CanonicalizerPhase.createWithoutReadCanonicalization(); |
|
1068 } else { |
|
1069 canonicalizer = CanonicalizerPhase.create(); |
|
1070 } |
|
1071 LoopTransformations.fullUnroll(loop, providers, canonicalizer); |
|
1072 CanonicalizerPhase.create().applyIncremental(snippetCopy, providers, mark, false); |
1064 loop.deleteUnusedNodes(); |
1073 loop.deleteUnusedNodes(); |
1065 } |
1074 } |
1066 GraphUtil.removeFixedWithUnusedInputs(explodeLoop); |
1075 GraphUtil.removeFixedWithUnusedInputs(explodeLoop); |
1067 exploded = true; |
1076 exploded = true; |
1068 } |
1077 } |
1276 EconomicSet<LocationIdentity> kills = EconomicSet.create(Equivalence.DEFAULT); |
1285 EconomicSet<LocationIdentity> kills = EconomicSet.create(Equivalence.DEFAULT); |
1277 kills.addAll(memoryMap.getLocations()); |
1286 kills.addAll(memoryMap.getLocations()); |
1278 |
1287 |
1279 if (replacee instanceof MemoryCheckpoint.Single) { |
1288 if (replacee instanceof MemoryCheckpoint.Single) { |
1280 // check if some node in snippet graph also kills the same location |
1289 // check if some node in snippet graph also kills the same location |
1281 LocationIdentity locationIdentity = ((MemoryCheckpoint.Single) replacee).getLocationIdentity(); |
1290 LocationIdentity locationIdentity = ((MemoryCheckpoint.Single) replacee).getKilledLocationIdentity(); |
1282 if (locationIdentity.isAny()) { |
1291 if (locationIdentity.isAny()) { |
1283 assert !(memoryMap.getLastLocationAccess(any()) instanceof MemoryAnchorNode) : replacee + " kills ANY_LOCATION, but snippet does not"; |
1292 assert !(memoryMap.getLastLocationAccess(any()) instanceof MemoryAnchorNode) : replacee + " kills ANY_LOCATION, but snippet does not"; |
1284 // if the replacee kills ANY_LOCATION, the snippet can kill arbitrary locations |
1293 // if the replacee kills ANY_LOCATION, the snippet can kill arbitrary locations |
1285 return true; |
1294 return true; |
1286 } |
1295 } |