src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java
Print this page
*** 28,38 ****
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintBailout;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintCompilation;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintFilter;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintStackTraceOnException;
import static org.graalvm.compiler.core.phases.HighTier.Options.Inline;
!
import java.util.List;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.debug.Debug;
import org.graalvm.compiler.debug.Debug.Scope;
--- 28,38 ----
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintBailout;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintCompilation;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintFilter;
import static org.graalvm.compiler.core.GraalCompilerOptions.PrintStackTraceOnException;
import static org.graalvm.compiler.core.phases.HighTier.Options.Inline;
! import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
import java.util.List;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.debug.Debug;
import org.graalvm.compiler.debug.Debug.Scope;
*** 42,53 ****
import org.graalvm.compiler.debug.DebugTimer;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.Management;
import org.graalvm.compiler.debug.TTY;
import org.graalvm.compiler.debug.TimeSource;
! import org.graalvm.compiler.options.OptionValue;
! import org.graalvm.compiler.options.OptionValue.OverrideScope;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.hotspot.EventProvider;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
--- 42,54 ----
import org.graalvm.compiler.debug.DebugTimer;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.Management;
import org.graalvm.compiler.debug.TTY;
import org.graalvm.compiler.debug.TimeSource;
! import org.graalvm.compiler.options.OptionKey;
! import org.graalvm.compiler.options.OptionValues;
! import org.graalvm.util.EconomicMap;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.hotspot.EventProvider;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
*** 91,115 ****
* {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
*/
private final boolean installAsDefault;
private final boolean useProfilingInfo;
static class Lazy {
/**
* A {@link com.sun.management.ThreadMXBean} to be able to query some information about the
* current compiler thread, e.g. total allocated bytes.
*/
static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) Management.getThreadMXBean();
}
! public CompilationTask(HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotGraalCompiler compiler, HotSpotCompilationRequest request, boolean useProfilingInfo, boolean installAsDefault) {
this.jvmciRuntime = jvmciRuntime;
this.compiler = compiler;
this.compilationId = new HotSpotCompilationIdentifier(request);
this.useProfilingInfo = useProfilingInfo;
this.installAsDefault = installAsDefault;
}
public HotSpotResolvedJavaMethod getMethod() {
return getRequest().getMethod();
}
--- 92,138 ----
* {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
*/
private final boolean installAsDefault;
private final boolean useProfilingInfo;
+ private final OptionValues options;
static class Lazy {
/**
* A {@link com.sun.management.ThreadMXBean} to be able to query some information about the
* current compiler thread, e.g. total allocated bytes.
*/
static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) Management.getThreadMXBean();
}
! public CompilationTask(HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotGraalCompiler compiler, HotSpotCompilationRequest request, boolean useProfilingInfo, boolean installAsDefault,
! OptionValues options) {
this.jvmciRuntime = jvmciRuntime;
this.compiler = compiler;
this.compilationId = new HotSpotCompilationIdentifier(request);
this.useProfilingInfo = useProfilingInfo;
this.installAsDefault = installAsDefault;
+
+ /*
+ * Disable inlining if HotSpot has it disabled unless it's been explicitly set in Graal.
+ */
+ HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
+ GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
+ OptionValues newOptions = options;
+ if (!config.inline) {
+ EconomicMap<OptionKey<?>, Object> m = OptionValues.newOptionMap();
+ if (Inline.getValue(options) && !Inline.hasBeenSet(options)) {
+ m.put(Inline, false);
+ }
+ if (InlineDuringParsing.getValue(options) && !InlineDuringParsing.hasBeenSet(options)) {
+ m.put(InlineDuringParsing, false);
+ }
+ if (!m.isEmpty()) {
+ newOptions = new OptionValues(options, m);
+ }
+ }
+ this.options = newOptions;
}
public HotSpotResolvedJavaMethod getMethod() {
return getRequest().getMethod();
}
*** 197,214 ****
return null;
}
CompilationResult result = null;
try (DebugCloseable a = CompilationTime.start()) {
! CompilationStatistics stats = CompilationStatistics.create(method, isOSR);
! final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed();
! final boolean printAfterCompilation = PrintAfterCompilation.getValue() && !TTY.isSuppressed();
if (printCompilation) {
TTY.println(getMethodDescription() + "...");
}
! TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
final long start;
final long allocatedBytesBefore;
if (printAfterCompilation || printCompilation) {
start = TimeSource.getTimeNS();
allocatedBytesBefore = printAfterCompilation || printCompilation ? Lazy.threadMXBean.getThreadAllocatedBytes(threadId) : 0L;
--- 220,237 ----
return null;
}
CompilationResult result = null;
try (DebugCloseable a = CompilationTime.start()) {
! CompilationStatistics stats = CompilationStatistics.create(options, method, isOSR);
! final boolean printCompilation = PrintCompilation.getValue(options) && !TTY.isSuppressed();
! final boolean printAfterCompilation = PrintAfterCompilation.getValue(options) && !TTY.isSuppressed();
if (printCompilation) {
TTY.println(getMethodDescription() + "...");
}
! TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(options), method);
final long start;
final long allocatedBytesBefore;
if (printAfterCompilation || printCompilation) {
start = TimeSource.getTimeNS();
allocatedBytesBefore = printAfterCompilation || printCompilation ? Lazy.threadMXBean.getThreadAllocatedBytes(threadId) : 0L;
*** 218,235 ****
}
try (Scope s = Debug.scope("Compiling", new DebugDumpScope(getIdString(), true))) {
// Begin the compilation event.
compilationEvent.begin();
! /*
! * Disable inlining if HotSpot has it disabled unless it's been explicitly set in
! * Graal.
! */
! boolean disableInlining = !config.inline && !Inline.hasBeenSet();
! try (OverrideScope s1 = disableInlining ? OptionValue.override(Inline, false) : null) {
! result = compiler.compile(method, entryBCI, useProfilingInfo, compilationId);
! }
} catch (Throwable e) {
throw Debug.handle(e);
} finally {
// End the compilation event.
compilationEvent.end();
--- 241,251 ----
}
try (Scope s = Debug.scope("Compiling", new DebugDumpScope(getIdString(), true))) {
// Begin the compilation event.
compilationEvent.begin();
! result = compiler.compile(method, entryBCI, useProfilingInfo, compilationId, options);
} catch (Throwable e) {
throw Debug.handle(e);
} finally {
// End the compilation event.
compilationEvent.end();
*** 262,287 ****
return HotSpotCompilationRequestResult.success(result.getBytecodeSize() - method.getCodeSize());
}
return null;
} catch (BailoutException bailout) {
BAILOUTS.increment();
! if (ExitVMOnBailout.getValue()) {
TTY.out.println(method.format("Bailout in %H.%n(%p)"));
bailout.printStackTrace(TTY.out);
System.exit(-1);
! } else if (PrintBailout.getValue()) {
TTY.out.println(method.format("Bailout in %H.%n(%p)"));
bailout.printStackTrace(TTY.out);
}
/*
* Handling of permanent bailouts: Permanent bailouts that can happen for example due to
* unsupported unstructured control flow in the bytecodes of a method must not be
* retried. Hotspot compile broker will ensure that no recompilation at the given tier
* will happen if retry is false.
*/
final boolean permanentBailout = bailout.isPermanent();
! if (permanentBailout && PrintBailout.getValue()) {
TTY.println("Permanent bailout %s compiling method %s %s.", bailout.getMessage(), HotSpotGraalCompiler.str(method), (isOSR ? "OSR" : ""));
}
return HotSpotCompilationRequestResult.failure(bailout.getMessage(), !permanentBailout);
} catch (Throwable t) {
// Log a failure event.
--- 278,303 ----
return HotSpotCompilationRequestResult.success(result.getBytecodeSize() - method.getCodeSize());
}
return null;
} catch (BailoutException bailout) {
BAILOUTS.increment();
! if (ExitVMOnBailout.getValue(options)) {
TTY.out.println(method.format("Bailout in %H.%n(%p)"));
bailout.printStackTrace(TTY.out);
System.exit(-1);
! } else if (PrintBailout.getValue(options)) {
TTY.out.println(method.format("Bailout in %H.%n(%p)"));
bailout.printStackTrace(TTY.out);
}
/*
* Handling of permanent bailouts: Permanent bailouts that can happen for example due to
* unsupported unstructured control flow in the bytecodes of a method must not be
* retried. Hotspot compile broker will ensure that no recompilation at the given tier
* will happen if retry is false.
*/
final boolean permanentBailout = bailout.isPermanent();
! if (permanentBailout && PrintBailout.getValue(options)) {
TTY.println("Permanent bailout %s compiling method %s %s.", bailout.getMessage(), HotSpotGraalCompiler.str(method), (isOSR ? "OSR" : ""));
}
return HotSpotCompilationRequestResult.failure(bailout.getMessage(), !permanentBailout);
} catch (Throwable t) {
// Log a failure event.
*** 333,354 ****
protected void handleException(Throwable t) {
/*
* Automatically enable ExitVMOnException during bootstrap or when asserts are enabled but
* respect ExitVMOnException if it's been explicitly set.
*/
! boolean exitVMOnException = ExitVMOnException.getValue();
! if (!ExitVMOnException.hasBeenSet()) {
assert (exitVMOnException = true) == true;
if (!exitVMOnException) {
HotSpotGraalRuntimeProvider runtime = compiler.getGraalRuntime();
if (runtime.isBootstrapping()) {
exitVMOnException = true;
}
}
}
! if (PrintStackTraceOnException.getValue() || exitVMOnException) {
try {
t.printStackTrace(TTY.out);
} catch (Throwable throwable) {
// Don't let an exception here change the other control flow
}
--- 349,370 ----
protected void handleException(Throwable t) {
/*
* Automatically enable ExitVMOnException during bootstrap or when asserts are enabled but
* respect ExitVMOnException if it's been explicitly set.
*/
! boolean exitVMOnException = ExitVMOnException.getValue(options);
! if (!ExitVMOnException.hasBeenSet(options)) {
assert (exitVMOnException = true) == true;
if (!exitVMOnException) {
HotSpotGraalRuntimeProvider runtime = compiler.getGraalRuntime();
if (runtime.isBootstrapping()) {
exitVMOnException = true;
}
}
}
! if (PrintStackTraceOnException.getValue(options) || exitVMOnException) {
try {
t.printStackTrace(TTY.out);
} catch (Throwable throwable) {
// Don't let an exception here change the other control flow
}
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompilationTask.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File