# HG changeset patch # User Doug Simon # Date 1415360192 -3600 # Node ID bf586af6fa0c7fd572aac80828bee54d456bb947 # Parent ab47ef2f220731a62aa1b9c545928288f231017a# Parent 9734f97bddfe7d9308c3ea4025a7ca1972dbc93a Merge. diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java Fri Nov 07 12:36:32 2014 +0100 @@ -36,7 +36,7 @@ @ServiceProvider(HotSpotBackendFactory.class) public class HSAILHotSpotBackendFactory implements HotSpotBackendFactory { - protected HotSpotLoweringProvider createLowerer(HotSpotGraalRuntime runtime, HotSpotMetaAccessProvider metaAccess, HotSpotForeignCallsProvider foreignCalls, HotSpotRegistersProvider registers, + protected HotSpotLoweringProvider createLowerer(HotSpotGraalRuntime runtime, MetaAccessProvider metaAccess, HotSpotForeignCallsProvider foreignCalls, HotSpotRegistersProvider registers, TargetDescription target) { return new HSAILHotSpotLoweringProvider(runtime, metaAccess, foreignCalls, registers, target); } @@ -46,7 +46,7 @@ HotSpotProviders host = hostBackend.getProviders(); HotSpotRegisters registers = new HotSpotRegisters(HSAIL.threadRegister, Register.None, Register.None); - HotSpotMetaAccessProvider metaAccess = host.getMetaAccess(); + MetaAccessProvider metaAccess = host.getMetaAccess(); TargetDescription target = createTarget(); HSAILHotSpotCodeCacheProvider codeCache = new HSAILHotSpotCodeCacheProvider(runtime, target); ConstantReflectionProvider constantReflection = host.getConstantReflection(); diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Fri Nov 07 12:36:32 2014 +0100 @@ -39,7 +39,7 @@ public HotSpotBackend createBackend(HotSpotGraalRuntime runtime, HotSpotBackend hostBackend) { HotSpotProviders host = hostBackend.getProviders(); - HotSpotMetaAccessProvider metaAccess; + MetaAccessProvider metaAccess; PTXHotSpotCodeCacheProvider codeCache; ConstantReflectionProvider constantReflection; HotSpotForeignCallsProvider foreignCalls; diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Fri Nov 07 12:36:32 2014 +0100 @@ -287,7 +287,7 @@ } // Are we compiling this class? - HotSpotMetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess(); + MetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess(); if (classFileCounter >= startAt) { println("CompileTheWorld (%d) : %s", classFileCounter, className); diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant.java Fri Nov 07 12:36:32 2014 +0100 @@ -23,9 +23,10 @@ package com.oracle.graal.hotspot.meta; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding; -public interface HotSpotMetaspaceConstant extends HotSpotConstant, VMConstant, Remote { +public interface HotSpotMetaspaceConstant extends HotSpotConstant, VMConstant, Remote, StampProvider { boolean isCompressed(); @@ -34,6 +35,4 @@ Constant uncompress(CompressEncoding encoding); HotSpotResolvedObjectType asResolvedJavaType(); - - Kind getKind(); } diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl.java Fri Nov 07 12:36:32 2014 +0100 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding; public final class HotSpotMetaspaceConstantImpl extends PrimitiveConstant implements HotSpotMetaspaceConstant, VMConstant { @@ -63,6 +64,13 @@ return super.toString() + "{" + metaspaceObject + (compressed ? ";compressed}" : "}"); } + public Stamp stamp() { + if (compressed) { + return StampFactory.forInteger(32); + } + return StampFactory.forInteger(64); + } + public boolean isCompressed() { return compressed; } diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Fri Nov 07 12:36:32 2014 +0100 @@ -111,12 +111,14 @@ } public int getDeoptimizationCount(DeoptimizationReason reason) { - int reasonIndex = runtime().getHostProviders().getMetaAccess().convertDeoptReason(reason); + HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostProviders().getMetaAccess(); + int reasonIndex = metaAccess.convertDeoptReason(reason); return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } public int getOSRDeoptimizationCount(DeoptimizationReason reason) { - int reasonIndex = runtime().getHostProviders().getMetaAccess().convertDeoptReason(reason); + HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostProviders().getMetaAccess(); + int reasonIndex = metaAccess.convertDeoptReason(reason); return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; } diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java Fri Nov 07 12:36:32 2014 +0100 @@ -39,7 +39,7 @@ private final HotSpotRegistersProvider registers; private final SnippetReflectionProvider snippetReflection; - public HotSpotProviders(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls, + public HotSpotProviders(MetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, HotSpotDisassemblerProvider disassembler, SuitesProvider suites, HotSpotRegistersProvider registers, SnippetReflectionProvider snippetReflection) { super(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements); @@ -54,11 +54,6 @@ return (HotSpotCodeCacheProvider) super.getCodeCache(); } - @Override - public HotSpotMetaAccessProvider getMetaAccess() { - return (HotSpotMetaAccessProvider) super.getMetaAccess(); - } - public HotSpotDisassemblerProvider getDisassembler() { return disassembler; } diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Fri Nov 07 12:36:32 2014 +0100 @@ -79,7 +79,7 @@ } else if (c instanceof HotSpotObjectConstant) { return ((HotSpotObjectConstant) c).compress(); } else if (c instanceof HotSpotMetaspaceConstant) { - assert ((HotSpotMetaspaceConstant) c).getKind() == Kind.Long; + assert ((HotSpotMetaspaceConstant) c).stamp().getStackKind() == Kind.Long; return ((HotSpotMetaspaceConstant) c).compress(encoding); } else { throw GraalInternalError.shouldNotReachHere("invalid constant input for compress op: " + c); @@ -92,7 +92,7 @@ } else if (c instanceof HotSpotObjectConstant) { return ((HotSpotObjectConstant) c).uncompress(); } else if (c instanceof HotSpotMetaspaceConstant) { - assert ((HotSpotMetaspaceConstant) c).getKind() == Kind.Int; + assert ((HotSpotMetaspaceConstant) c).stamp().getStackKind() == Kind.Int; return ((HotSpotMetaspaceConstant) c).uncompress(encoding); } else { throw GraalInternalError.shouldNotReachHere("invalid constant input for uncompress op: " + c); diff -r 9734f97bddfe -r bf586af6fa0c graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Fri Nov 07 10:58:57 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Fri Nov 07 12:36:32 2014 +0100 @@ -343,7 +343,9 @@ private boolean createDispatchOnTypeBeforeInvoke(StructuredGraph graph, BeginNode[] successors, boolean invokeIsOnlySuccessor, MetaAccessProvider metaAccess) { assert ptypes.size() >= 1; ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); - Kind hubKind = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(ResolvedJavaType.Representation.ObjectHub).getKind(); + Constant hubConstant = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(ResolvedJavaType.Representation.ObjectHub); + Stamp hubStamp = ((StampProvider) hubConstant).stamp(); + Kind hubKind = hubStamp.getStackKind(); LoadHubNode hub = graph.unique(LoadHubNode.create(nonNullReceiver, hubKind)); if (!invokeIsOnlySuccessor && chooseMethodDispatch()) { diff -r 9734f97bddfe -r bf586af6fa0c src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Fri Nov 07 10:58:57 2014 +0100 +++ b/src/share/vm/compiler/compileBroker.cpp Fri Nov 07 12:36:32 2014 +0100 @@ -1212,6 +1212,13 @@ if (!GraalRuntime::is_HotSpotGraalRuntime_initialized() && compiler(comp_level)->is_graal()) { blocking = false; } + + // Don't allow blocking compilation requests if we are in GraalRuntime::shutdown + // to avoid deadlock between compiler thread(s) and threads run at shutdown + // such as the DestroyJavaVM thread. + if (GraalRuntime::shutdown_called()) { + blocking = false; + } } // Don't allow blocking compiles #endif diff -r 9734f97bddfe -r bf586af6fa0c src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Fri Nov 07 10:58:57 2014 +0100 +++ b/src/share/vm/graal/graalRuntime.cpp Fri Nov 07 12:36:32 2014 +0100 @@ -41,6 +41,7 @@ address GraalRuntime::_external_deopt_i2c_entry = NULL; jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; bool GraalRuntime::_HotSpotGraalRuntime_initialized = false; +bool GraalRuntime::_shutdown_called = false; void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); @@ -989,6 +990,7 @@ void GraalRuntime::shutdown() { if (_HotSpotGraalRuntime_instance != NULL) { + _shutdown_called = true; JavaThread* THREAD = JavaThread::current(); HandleMark hm(THREAD); TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT); diff -r 9734f97bddfe -r bf586af6fa0c src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Fri Nov 07 10:58:57 2014 +0100 +++ b/src/share/vm/graal/graalRuntime.hpp Fri Nov 07 12:36:32 2014 +0100 @@ -36,6 +36,8 @@ static address _external_deopt_i2c_entry; static const char* _generated_sources_sha1; + static bool _shutdown_called; + /** * Reads the OptionValue object from a specified static field. * @@ -141,6 +143,10 @@ static void shutdown(); + static bool shutdown_called() { + return _shutdown_called; + } + /** * Given an interface representing a Graal service (i.e. sub-interface of * com.oracle.graal.api.runtime.Service), gets an array of objects, one per