< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
Print this page
@@ -40,20 +40,22 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CompilationRequestResult;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory;
import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
import jdk.vm.ci.inittimer.InitTimer;
import jdk.vm.ci.inittimer.SuppressFBWarnings;
import jdk.vm.ci.meta.JVMCIMetaAccessContext;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.vm.ci.runtime.JVMCI;
import jdk.vm.ci.runtime.JVMCIBackend;
import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
import jdk.vm.ci.services.Services;
import jdk.internal.misc.VM;
//JaCoCo Exclude
@@ -202,17 +204,29 @@
protected final CompilerToVM compilerToVm;
protected final HotSpotVMConfig config;
private final JVMCIBackend hostBackend;
+ private final JVMCICompilerFactory compilerFactory;
+ private final HotSpotJVMCICompilerFactory hsCompilerFactory;
private volatile JVMCICompiler compiler;
protected final JVMCIMetaAccessContext metaAccessContext;
+ /**
+ * Stores the result of {@link HotSpotJVMCICompilerFactory#getCompilationLevelAdjustment} so
+ * that it can be read from the VM.
+ */
+ @SuppressWarnings("unused") private final int compilationLevelAdjustment;
+
private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
private final Iterable<HotSpotVMEventListener> vmEventListeners;
+ /**
+ * Stores the result of {@link HotSpotJVMCICompilerFactory#getTrivialPrefixes()} so that it can
+ * be read from the VM.
+ */
@SuppressWarnings("unused") private final String[] trivialPrefixes;
@SuppressWarnings("try")
private HotSpotJVMCIRuntime() {
compilerToVm = new CompilerToVM();
@@ -257,11 +271,20 @@
if (Option.PrintConfig.getBoolean()) {
printConfig(config, compilerToVm);
}
- trivialPrefixes = HotSpotJVMCICompilerConfig.getCompilerFactory().getTrivialPrefixes();
+ compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory();
+ if (compilerFactory instanceof HotSpotJVMCICompilerFactory) {
+ hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory;
+ trivialPrefixes = hsCompilerFactory.getTrivialPrefixes();
+ compilationLevelAdjustment = hsCompilerFactory.getCompilationLevelAdjustment(config);
+ } else {
+ hsCompilerFactory = null;
+ trivialPrefixes = null;
+ compilationLevelAdjustment = 0;
+ }
}
private JVMCIBackend registerBackend(JVMCIBackend backend) {
Class<? extends Architecture> arch = backend.getCodeCache().getTarget().arch.getClass();
JVMCIBackend oldValue = backends.put(arch, backend);
@@ -287,11 +310,11 @@
public JVMCICompiler getCompiler() {
if (compiler == null) {
synchronized (this) {
if (compiler == null) {
- compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this);
+ compiler = compilerFactory.createCompiler(this);
}
}
}
return compiler;
}
@@ -330,10 +353,18 @@
/**
* Called from the VM.
*/
@SuppressWarnings({"unused"})
+ private int adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, int level) {
+ return hsCompilerFactory.adjustCompilationLevel(config, declaringClass, name, signature, isOsr, level);
+ }
+
+ /**
+ * Called from the VM.
+ */
+ @SuppressWarnings({"unused"})
private CompilationRequestResult compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
CompilationRequestResult result = getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id));
assert result != null : "compileMethod must always return something";
return result;
}
< prev index next >