Search in sources :

Example 6 with HotSpotCompilationRequest

use of jdk.vm.ci.hotspot.HotSpotCompilationRequest in project graal by oracle.

the class HotSpotTruffleCompilerImpl method getCompilationIdentifier.

@Override
public CompilationRequestIdentifier getCompilationIdentifier(CompilableTruffleAST compilable) {
    ResolvedJavaMethod rootMethod = partialEvaluator.rootForCallTarget(compilable);
    HotSpotCompilationRequest request = new HotSpotCompilationRequest((HotSpotResolvedJavaMethod) rootMethod, JVMCICompiler.INVOCATION_ENTRY_BCI, 0L);
    return new HotSpotTruffleCompilationIdentifier(request, compilable);
}
Also used : HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 7 with HotSpotCompilationRequest

use of jdk.vm.ci.hotspot.HotSpotCompilationRequest in project graal by oracle.

the class HotSpotGraalMBean method dumpMethod.

public void dumpMethod(String className, String methodName, String filter, String host, int port) throws javax.management.MBeanException {
    String jvmName = MetaUtil.toInternalName(className);
    methodDumps.add(new Dump(host, port, jvmName, methodName, filter));
    ClassNotFoundException last = null;
    EconomicSet<Class<?>> found = EconomicSet.create();
    Iterator<Reference<ClassLoader>> it = loaders.iterator();
    while (it.hasNext()) {
        Reference<ClassLoader> ref = it.next();
        ClassLoader loader = ref.get();
        if (loader == null) {
            it.remove();
            continue;
        }
        try {
            Class<?> clazz = Class.forName(className, false, loader);
            if (found.add(clazz)) {
                ResolvedJavaType type = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess().lookupJavaType(clazz);
                if (compiler != null) {
                    for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
                        if (methodName.equals(method.getName()) && method instanceof HotSpotResolvedJavaMethod) {
                            HotSpotResolvedJavaMethod hotSpotMethod = (HotSpotResolvedJavaMethod) method;
                            compiler.compileMethod(new HotSpotCompilationRequest(hotSpotMethod, -1, 0L), false);
                        }
                    }
                }
            }
        } catch (ClassNotFoundException ex) {
            last = ex;
        }
    }
    if (found.isEmpty()) {
        throw new javax.management.MBeanException(last, "Cannot find class " + className + " to schedule recompilation");
    }
}
Also used : HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) WeakReference(java.lang.ref.WeakReference) Reference(java.lang.ref.Reference) HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) HotSpotResolvedJavaType(jdk.vm.ci.hotspot.HotSpotResolvedJavaType) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 8 with HotSpotCompilationRequest

use of jdk.vm.ci.hotspot.HotSpotCompilationRequest in project graal by oracle.

the class MemoryUsageBenchmark method allocSpyCompilation.

@SuppressWarnings("try")
private void allocSpyCompilation(String methodName) {
    if (AllocSpy.isEnabled()) {
        HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) getResolvedJavaMethod(methodName);
        // invalidate any existing compiled code
        method.reprofile();
        long jvmciEnv = 0L;
        try (AllocSpy as = AllocSpy.open(methodName)) {
            HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
            HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, JVMCICompiler.INVOCATION_ENTRY_BCI, jvmciEnv);
            HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) runtime.getCompiler();
            OptionValues options = getInitialOptions();
            CompilationTask task = new CompilationTask(runtime, compiler, request, true, false, options);
            task.runCompilation();
        }
    }
}
Also used : HotSpotGraalCompiler(org.graalvm.compiler.hotspot.HotSpotGraalCompiler) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) AllocSpy(org.graalvm.compiler.core.test.AllocSpy) OptionValues(org.graalvm.compiler.options.OptionValues) HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) CompilationTask(org.graalvm.compiler.hotspot.CompilationTask) HotSpotJVMCIRuntimeProvider(jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider)

Aggregations

HotSpotCompilationRequest (jdk.vm.ci.hotspot.HotSpotCompilationRequest)8 HotSpotResolvedJavaMethod (jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod)6 CompilationTask (org.graalvm.compiler.hotspot.CompilationTask)5 HotSpotJVMCIRuntimeProvider (jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider)3 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)3 OptionValues (org.graalvm.compiler.options.OptionValues)3 HotSpotCompilationRequestResult (jdk.vm.ci.hotspot.HotSpotCompilationRequestResult)2 Print (org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print)2 HotSpotGraalCompiler (org.graalvm.compiler.hotspot.HotSpotGraalCompiler)2 File (java.io.File)1 Reference (java.lang.ref.Reference)1 WeakReference (java.lang.ref.WeakReference)1 Method (java.lang.reflect.Method)1 URLClassLoader (java.net.URLClassLoader)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 JarFile (java.util.jar.JarFile)1 CompilationRequestResult (jdk.vm.ci.code.CompilationRequestResult)1