< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java

Print this page

        

*** 20,30 **** * or visit www.oracle.com if you need additional information or have any * questions. */ package jdk.vm.ci.hotspot; ! import static jdk.vm.ci.inittimer.InitTimer.timer; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.lang.reflect.Array; --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package jdk.vm.ci.hotspot; ! import static jdk.vm.ci.common.InitTimer.timer; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.lang.reflect.Array;
*** 35,65 **** import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.TreeMap; 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 /** * HotSpot implementation of a JVMCI runtime. * * The initialization of this class is very fragile since it's initialized both through --- 35,61 ---- import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.TreeMap; + import jdk.internal.misc.VM; 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.InitTimer; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory; import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; 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; /** * HotSpot implementation of a JVMCI runtime. * * The initialization of this class is very fragile since it's initialized both through
*** 67,77 **** * {@link HotSpotJVMCIRuntime#runtime()} is also called by {@link JVMCI#initialize()}. So this class * can't have a static initializer and any required initialization must be done as part of * {@link #runtime()}. This allows the initialization to funnel back through * {@link JVMCI#initialize()} without deadlocking. */ ! public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, HotSpotProxified { @SuppressWarnings("try") static class DelayedInit { private static final HotSpotJVMCIRuntime instance; --- 63,73 ---- * {@link HotSpotJVMCIRuntime#runtime()} is also called by {@link JVMCI#initialize()}. So this class * can't have a static initializer and any required initialization must be done as part of * {@link #runtime()}. This allows the initialization to funnel back through * {@link JVMCI#initialize()} without deadlocking. */ ! public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider { @SuppressWarnings("try") static class DelayedInit { private static final HotSpotJVMCIRuntime instance;
*** 205,215 **** 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. */ --- 201,211 ---- private final JVMCIBackend hostBackend; private final JVMCICompilerFactory compilerFactory; private final HotSpotJVMCICompilerFactory hsCompilerFactory; private volatile JVMCICompiler compiler; ! protected final HotSpotJVMCIMetaAccessContext metaAccessContext; /** * Stores the result of {@link HotSpotJVMCICompilerFactory#getCompilationLevelAdjustment} so * that it can be read from the VM. */
*** 244,264 **** hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); } vmEventListeners = Services.load(HotSpotVMEventListener.class); ! JVMCIMetaAccessContext context = null; ! for (HotSpotVMEventListener vmEventListener : vmEventListeners) { ! context = vmEventListener.createMetaAccessContext(this); ! if (context != null) { ! break; ! } ! } ! if (context == null) { ! context = new HotSpotJVMCIMetaAccessContext(); ! } ! metaAccessContext = context; boolean printFlags = Option.PrintFlags.getBoolean(); boolean showFlags = Option.ShowFlags.getBoolean(); if (printFlags || showFlags) { Option.printFlags(System.out); --- 240,250 ---- hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); } vmEventListeners = Services.load(HotSpotVMEventListener.class); ! metaAccessContext = new HotSpotJVMCIMetaAccessContext(); boolean printFlags = Option.PrintFlags.getBoolean(); boolean showFlags = Option.ShowFlags.getBoolean(); if (printFlags || showFlags) { Option.printFlags(System.out);
*** 300,313 **** public CompilerToVM getCompilerToVM() { return compilerToVm; } - public JVMCIMetaAccessContext getMetaAccessContext() { - return metaAccessContext; - } - public JVMCICompiler getCompiler() { if (compiler == null) { synchronized (this) { if (compiler == null) { compiler = compilerFactory.createCompiler(this); --- 286,295 ----
*** 359,372 **** /** * 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; } /** * Shuts down the runtime. * --- 341,368 ---- /** * Called from the VM. */ @SuppressWarnings({"unused"}) ! private HotSpotCompilationRequestResult 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"; ! HotSpotCompilationRequestResult hsResult; ! if (result instanceof HotSpotCompilationRequestResult) { ! hsResult = (HotSpotCompilationRequestResult) result; ! } else { ! Object failure = result.getFailure(); ! if (failure != null) { ! boolean retry = false; // Be conservative with unknown compiler ! hsResult = HotSpotCompilationRequestResult.failure(failure.toString(), retry); ! } else { ! int inlinedBytecodes = -1; ! hsResult = HotSpotCompilationRequestResult.success(inlinedBytecodes); ! } ! } ! ! return hsResult; } /** * Shuts down the runtime. *
< prev index next >