use of org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print in project graal by oracle.
the class CompileTheWorld method compileMethod.
/**
* Compiles a method and gathers some statistics.
*/
private void compileMethod(HotSpotResolvedJavaMethod method, int counter) {
try {
long start = System.currentTimeMillis();
long allocatedAtStart = getCurrentThreadAllocatedBytes();
int entryBCI = JVMCICompiler.INVOCATION_ENTRY_BCI;
HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, 0L);
// For more stable CTW execution, disable use of profiling information
boolean useProfilingInfo = false;
boolean installAsDefault = false;
CompilationTask task = new CompilationTask(jvmciRuntime, compiler, request, useProfilingInfo, installAsDefault, currentOptions);
task.runCompilation();
// Invalidate the generated code so the code cache doesn't fill up
HotSpotInstalledCode installedCode = task.getInstalledCode();
if (installedCode != null) {
installedCode.invalidate();
}
memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
compileTime.getAndAdd(System.currentTimeMillis() - start);
compiledMethodsCounter.incrementAndGet();
} catch (Throwable t) {
// Catch everything and print a message
println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
printStackTrace(t);
}
}
Aggregations