Search in sources :

Example 1 with CompilationListenerProfiler

use of org.graalvm.compiler.core.common.CompilationListenerProfiler in project graal by oracle.

the class HotSpotGraalRuntime method openDebugContext.

@Override
public DebugContext openDebugContext(OptionValues compilationOptions, CompilationIdentifier compilationId, Object compilable, Iterable<DebugHandlersFactory> factories, PrintStream logStream) {
    if (management != null && management.poll(false) != null) {
        if (compilable instanceof HotSpotResolvedJavaMethod) {
            HotSpotResolvedObjectType type = ((HotSpotResolvedJavaMethod) compilable).getDeclaringClass();
            if (type instanceof HotSpotResolvedJavaType) {
                Class<?> clazz = runtime().getMirror(type);
                if (clazz != null) {
                    try {
                        ClassLoader cl = clazz.getClassLoader();
                        if (cl != null) {
                            loaders.add(cl);
                        }
                    } catch (SecurityException e) {
                    // This loader can obviously not be used for resolving class names
                    }
                }
            }
        }
    }
    Description description = new Description(compilable, compilationId.toString(CompilationIdentifier.Verbosity.ID));
    Builder builder = // 
    new Builder(compilationOptions, factories).globalMetrics(// 
    metricValues).description(// 
    description).logStream(logStream);
    if (compilerProfiler != null) {
        int compileId = ((HotSpotCompilationIdentifier) compilationId).getRequest().getId();
        builder.compilationListener(new CompilationListenerProfiler(compilerProfiler, compileId));
    }
    return builder.build();
}
Also used : HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) Description(org.graalvm.compiler.debug.DebugContext.Description) HotSpotResolvedObjectType(jdk.vm.ci.hotspot.HotSpotResolvedObjectType) HotSpotResolvedJavaType(jdk.vm.ci.hotspot.HotSpotResolvedJavaType) Builder(org.graalvm.compiler.debug.DebugContext.Builder) CompilationListenerProfiler(org.graalvm.compiler.core.common.CompilationListenerProfiler)

Aggregations

HotSpotResolvedJavaMethod (jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod)1 HotSpotResolvedJavaType (jdk.vm.ci.hotspot.HotSpotResolvedJavaType)1 HotSpotResolvedObjectType (jdk.vm.ci.hotspot.HotSpotResolvedObjectType)1 CompilationListenerProfiler (org.graalvm.compiler.core.common.CompilationListenerProfiler)1 Builder (org.graalvm.compiler.debug.DebugContext.Builder)1 Description (org.graalvm.compiler.debug.DebugContext.Description)1