use of jdk.vm.ci.meta.ResolvedJavaType in project graal by oracle.
the class TruffleGraphBuilderPlugins method registerCompilerAssertsPlugins.
public static void registerCompilerAssertsPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification) {
final ResolvedJavaType compilerAssertsType = getRuntime().resolveType(metaAccess, "com.oracle.truffle.api.CompilerAsserts");
Registration r = new Registration(plugins, new ResolvedJavaSymbol(compilerAssertsType));
r.register1("partialEvaluationConstant", Object.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
ValueNode curValue = value;
if (curValue instanceof BoxNode) {
BoxNode boxNode = (BoxNode) curValue;
curValue = boxNode.getValue();
}
if (curValue.isConstant()) {
return true;
} else if (canDelayIntrinsification) {
return false;
} else {
StringBuilder sb = new StringBuilder();
sb.append(curValue);
if (curValue instanceof ValuePhiNode) {
ValuePhiNode valuePhi = (ValuePhiNode) curValue;
sb.append(" (");
for (Node n : valuePhi.inputs()) {
sb.append(n);
sb.append("; ");
}
sb.append(")");
}
value.getDebug().dump(DebugContext.VERBOSE_LEVEL, value.graph(), "Graph before bailout at node %s", sb);
throw b.bailout("Partial evaluation did not reduce value to a constant, is a regular compiler node: " + sb);
}
}
});
r.register0("neverPartOfCompilation", new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
b.add(new NeverPartOfCompilationNode("CompilerAsserts.neverPartOfCompilation()"));
return true;
}
});
r.register1("neverPartOfCompilation", String.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode message) {
if (message.isConstant()) {
String messageString = message.asConstant().toValueString();
b.add(new NeverPartOfCompilationNode(messageString));
return true;
} else {
throw b.bailout("message for never part of compilation is non-constant");
}
}
});
}
use of jdk.vm.ci.meta.ResolvedJavaType in project graal by oracle.
the class TruffleGraphBuilderPlugins method registerFrameWithBoxingPlugins.
public static void registerFrameWithBoxingPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification) {
ResolvedJavaType frameWithBoxingType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.FrameWithBoxing");
Registration r = new Registration(plugins, new ResolvedJavaSymbol(frameWithBoxingType));
registerFrameMethods(r);
registerUnsafeCast(r, canDelayIntrinsification);
}
use of jdk.vm.ci.meta.ResolvedJavaType in project graal by oracle.
the class TruffleGraphBuilderPlugins method registerFrameWithoutBoxingPlugins.
public static void registerFrameWithoutBoxingPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification, ConstantReflectionProvider constantReflection, KnownTruffleTypes types) {
ResolvedJavaType frameWithoutBoxingType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing");
Registration r = new Registration(plugins, new ResolvedJavaSymbol(frameWithoutBoxingType));
registerFrameMethods(r);
registerUnsafeCast(r, canDelayIntrinsification);
registerUnsafeLoadStorePlugins(r, canDelayIntrinsification, null, JavaKind.Int, JavaKind.Long, JavaKind.Float, JavaKind.Double, JavaKind.Object);
if (TruffleCompilerOptions.getValue(Options.TruffleIntrinsifyFrameAccess)) {
registerFrameAccessors(r, JavaKind.Object, constantReflection, types);
registerFrameAccessors(r, JavaKind.Long, constantReflection, types);
registerFrameAccessors(r, JavaKind.Int, constantReflection, types);
registerFrameAccessors(r, JavaKind.Double, constantReflection, types);
registerFrameAccessors(r, JavaKind.Float, constantReflection, types);
registerFrameAccessors(r, JavaKind.Boolean, constantReflection, types);
registerFrameAccessors(r, JavaKind.Byte, constantReflection, types);
}
}
use of jdk.vm.ci.meta.ResolvedJavaType in project graal by oracle.
the class HotSpotTruffleRuntime method getTruffleCallBoundaryMethods.
@Override
public synchronized Iterable<ResolvedJavaMethod> getTruffleCallBoundaryMethods() {
if (truffleCallBoundaryMethods == null) {
truffleCallBoundaryMethods = new ArrayList<>();
MetaAccessProvider metaAccess = getMetaAccess();
ResolvedJavaType type = metaAccess.lookupJavaType(OptimizedCallTarget.class);
for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
if (method.getAnnotation(TruffleCallBoundary.class) != null) {
truffleCallBoundaryMethods.add(method);
}
}
}
return truffleCallBoundaryMethods;
}
use of jdk.vm.ci.meta.ResolvedJavaType in project graal by oracle.
the class TruffleCallBoundaryInstrumentation method recordMark.
@Override
public Mark recordMark(Object id) {
Mark mark = super.recordMark(id);
if ((int) id == config.MARKID_VERIFIED_ENTRY) {
ResolvedJavaType optimizedCallTargetType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.hotspot.HotSpotOptimizedCallTarget");
int installedCodeOffset = getFieldOffset("installedCode", optimizedCallTargetType);
int entryPointOffset = getFieldOffset("entryPoint", metaAccess.lookupJavaType(InstalledCode.class));
injectTailCallCode(installedCodeOffset, entryPointOffset);
}
return mark;
}
Aggregations