< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java

Print this page




 207                     }
 208                 } else {
 209                     int slotIdx = 0;
 210                     LocalVariableTable localVariableTable = method.getLocalVariableTable();
 211                     if (localVariableTable != null) {
 212                         for (int i = 0; i < names.length; i++) {
 213                             Local local = localVariableTable.getLocal(slotIdx, 0);
 214                             if (local != null) {
 215                                 names[i] = local.getName();
 216                             }
 217                             JavaKind kind = method.getSignature().getParameterKind(i);
 218                             slotIdx += kind.getSlotCount();
 219                         }
 220                     }
 221                 }
 222                 return true;
 223             }
 224         }
 225 
 226         /**
 227          * Times instantiations of all templates derived form this snippet.
 228          *
 229          * @see SnippetTemplate#instantiationTimer
 230          */
 231         private final TimerKey instantiationTimer;
 232 
 233         /**
 234          * Counts instantiations of all templates derived from this snippet.
 235          *
 236          * @see SnippetTemplate#instantiationCounter
 237          */
 238         private final CounterKey instantiationCounter;
 239 
 240         protected abstract Lazy lazy();
 241 
 242         protected SnippetInfo(ResolvedJavaMethod method, LocationIdentity[] privateLocations) {
 243             this.method = method;
 244             this.privateLocations = privateLocations;
 245             instantiationCounter = DebugContext.counter("SnippetInstantiationCount[%s]", method.getName());
 246             instantiationTimer = DebugContext.timer("SnippetInstantiationTime[%s]", method.getName());
 247             assert method.isStatic() : "snippet method must be static: " + method.format("%H.%n");
 248         }
 249 
 250         public ResolvedJavaMethod getMethod() {
 251             return method;
 252         }
 253 
 254         public int getParameterCount() {
 255             return lazy().constantParameters.length;
 256         }


 689         for (ConstantParameter p : method.getParameterAnnotations(ConstantParameter.class)) {
 690             if (p != null) {
 691                 return true;
 692             }
 693         }
 694         return false;
 695     }
 696 
 697     private final SnippetReflectionProvider snippetReflection;
 698 
 699     /**
 700      * Creates a snippet template.
 701      */
 702     @SuppressWarnings("try")
 703     protected SnippetTemplate(OptionValues options, DebugContext debug, final Providers providers, SnippetReflectionProvider snippetReflection, Arguments args) {
 704         this.snippetReflection = snippetReflection;
 705         this.info = args.info;
 706 
 707         Object[] constantArgs = getConstantArgs(args);
 708         StructuredGraph snippetGraph = providers.getReplacements().getSnippet(args.info.method, args.info.original, constantArgs);
 709         instantiationTimer = DebugContext.timer("SnippetTemplateInstantiationTime[%#s]", args);
 710         instantiationCounter = DebugContext.counter("SnippetTemplateInstantiationCount[%#s]", args);
 711 
 712         ResolvedJavaMethod method = snippetGraph.method();
 713         Signature signature = method.getSignature();
 714 
 715         PhaseContext phaseContext = new PhaseContext(providers);
 716 
 717         // Copy snippet graph, replacing constant parameters with given arguments
 718         final StructuredGraph snippetCopy = new StructuredGraph.Builder(options, debug).name(snippetGraph.name).method(snippetGraph.method()).build();
 719 
 720         try (DebugContext.Scope scope = debug.scope("SpecializeSnippet", snippetCopy)) {
 721             if (!snippetGraph.isUnsafeAccessTrackingEnabled()) {
 722                 snippetCopy.disableUnsafeAccessTracking();
 723             }
 724 
 725             EconomicMap<Node, Node> nodeReplacements = EconomicMap.create(Equivalence.IDENTITY);
 726             nodeReplacements.put(snippetGraph.start(), snippetCopy.start());
 727 
 728             MetaAccessProvider metaAccess = providers.getMetaAccess();
 729             assert checkTemplate(metaAccess, args, method, signature);
 730 


1061      */
1062     private final ArrayList<StateSplit> sideEffectNodes;
1063 
1064     /**
1065      * Nodes that inherit a deoptimization {@link FrameState} from the replacee during
1066      * instantiation.
1067      */
1068     private final ArrayList<DeoptimizingNode> deoptNodes;
1069 
1070     /**
1071      * Nodes that have a stamp originating from a {@link Placeholder}.
1072      */
1073     private final ArrayList<ValueNode> placeholderStampedNodes;
1074 
1075     /**
1076      * The nodes to be inlined when this specialization is instantiated.
1077      */
1078     private final ArrayList<Node> nodes;
1079 
1080     /**
1081      * Times instantiations of this template.
1082      *
1083      * @see SnippetInfo#instantiationTimer
1084      */
1085     private final TimerKey instantiationTimer;
1086 
1087     /**
1088      * Counts instantiations of this template.
1089      *
1090      * @see SnippetInfo#instantiationCounter
1091      */
1092     private final CounterKey instantiationCounter;
1093 
1094     /**
1095      * Gets the instantiation-time bindings to this template's parameters.
1096      *
1097      * @return the map that will be used to bind arguments to parameters when inlining this template
1098      */
1099     private EconomicMap<Node, Node> bind(StructuredGraph replaceeGraph, MetaAccessProvider metaAccess, Arguments args) {
1100         EconomicMap<Node, Node> replacements = EconomicMap.create(Equivalence.IDENTITY);
1101         assert args.info.getParameterCount() == parameters.length : "number of args (" + args.info.getParameterCount() + ") != number of parameters (" + parameters.length + ")";
1102         for (int i = 0; i < parameters.length; i++) {
1103             Object parameter = parameters[i];
1104             assert parameter != null : this + " has no parameter named " + args.info.getParameterName(i);
1105             Object argument = args.values[i];
1106             if (parameter instanceof ParameterNode) {
1107                 if (argument instanceof ValueNode) {
1108                     replacements.put((ParameterNode) parameter, (ValueNode) argument);
1109                 } else {
1110                     JavaKind kind = ((ParameterNode) parameter).getStackKind();
1111                     assert argument != null || kind == JavaKind.Object : this + " cannot accept null for non-object parameter named " + args.info.getParameterName(i);
1112                     JavaConstant constant = forBoxed(argument, kind);
1113                     replacements.put((ParameterNode) parameter, ConstantNode.forConstant(constant, metaAccess, replaceeGraph));
1114                 }


1389      */
1390     @SuppressWarnings("try")
1391     public UnmodifiableEconomicMap<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args) {
1392         return instantiate(metaAccess, replacee, replacer, args, true);
1393     }
1394 
1395     /**
1396      * Replaces a given fixed node with this specialized snippet.
1397      *
1398      * @param metaAccess
1399      * @param replacee the node that will be replaced
1400      * @param replacer object that replaces the usages of {@code replacee}
1401      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1402      * @param killReplacee is true, the replacee node is deleted
1403      * @return the map of duplicated nodes (original -&gt; duplicate)
1404      */
1405     @SuppressWarnings("try")
1406     public UnmodifiableEconomicMap<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args, boolean killReplacee) {
1407         DebugContext debug = replacee.getDebug();
1408         assert assertSnippetKills(replacee);
1409         try (DebugCloseable a = args.info.instantiationTimer.start(debug); DebugCloseable b = instantiationTimer.start(debug)) {
1410             args.info.instantiationCounter.increment(debug);
1411             instantiationCounter.increment(debug);
1412             // Inline the snippet nodes, replacing parameters with the given args in the process
1413             StartNode entryPointNode = snippet.start();
1414             FixedNode firstCFGNode = entryPointNode.next();
1415             StructuredGraph replaceeGraph = replacee.graph();
1416             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1417             replacements.put(entryPointNode, AbstractBeginNode.prevBegin(replacee));
1418             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements);
1419             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1420 
1421             // Re-wire the control flow graph around the replacee
1422             FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
1423             replacee.replaceAtPredecessor(firstCFGNodeDuplicate);
1424 
1425             rewireFrameStates(replacee, duplicates);
1426 
1427             if (replacee instanceof DeoptimizingNode) {
1428                 DeoptimizingNode replaceeDeopt = (DeoptimizingNode) replacee;
1429 
1430                 FrameState stateBefore = null;
1431                 FrameState stateDuring = null;


1544      */
1545     public StructuredGraph copySpecializedGraph(DebugContext debugForCopy) {
1546         return (StructuredGraph) snippet.copy(debugForCopy);
1547     }
1548 
1549     /**
1550      * Replaces a given floating node with this specialized snippet.
1551      *
1552      * @param metaAccess
1553      * @param replacee the node that will be replaced
1554      * @param replacer object that replaces the usages of {@code replacee}
1555      * @param tool lowering tool used to insert the snippet into the control-flow
1556      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1557      */
1558     @SuppressWarnings("try")
1559     public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, LoweringTool tool, Arguments args) {
1560         DebugContext debug = replacee.getDebug();
1561         assert assertSnippetKills(replacee);
1562         try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
1563             args.info.instantiationCounter.increment(debug);
1564             instantiationCounter.increment(debug);
1565 
1566             // Inline the snippet nodes, replacing parameters with the given args in the process
1567             StartNode entryPointNode = snippet.start();
1568             FixedNode firstCFGNode = entryPointNode.next();
1569             StructuredGraph replaceeGraph = replacee.graph();
1570             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1571             replacements.put(entryPointNode, tool.getCurrentGuardAnchor().asNode());
1572             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements);
1573             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1574 
1575             FixedWithNextNode lastFixedNode = tool.lastFixedNode();
1576             assert lastFixedNode != null && lastFixedNode.isAlive() : replaceeGraph + " lastFixed=" + lastFixedNode;
1577             FixedNode next = lastFixedNode.next();
1578             lastFixedNode.setNext(null);
1579             FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
1580             replaceeGraph.addAfterFixed(lastFixedNode, firstCFGNodeDuplicate);
1581 
1582             rewireFrameStates(replacee, duplicates);
1583             updateStamps(replacee, duplicates);
1584 


1597             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After lowering %s with %s", replacee, this);
1598         }
1599     }
1600 
1601     /**
1602      * Replaces a given floating node with this specialized snippet.
1603      *
1604      * This snippet must be pure data-flow
1605      *
1606      * @param metaAccess
1607      * @param replacee the node that will be replaced
1608      * @param replacer object that replaces the usages of {@code replacee}
1609      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1610      */
1611     @SuppressWarnings("try")
1612     public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, Arguments args) {
1613         DebugContext debug = replacee.getDebug();
1614         assert assertSnippetKills(replacee);
1615         try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
1616             args.info.instantiationCounter.increment(debug);
1617             instantiationCounter.increment(debug);
1618 
1619             // Inline the snippet nodes, replacing parameters with the given args in the process
1620             StartNode entryPointNode = snippet.start();
1621             assert entryPointNode.next() == (memoryAnchor == null ? returnNode : memoryAnchor) : entryPointNode.next();
1622             StructuredGraph replaceeGraph = replacee.graph();
1623             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1624             MemoryAnchorNode anchorDuplicate = null;
1625             if (memoryAnchor != null) {
1626                 anchorDuplicate = replaceeGraph.add(new MemoryAnchorNode());
1627                 replacements.put(memoryAnchor, anchorDuplicate);
1628             }
1629             List<Node> floatingNodes = new ArrayList<>(nodes.size() - 2);
1630             for (Node n : nodes) {
1631                 if (n != entryPointNode && n != returnNode) {
1632                     floatingNodes.add(n);
1633                 }
1634             }
1635             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(floatingNodes, snippet, floatingNodes.size(), replacements);
1636             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1637 




 207                     }
 208                 } else {
 209                     int slotIdx = 0;
 210                     LocalVariableTable localVariableTable = method.getLocalVariableTable();
 211                     if (localVariableTable != null) {
 212                         for (int i = 0; i < names.length; i++) {
 213                             Local local = localVariableTable.getLocal(slotIdx, 0);
 214                             if (local != null) {
 215                                 names[i] = local.getName();
 216                             }
 217                             JavaKind kind = method.getSignature().getParameterKind(i);
 218                             slotIdx += kind.getSlotCount();
 219                         }
 220                     }
 221                 }
 222                 return true;
 223             }
 224         }
 225 
 226         /**
 227          * Times instantiations of all templates derived from this snippet.


 228          */
 229         private final TimerKey instantiationTimer;
 230 
 231         /**
 232          * Counts instantiations of all templates derived from this snippet.


 233          */
 234         private final CounterKey instantiationCounter;
 235 
 236         protected abstract Lazy lazy();
 237 
 238         protected SnippetInfo(ResolvedJavaMethod method, LocationIdentity[] privateLocations) {
 239             this.method = method;
 240             this.privateLocations = privateLocations;
 241             instantiationCounter = DebugContext.counter("SnippetInstantiationCount[%s]", method.getName());
 242             instantiationTimer = DebugContext.timer("SnippetInstantiationTime[%s]", method.getName());
 243             assert method.isStatic() : "snippet method must be static: " + method.format("%H.%n");
 244         }
 245 
 246         public ResolvedJavaMethod getMethod() {
 247             return method;
 248         }
 249 
 250         public int getParameterCount() {
 251             return lazy().constantParameters.length;
 252         }


 685         for (ConstantParameter p : method.getParameterAnnotations(ConstantParameter.class)) {
 686             if (p != null) {
 687                 return true;
 688             }
 689         }
 690         return false;
 691     }
 692 
 693     private final SnippetReflectionProvider snippetReflection;
 694 
 695     /**
 696      * Creates a snippet template.
 697      */
 698     @SuppressWarnings("try")
 699     protected SnippetTemplate(OptionValues options, DebugContext debug, final Providers providers, SnippetReflectionProvider snippetReflection, Arguments args) {
 700         this.snippetReflection = snippetReflection;
 701         this.info = args.info;
 702 
 703         Object[] constantArgs = getConstantArgs(args);
 704         StructuredGraph snippetGraph = providers.getReplacements().getSnippet(args.info.method, args.info.original, constantArgs);


 705 
 706         ResolvedJavaMethod method = snippetGraph.method();
 707         Signature signature = method.getSignature();
 708 
 709         PhaseContext phaseContext = new PhaseContext(providers);
 710 
 711         // Copy snippet graph, replacing constant parameters with given arguments
 712         final StructuredGraph snippetCopy = new StructuredGraph.Builder(options, debug).name(snippetGraph.name).method(snippetGraph.method()).build();
 713 
 714         try (DebugContext.Scope scope = debug.scope("SpecializeSnippet", snippetCopy)) {
 715             if (!snippetGraph.isUnsafeAccessTrackingEnabled()) {
 716                 snippetCopy.disableUnsafeAccessTracking();
 717             }
 718 
 719             EconomicMap<Node, Node> nodeReplacements = EconomicMap.create(Equivalence.IDENTITY);
 720             nodeReplacements.put(snippetGraph.start(), snippetCopy.start());
 721 
 722             MetaAccessProvider metaAccess = providers.getMetaAccess();
 723             assert checkTemplate(metaAccess, args, method, signature);
 724 


1055      */
1056     private final ArrayList<StateSplit> sideEffectNodes;
1057 
1058     /**
1059      * Nodes that inherit a deoptimization {@link FrameState} from the replacee during
1060      * instantiation.
1061      */
1062     private final ArrayList<DeoptimizingNode> deoptNodes;
1063 
1064     /**
1065      * Nodes that have a stamp originating from a {@link Placeholder}.
1066      */
1067     private final ArrayList<ValueNode> placeholderStampedNodes;
1068 
1069     /**
1070      * The nodes to be inlined when this specialization is instantiated.
1071      */
1072     private final ArrayList<Node> nodes;
1073 
1074     /**














1075      * Gets the instantiation-time bindings to this template's parameters.
1076      *
1077      * @return the map that will be used to bind arguments to parameters when inlining this template
1078      */
1079     private EconomicMap<Node, Node> bind(StructuredGraph replaceeGraph, MetaAccessProvider metaAccess, Arguments args) {
1080         EconomicMap<Node, Node> replacements = EconomicMap.create(Equivalence.IDENTITY);
1081         assert args.info.getParameterCount() == parameters.length : "number of args (" + args.info.getParameterCount() + ") != number of parameters (" + parameters.length + ")";
1082         for (int i = 0; i < parameters.length; i++) {
1083             Object parameter = parameters[i];
1084             assert parameter != null : this + " has no parameter named " + args.info.getParameterName(i);
1085             Object argument = args.values[i];
1086             if (parameter instanceof ParameterNode) {
1087                 if (argument instanceof ValueNode) {
1088                     replacements.put((ParameterNode) parameter, (ValueNode) argument);
1089                 } else {
1090                     JavaKind kind = ((ParameterNode) parameter).getStackKind();
1091                     assert argument != null || kind == JavaKind.Object : this + " cannot accept null for non-object parameter named " + args.info.getParameterName(i);
1092                     JavaConstant constant = forBoxed(argument, kind);
1093                     replacements.put((ParameterNode) parameter, ConstantNode.forConstant(constant, metaAccess, replaceeGraph));
1094                 }


1369      */
1370     @SuppressWarnings("try")
1371     public UnmodifiableEconomicMap<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args) {
1372         return instantiate(metaAccess, replacee, replacer, args, true);
1373     }
1374 
1375     /**
1376      * Replaces a given fixed node with this specialized snippet.
1377      *
1378      * @param metaAccess
1379      * @param replacee the node that will be replaced
1380      * @param replacer object that replaces the usages of {@code replacee}
1381      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1382      * @param killReplacee is true, the replacee node is deleted
1383      * @return the map of duplicated nodes (original -&gt; duplicate)
1384      */
1385     @SuppressWarnings("try")
1386     public UnmodifiableEconomicMap<Node, Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, UsageReplacer replacer, Arguments args, boolean killReplacee) {
1387         DebugContext debug = replacee.getDebug();
1388         assert assertSnippetKills(replacee);
1389         try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
1390             args.info.instantiationCounter.increment(debug);

1391             // Inline the snippet nodes, replacing parameters with the given args in the process
1392             StartNode entryPointNode = snippet.start();
1393             FixedNode firstCFGNode = entryPointNode.next();
1394             StructuredGraph replaceeGraph = replacee.graph();
1395             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1396             replacements.put(entryPointNode, AbstractBeginNode.prevBegin(replacee));
1397             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements);
1398             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1399 
1400             // Re-wire the control flow graph around the replacee
1401             FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
1402             replacee.replaceAtPredecessor(firstCFGNodeDuplicate);
1403 
1404             rewireFrameStates(replacee, duplicates);
1405 
1406             if (replacee instanceof DeoptimizingNode) {
1407                 DeoptimizingNode replaceeDeopt = (DeoptimizingNode) replacee;
1408 
1409                 FrameState stateBefore = null;
1410                 FrameState stateDuring = null;


1523      */
1524     public StructuredGraph copySpecializedGraph(DebugContext debugForCopy) {
1525         return (StructuredGraph) snippet.copy(debugForCopy);
1526     }
1527 
1528     /**
1529      * Replaces a given floating node with this specialized snippet.
1530      *
1531      * @param metaAccess
1532      * @param replacee the node that will be replaced
1533      * @param replacer object that replaces the usages of {@code replacee}
1534      * @param tool lowering tool used to insert the snippet into the control-flow
1535      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1536      */
1537     @SuppressWarnings("try")
1538     public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, LoweringTool tool, Arguments args) {
1539         DebugContext debug = replacee.getDebug();
1540         assert assertSnippetKills(replacee);
1541         try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
1542             args.info.instantiationCounter.increment(debug);

1543 
1544             // Inline the snippet nodes, replacing parameters with the given args in the process
1545             StartNode entryPointNode = snippet.start();
1546             FixedNode firstCFGNode = entryPointNode.next();
1547             StructuredGraph replaceeGraph = replacee.graph();
1548             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1549             replacements.put(entryPointNode, tool.getCurrentGuardAnchor().asNode());
1550             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements);
1551             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1552 
1553             FixedWithNextNode lastFixedNode = tool.lastFixedNode();
1554             assert lastFixedNode != null && lastFixedNode.isAlive() : replaceeGraph + " lastFixed=" + lastFixedNode;
1555             FixedNode next = lastFixedNode.next();
1556             lastFixedNode.setNext(null);
1557             FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
1558             replaceeGraph.addAfterFixed(lastFixedNode, firstCFGNodeDuplicate);
1559 
1560             rewireFrameStates(replacee, duplicates);
1561             updateStamps(replacee, duplicates);
1562 


1575             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After lowering %s with %s", replacee, this);
1576         }
1577     }
1578 
1579     /**
1580      * Replaces a given floating node with this specialized snippet.
1581      *
1582      * This snippet must be pure data-flow
1583      *
1584      * @param metaAccess
1585      * @param replacee the node that will be replaced
1586      * @param replacer object that replaces the usages of {@code replacee}
1587      * @param args the arguments to be bound to the flattened positional parameters of the snippet
1588      */
1589     @SuppressWarnings("try")
1590     public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, UsageReplacer replacer, Arguments args) {
1591         DebugContext debug = replacee.getDebug();
1592         assert assertSnippetKills(replacee);
1593         try (DebugCloseable a = args.info.instantiationTimer.start(debug)) {
1594             args.info.instantiationCounter.increment(debug);

1595 
1596             // Inline the snippet nodes, replacing parameters with the given args in the process
1597             StartNode entryPointNode = snippet.start();
1598             assert entryPointNode.next() == (memoryAnchor == null ? returnNode : memoryAnchor) : entryPointNode.next();
1599             StructuredGraph replaceeGraph = replacee.graph();
1600             EconomicMap<Node, Node> replacements = bind(replaceeGraph, metaAccess, args);
1601             MemoryAnchorNode anchorDuplicate = null;
1602             if (memoryAnchor != null) {
1603                 anchorDuplicate = replaceeGraph.add(new MemoryAnchorNode());
1604                 replacements.put(memoryAnchor, anchorDuplicate);
1605             }
1606             List<Node> floatingNodes = new ArrayList<>(nodes.size() - 2);
1607             for (Node n : nodes) {
1608                 if (n != entryPointNode && n != returnNode) {
1609                     floatingNodes.add(n);
1610                 }
1611             }
1612             UnmodifiableEconomicMap<Node, Node> duplicates = replaceeGraph.addDuplicates(floatingNodes, snippet, floatingNodes.size(), replacements);
1613             debug.dump(DebugContext.DETAILED_LEVEL, replaceeGraph, "After inlining snippet %s", snippet.method());
1614 


< prev index next >