src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java Fri Jul 7 09:31:24 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java Fri Jul 7 09:31:24 2017
*** 31,40 ****
--- 31,41 ----
import org.graalvm.compiler.core.common.CancellationBailoutException;
import org.graalvm.compiler.core.common.CompilationIdentifier;
import org.graalvm.compiler.core.common.GraalOptions;
import org.graalvm.compiler.core.common.cfg.BlockMap;
import org.graalvm.compiler.core.common.type.Stamp;
+ import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.JavaMethodContext;
import org.graalvm.compiler.graph.Graph;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeMap;
import org.graalvm.compiler.nodes.calc.FloatingNode;
*** 165,228 ****
--- 166,264 ----
private CompilationIdentifier compilationId = CompilationIdentifier.INVALID_COMPILATION_ID;
private int entryBCI = JVMCICompiler.INVOCATION_ENTRY_BCI;
private boolean useProfilingInfo = true;
private final OptionValues options;
private Cancellable cancellable = null;
+ private final DebugContext debug;
/**
* Creates a builder for a graph.
*/
! public Builder(OptionValues options, DebugContext debug, AllowAssumptions allowAssumptions) {
this.options = options;
+ this.debug = debug;
this.assumptions = allowAssumptions == AllowAssumptions.YES ? new Assumptions() : null;
}
/**
* Creates a builder for a graph that does not support {@link Assumptions}.
*/
! public Builder(OptionValues options, DebugContext debug) {
this.options = options;
+ this.debug = debug;
assumptions = null;
}
+ public String getName() {
+ return name;
+ }
+
public Builder name(String s) {
this.name = s;
return this;
}
+ public ResolvedJavaMethod getMethod() {
+ return rootMethod;
+ }
+
public Builder method(ResolvedJavaMethod method) {
this.rootMethod = method;
return this;
}
+ public DebugContext getDebug() {
+ return debug;
+ }
+
+ public SpeculationLog getSpeculationLog() {
+ return speculationLog;
+ }
+
public Builder speculationLog(SpeculationLog log) {
this.speculationLog = log;
return this;
}
+ public CompilationIdentifier getCompilationId() {
+ return compilationId;
+ }
+
public Builder compilationId(CompilationIdentifier id) {
this.compilationId = id;
return this;
}
+ public Cancellable getCancellable() {
+ return cancellable;
+ }
+
public Builder cancellable(Cancellable cancel) {
this.cancellable = cancel;
return this;
}
+ public int getEntryBCI() {
+ return entryBCI;
+ }
+
public Builder entryBCI(int bci) {
this.entryBCI = bci;
return this;
}
+ public boolean getUseProfilingInfo() {
+ return useProfilingInfo;
+ }
+
public Builder useProfilingInfo(boolean flag) {
this.useProfilingInfo = flag;
return this;
}
public StructuredGraph build() {
! return new StructuredGraph(name, rootMethod, entryBCI, assumptions, speculationLog, useProfilingInfo, compilationId, options, debug, cancellable);
}
}
public static final long INVALID_GRAPH_ID = -1;
private static final AtomicLong uniqueGraphIds = new AtomicLong();
*** 278,289 ****
--- 314,326 ----
Assumptions assumptions,
SpeculationLog speculationLog,
boolean useProfilingInfo,
CompilationIdentifier compilationId,
OptionValues options,
+ DebugContext debug,
Cancellable cancellable) {
! super(name, options, debug);
this.setStart(add(new StartNode()));
this.rootMethod = method;
this.graphId = uniqueGraphIds.incrementAndGet();
this.compilationId = compilationId;
this.entryBCI = entryBCI;
*** 402,427 ****
--- 439,467 ----
/**
* 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
+ * @param debugForCopy the debug context for the graph copy. This must not be the debug for this
+ * graph if this graph can be accessed from multiple threads (e.g., it's in a cache
+ * accessed by multiple threads).
*/
@Override
! protected Graph copy(String newName, Consumer<UnmodifiableEconomicMap<Node, Node>> duplicationMapCallback, DebugContext debugForCopy) {
! return copy(newName, duplicationMapCallback, compilationId, debugForCopy);
}
! private StructuredGraph copy(String newName, Consumer<UnmodifiableEconomicMap<Node, Node>> duplicationMapCallback, CompilationIdentifier newCompilationId, DebugContext debugForCopy) {
AllowAssumptions allowAssumptions = AllowAssumptions.ifNonNull(assumptions);
StructuredGraph copy = new StructuredGraph(newName,
method(),
entryBCI,
assumptions == null ? null : new Assumptions(),
speculationLog,
useProfilingInfo,
newCompilationId,
! getOptions(), debugForCopy, null);
if (allowAssumptions == AllowAssumptions.YES && assumptions != null) {
copy.assumptions.record(assumptions);
}
copy.hasUnsafeAccess = hasUnsafeAccess;
copy.setGuardsStage(getGuardsStage());
*** 435,446 ****
--- 475,491 ----
duplicationMapCallback.accept(duplicates);
}
return copy;
}
public StructuredGraph copyWithIdentifier(CompilationIdentifier newCompilationId) {
return copy(name, null, newCompilationId);
+ /**
+ * @param debugForCopy the debug context for the graph copy. This must not be the debug for this
+ * graph if this graph can be accessed from multiple threads (e.g., it's in a cache
+ * accessed by multiple threads).
+ */
+ public StructuredGraph copyWithIdentifier(CompilationIdentifier newCompilationId, DebugContext debugForCopy) {
+ return copy(name, null, newCompilationId, debugForCopy);
}
public ParameterNode getParameter(int index) {
for (ParameterNode param : getNodes(ParameterNode.TYPE)) {
if (param.index() == index) {
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File