use of jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider in project graal by oracle.
the class HotSpotTruffleRuntimeAccess method getRuntime.
@Override
public TruffleRuntime getRuntime() {
// initialize JVMCI to make sure the TruffleCompiler option is parsed
Services.initializeJVMCI();
HotSpotJVMCIRuntimeProvider hsRuntime = (HotSpotJVMCIRuntimeProvider) JVMCI.getRuntime();
HotSpotVMConfigAccess config = new HotSpotVMConfigAccess(hsRuntime.getConfigStore());
boolean useCompiler = config.getFlag("UseCompiler", Boolean.class);
if (!useCompiler) {
// This happens, for example, when -Xint is given on the command line
return new DefaultTruffleRuntime();
}
return new HotSpotTruffleRuntime(new LazyGraalRuntime());
}
use of jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider in project graal by oracle.
the class MemoryUsageBenchmark method doCompilation.
@SuppressWarnings("try")
private void doCompilation(String methodName, String label) {
HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) getResolvedJavaMethod(methodName);
// invalidate any existing compiled code
method.reprofile();
long jvmciEnv = 0L;
try (MemoryUsageCloseable c = label == null ? null : new MemoryUsageCloseable(label)) {
HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
int entryBCI = JVMCICompiler.INVOCATION_ENTRY_BCI;
HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, jvmciEnv);
CompilationTask task = new CompilationTask(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), request, true, false, getInitialOptions());
task.runCompilation();
}
}
use of jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider in project graal by oracle.
the class MemoryUsageBenchmark method run.
public void run() {
compileAndTime("simple");
compileAndTime("complex");
OptionValues options = CompileTheWorld.loadOptions(getInitialOptions());
if (CompileTheWorld.Options.Classpath.getValue(options) != CompileTheWorld.SUN_BOOT_CLASS_PATH) {
HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
CompileTheWorld ctw = new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), options);
try {
ctw.compile();
} catch (Throwable e) {
e.printStackTrace();
}
}
allocSpyCompilation("simple");
allocSpyCompilation("complex");
}
use of jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider in project graal by oracle.
the class CompileTheWorldTest method testJDK.
@Test
public void testJDK() throws Throwable {
ExceptionAction originalBailoutAction = CompilationBailoutAction.getValue(getInitialOptions());
ExceptionAction originalFailureAction = CompilationFailureAction.getValue(getInitialOptions());
// Compile a couple classes in rt.jar
HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
System.setProperty("CompileTheWorld.LimitModules", "java.base");
OptionValues initialOptions = getInitialOptions();
EconomicMap<OptionKey<?>, Object> compilationOptions = CompileTheWorld.parseOptions("Inline=false");
new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), CompileTheWorld.SUN_BOOT_CLASS_PATH, 1, 5, null, null, false, initialOptions, compilationOptions).compile();
assert CompilationBailoutAction.getValue(initialOptions) == originalBailoutAction;
assert CompilationFailureAction.getValue(initialOptions) == originalFailureAction;
}
use of jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider in project graal by oracle.
the class GraalOSRTestBase method compile.
protected static void compile(DebugContext debug, ResolvedJavaMethod method, int bci) {
HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
long jvmciEnv = 0L;
HotSpotCompilationRequest request = new HotSpotCompilationRequest((HotSpotResolvedJavaMethod) method, bci, jvmciEnv);
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) runtime.getCompiler();
CompilationTask task = new CompilationTask(runtime, compiler, request, true, true, debug.getOptions());
if (method instanceof HotSpotResolvedJavaMethod) {
HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
if (((HotSpotResolvedJavaMethod) method).hasCodeAtLevel(bci, config.compilationLevelFullOptimization)) {
return;
}
}
HotSpotCompilationRequestResult result = task.runCompilation(debug);
if (result.getFailure() != null) {
throw new GraalError(result.getFailureMessage());
}
}
Aggregations