Search in sources :

Example 1 with AllocSpy

use of org.graalvm.compiler.core.test.AllocSpy 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)1 HotSpotJVMCIRuntimeProvider (jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider)1 HotSpotResolvedJavaMethod (jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod)1 AllocSpy (org.graalvm.compiler.core.test.AllocSpy)1 CompilationTask (org.graalvm.compiler.hotspot.CompilationTask)1 HotSpotGraalCompiler (org.graalvm.compiler.hotspot.HotSpotGraalCompiler)1 OptionValues (org.graalvm.compiler.options.OptionValues)1