use of org.graalvm.compiler.debug.DebugContext.Builder in project graal by oracle.
the class LambdaStableNameTest method findStableLambdaName.
private String findStableLambdaName(ResolvedJavaType type) {
OptionValues options = new OptionValues(OptionValues.newOptionMap());
DebugContext debug = new Builder(options, Collections.emptyList()).build();
GraalJVMCICompiler compiler = (GraalJVMCICompiler) JVMCI.getRuntime().getCompiler();
Providers providers = compiler.getGraalRuntime().getCapability(RuntimeProvider.class).getHostBackend().getProviders();
final HotSpotJITClassInitializationPlugin initializationPlugin = new HotSpotJITClassInitializationPlugin();
return LambdaUtils.findStableLambdaName(initializationPlugin, providers, type, options, debug, this);
}
use of org.graalvm.compiler.debug.DebugContext.Builder in project graal by oracle.
the class JVMCIInfopointErrorTest method testUnknownJavaValue.
@SuppressWarnings("try")
@Test(expected = Error.class)
public void testUnknownJavaValue() {
DebugContext debug = new Builder(getInitialOptions()).build();
try (Scope s = debug.disable()) {
/*
* Expected: either AssertionError or GraalError, depending on whether the unit test run
* is with assertions enabled or disabled.
*/
test(debug, (tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[] { new UnknownJavaValue() }, new JavaKind[] { JavaKind.Int }, 1, 0, 0);
safepoint.accept(newState);
});
}
}
use of org.graalvm.compiler.debug.DebugContext.Builder in project graal by oracle.
the class Stub method openDebugContext.
private DebugContext openDebugContext(DebugContext outer) {
if (DebugStubsAndSnippets.getValue(options)) {
Description description = new Description(linkage, "Stub_" + nextStubId.incrementAndGet());
GraalDebugHandlersFactory factory = new GraalDebugHandlersFactory(providers.getSnippetReflection());
return new Builder(options, factory).globalMetrics(outer.getGlobalMetrics()).description(description).build();
}
return DebugContext.disabled(options);
}
use of org.graalvm.compiler.debug.DebugContext.Builder in project graal by oracle.
the class GraalTest method getDebugContext.
/**
* Gets a {@link DebugContext} object corresponding to {@code options}, creating a new one if
* none currently exists. Debug contexts created by this method will have their
* {@link DebugDumpHandler}s closed in {@link #afterTest()}.
*
* @param options currently active options
* @param id identification of the compilation or {@code null}
* @param method method to use for a proper description of the context or {@code null}
* @return configured context for compilation
*/
protected DebugContext getDebugContext(OptionValues options, String id, ResolvedJavaMethod method) {
List<DebugContext> cached = cachedDebugs.get();
if (cached == null) {
cached = new ArrayList<>();
cachedDebugs.set(cached);
}
for (DebugContext debug : cached) {
if (debug.getOptions() == options) {
return debug;
}
}
final DebugContext.Description descr;
if (method == null) {
descr = NO_DESCRIPTION;
} else {
descr = new DebugContext.Description(method, id == null ? method.getName() : id);
}
DebugContext debug = new Builder(options, getDebugHandlersFactories()).globalMetrics(globalMetrics).description(descr).build();
cached.add(debug);
return debug;
}
use of org.graalvm.compiler.debug.DebugContext.Builder in project graal by oracle.
the class IsolatedGraalUtils method compileInNewIsolate0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static void compileInNewIsolate0(@SuppressWarnings("unused") @CEntryPoint.IsolateThreadContext CompilerIsolateThread isolate, ClientIsolateThread clientIsolate, ImageHeapRef<SubstrateMethod> methodRef) {
IsolatedCompileContext.set(new IsolatedCompileContext(clientIsolate));
try (DebugContext debug = new Builder(RuntimeOptionValues.singleton(), new GraalDebugHandlersFactory(GraalSupport.getRuntimeConfig().getSnippetReflection())).build()) {
SubstrateGraalUtils.doCompile(debug, GraalSupport.getRuntimeConfig(), GraalSupport.getSuites(), GraalSupport.getLIRSuites(), ImageHeapObjects.deref(methodRef));
}
IsolatedCompileContext.set(null);
}
Aggregations