Example #1
0
 /**
  * Creates a copy of this graph.
  *
  * @param newName the name of the copy, used for debugging purposes (can be null)
  * @param duplicationMapCallback consumer of the duplication map created during the copying
  */
 @Override
 protected Graph copy(String newName, Consumer<Map<Node, Node>> duplicationMapCallback) {
   AllowAssumptions allowAssumptions = AllowAssumptions.from(assumptions != null);
   StructuredGraph copy =
       new StructuredGraph(
           newName, method, graphId, entryBCI, allowAssumptions, speculationLog, useProfilingInfo);
   if (allowAssumptions == AllowAssumptions.YES && assumptions != null) {
     copy.assumptions.record(assumptions);
   }
   copy.hasUnsafeAccess = hasUnsafeAccess;
   copy.setGuardsStage(getGuardsStage());
   copy.isAfterFloatingReadPhase = isAfterFloatingReadPhase;
   copy.hasValueProxies = hasValueProxies;
   Map<Node, Node> replacements = Node.newMap();
   replacements.put(start, copy.start);
   Map<Node, Node> duplicates =
       copy.addDuplicates(getNodes(), this, this.getNodeCount(), replacements);
   if (duplicationMapCallback != null) {
     duplicationMapCallback.accept(duplicates);
   }
   return copy;
 }