use of org.graalvm.compiler.hotspot.HotSpotGraalCompiler in project graal by oracle.
the class CompileTheWorld method main.
public static void main(String[] args) throws Throwable {
HotSpotJVMCIRuntime jvmciRuntime = HotSpotJVMCIRuntime.runtime();
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) jvmciRuntime.getCompiler();
HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
HotSpotCodeCacheProvider codeCache = graalRuntime.getHostProviders().getCodeCache();
OptionValues options = loadOptions(graalRuntime.getOptions());
int iterations = Options.Iterations.getValue(options);
for (int i = 0; i < iterations; i++) {
codeCache.resetCompilationStatistics();
TTY.println("CompileTheWorld : iteration " + i);
CompileTheWorld ctw = new CompileTheWorld(jvmciRuntime, compiler, options);
ctw.compile();
}
// This is required as non-daemon threads can be started by class initializers
System.exit(0);
}
use of org.graalvm.compiler.hotspot.HotSpotGraalCompiler 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 org.graalvm.compiler.hotspot.HotSpotGraalCompiler 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());
}
}
use of org.graalvm.compiler.hotspot.HotSpotGraalCompiler in project graal by oracle.
the class HotSpotGraalCompilerTest method compileAndInstallSubstitution.
protected InstalledCode compileAndInstallSubstitution(Class<?> c, String methodName) {
ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(getMethod(c, methodName));
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler();
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
CompilationIdentifier compilationId = runtime().getHostBackend().getCompilationIdentifier(method);
OptionValues options = getInitialOptions();
StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, compilationId, options, getDebugContext(options));
if (graph != null) {
return getCode(method, graph, true, true, graph.getOptions());
}
return null;
}
use of org.graalvm.compiler.hotspot.HotSpotGraalCompiler 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();
}
}
}
Aggregations