< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java
Print this page
*** 49,58 ****
--- 49,60 ----
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver;
+ import org.graalvm.compiler.nodes.spi.CoreProviders;
+ import org.graalvm.compiler.nodes.spi.Replacements;
import org.graalvm.compiler.nodes.spi.StampProvider;
import org.graalvm.compiler.options.OptionValues;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.BytecodeFrame;
*** 68,100 ****
* Implementation of {@link GraphBuilderContext} used to produce a graph for a method based on an
* {@link InvocationPlugin} for the method.
*/
public class IntrinsicGraphBuilder implements GraphBuilderContext, Receiver {
! protected final MetaAccessProvider metaAccess;
! protected final ConstantReflectionProvider constantReflection;
! protected final ConstantFieldProvider constantFieldProvider;
! protected final StampProvider stampProvider;
protected final StructuredGraph graph;
protected final Bytecode code;
protected final ResolvedJavaMethod method;
protected final int invokeBci;
protected FixedWithNextNode lastInstr;
protected ValueNode[] arguments;
protected ValueNode returnValue;
! public IntrinsicGraphBuilder(OptionValues options, DebugContext debug, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider,
! StampProvider stampProvider, Bytecode code, int invokeBci) {
! this(options, debug, metaAccess, constantReflection, constantFieldProvider, stampProvider, code, invokeBci, AllowAssumptions.YES);
}
! protected IntrinsicGraphBuilder(OptionValues options, DebugContext debug, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider,
! StampProvider stampProvider, Bytecode code, int invokeBci, AllowAssumptions allowAssumptions) {
! this.metaAccess = metaAccess;
! this.constantReflection = constantReflection;
! this.constantFieldProvider = constantFieldProvider;
! this.stampProvider = stampProvider;
this.code = code;
this.method = code.getMethod();
this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).setIsSubstitution(true).trackNodeSourcePosition(true).build();
this.invokeBci = invokeBci;
this.lastInstr = graph.start();
--- 70,94 ----
* Implementation of {@link GraphBuilderContext} used to produce a graph for a method based on an
* {@link InvocationPlugin} for the method.
*/
public class IntrinsicGraphBuilder implements GraphBuilderContext, Receiver {
! protected final CoreProviders providers;
protected final StructuredGraph graph;
protected final Bytecode code;
protected final ResolvedJavaMethod method;
protected final int invokeBci;
protected FixedWithNextNode lastInstr;
protected ValueNode[] arguments;
protected ValueNode returnValue;
! public IntrinsicGraphBuilder(OptionValues options, DebugContext debug, CoreProviders providers, Bytecode code, int invokeBci) {
! this(options, debug, providers, code, invokeBci, AllowAssumptions.YES);
}
! protected IntrinsicGraphBuilder(OptionValues options, DebugContext debug, CoreProviders providers, Bytecode code, int invokeBci, AllowAssumptions allowAssumptions) {
! this.providers = providers;
this.code = code;
this.method = code.getMethod();
this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).setIsSubstitution(true).trackNodeSourcePosition(true).build();
this.invokeBci = invokeBci;
this.lastInstr = graph.start();
*** 131,141 ****
}
private <T extends ValueNode> void updateLastInstruction(T v) {
if (v instanceof FixedNode) {
FixedNode fixedNode = (FixedNode) v;
! lastInstr.setNext(fixedNode);
if (fixedNode instanceof FixedWithNextNode) {
FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) fixedNode;
assert fixedWithNextNode.next() == null : "cannot append instruction to instruction which isn't end";
lastInstr = fixedWithNextNode;
} else {
--- 125,137 ----
}
private <T extends ValueNode> void updateLastInstruction(T v) {
if (v instanceof FixedNode) {
FixedNode fixedNode = (FixedNode) v;
! if (lastInstr != null) {
! lastInstr.setNext(fixedNode);
! }
if (fixedNode instanceof FixedWithNextNode) {
FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) fixedNode;
assert fixedWithNextNode.next() == null : "cannot append instruction to instruction which isn't end";
lastInstr = fixedWithNextNode;
} else {
*** 173,198 ****
throw GraalError.shouldNotReachHere();
}
@Override
public StampProvider getStampProvider() {
! return stampProvider;
}
@Override
public MetaAccessProvider getMetaAccess() {
! return metaAccess;
}
@Override
public ConstantReflectionProvider getConstantReflection() {
! return constantReflection;
}
@Override
public ConstantFieldProvider getConstantFieldProvider() {
! return constantFieldProvider;
}
@Override
public StructuredGraph getGraph() {
return graph;
--- 169,199 ----
throw GraalError.shouldNotReachHere();
}
@Override
public StampProvider getStampProvider() {
! return providers.getStampProvider();
}
@Override
public MetaAccessProvider getMetaAccess() {
! return providers.getMetaAccess();
}
@Override
public ConstantReflectionProvider getConstantReflection() {
! return providers.getConstantReflection();
}
@Override
public ConstantFieldProvider getConstantFieldProvider() {
! return providers.getConstantFieldProvider();
! }
!
! @Override
! public Replacements getReplacements() {
! return providers.getReplacements();
}
@Override
public StructuredGraph getGraph() {
return graph;
< prev index next >