# HG changeset patch # User twisti # Date 1395102755 25200 # Node ID 6bab029d6e3a2e43921e73e7b5b743199cb6a8c0 # Parent e3888db8b8a166ddb008b63a3c523ac5e6579dd0 removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 17 17:32:35 2014 -0700 @@ -41,8 +41,8 @@ import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.hotspot.nfi.*; import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.lir.*; @@ -249,7 +249,7 @@ public void emitCodePrefix(ResolvedJavaMethod installedCodeOwner, CompilationResultBuilder crb, AMD64MacroAssembler asm, RegisterConfig regConfig, HotSpotVMConfig config, Label verifiedEntry) { HotSpotProviders providers = getProviders(); if (installedCodeOwner != null && !isStatic(installedCodeOwner.getModifiers())) { - crb.recordMark(Marks.MARK_UNVERIFIED_ENTRY); + MarkId.recordMark(crb, MarkId.UNVERIFIED_ENTRY); CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{providers.getMetaAccess().lookupJavaType(Object.class)}, getTarget(), false); Register inlineCacheKlass = rax; // see definition of IC_Klass in // c1_LIRAssembler_x86.cpp @@ -271,9 +271,9 @@ } asm.align(config.codeEntryAlignment); - crb.recordMark(Marks.MARK_OSR_ENTRY); + MarkId.recordMark(crb, MarkId.OSR_ENTRY); asm.bind(verifiedEntry); - crb.recordMark(Marks.MARK_VERIFIED_ENTRY); + MarkId.recordMark(crb, MarkId.VERIFIED_ENTRY); } /** @@ -293,9 +293,9 @@ HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext; if (!frameContext.isStub) { HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls(); - crb.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY); + MarkId.recordMark(crb, MarkId.EXCEPTION_HANDLER_ENTRY); AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null); - crb.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY); + MarkId.recordMark(crb, MarkId.DEOPT_HANDLER_ENTRY); AMD64Call.directCall(crb, asm, foreignCalls.lookupForeignCall(DEOPT_HANDLER), null, false, null); } else { // No need to emit the stubs for entries back into the method since diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -24,13 +24,13 @@ import static com.oracle.graal.amd64.AMD64.*; import static com.oracle.graal.asm.NumUtil.*; -import static com.oracle.graal.hotspot.bridge.Marks.*; import static com.oracle.graal.phases.GraalOptions.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.asm.*; @@ -82,21 +82,21 @@ // co-located with the immutable code. asm.movq(scratch, (AMD64Address) crb.recordDataReferenceInCode(pollingPageAddress, alignment)); final int pos = asm.position(); - crb.recordMark(atReturn ? MARK_POLL_RETURN_FAR : MARK_POLL_FAR); + MarkId.recordMark(crb, atReturn ? MarkId.POLL_RETURN_FAR : MarkId.POLL_FAR); if (state != null) { crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT); } asm.testl(rax, new AMD64Address(scratch)); } else if (isPollingPageFar(config)) { asm.movq(scratch, config.safepointPollingAddress); - crb.recordMark(atReturn ? MARK_POLL_RETURN_FAR : MARK_POLL_FAR); + MarkId.recordMark(crb, atReturn ? MarkId.POLL_RETURN_FAR : MarkId.POLL_FAR); final int pos = asm.position(); if (state != null) { crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT); } asm.testl(rax, new AMD64Address(scratch)); } else { - crb.recordMark(atReturn ? MARK_POLL_RETURN_NEAR : MARK_POLL_NEAR); + MarkId.recordMark(crb, atReturn ? MarkId.POLL_RETURN_NEAR : MarkId.POLL_NEAR); final int pos = asm.position(); if (state != null) { crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -26,7 +26,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp; @@ -55,7 +55,7 @@ // The mark for an invocation that uses an inline cache must be placed at the // instruction that loads the Klass from the inline cache. AMD64Move.move(crb, masm, AMD64.rbx.asValue(Kind.Long), metaspaceMethod); - crb.recordMark(invokeKind == InvokeKind.Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL); + MarkId.recordMark(crb, invokeKind == InvokeKind.Static ? MarkId.INVOKESTATIC : MarkId.INVOKESPECIAL); // This must be emitted exactly like this to ensure it's patchable masm.movq(AMD64.rax, HotSpotGraalRuntime.runtime().getConfig().nonOopBits); super.emitCode(crb, masm); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -28,7 +28,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp; import com.oracle.graal.lir.asm.*; @@ -53,7 +53,7 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { // The mark for an invocation that uses an inline cache must be placed at the // instruction that loads the Klass from the inline cache. - crb.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE); + MarkId.recordMark(crb, invokeKind == Virtual ? MarkId.INVOKEVIRTUAL : MarkId.INVOKEINTERFACE); // This must be emitted exactly like this to ensure it's patchable masm.movq(AMD64.rax, HotSpotGraalRuntime.runtime().getConfig().nonOopBits); super.emitCode(crb, masm); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -29,7 +29,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.amd64.AMD64Call.IndirectCallOp; @@ -58,7 +58,7 @@ @Override public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { - crb.recordMark(Marks.MARK_INLINE_INVOKE); + MarkId.recordMark(crb, MarkId.INLINE_INVOKE); Register callReg = asRegister(targetAddress); assert !callReg.equals(METHOD); AMD64Call.indirectCall(crb, masm, callReg, callTarget, state); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Mar 17 17:32:35 2014 -0700 @@ -34,8 +34,8 @@ import com.oracle.graal.compiler.gen.LIRGenerator; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.hotspot.stubs.Stub; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.*; @@ -189,7 +189,7 @@ // Emit the prefix if (unverifiedStub != null) { - crb.recordMark(Marks.MARK_UNVERIFIED_ENTRY); + MarkId.recordMark(crb, MarkId.UNVERIFIED_ENTRY); // We need to use JavaCall here because we haven't entered the frame yet. CallingConvention cc = regConfig.getCallingConvention(JavaCall, null, new JavaType[]{getProviders().getMetaAccess().lookupJavaType(Object.class)}, getTarget(), false); Register inlineCacheKlass = g5; // see MacroAssembler::ic_call @@ -204,8 +204,8 @@ } masm.align(config.codeEntryAlignment); - crb.recordMark(Marks.MARK_OSR_ENTRY); - crb.recordMark(Marks.MARK_VERIFIED_ENTRY); + MarkId.recordMark(crb, MarkId.OSR_ENTRY); + MarkId.recordMark(crb, MarkId.VERIFIED_ENTRY); // Emit code for the LIR crb.emit(lir); @@ -213,9 +213,9 @@ HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext; HotSpotForeignCallsProvider foreignCalls = getProviders().getForeignCalls(); if (!frameContext.isStub) { - crb.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY); + MarkId.recordMark(crb, MarkId.EXCEPTION_HANDLER_ENTRY); SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null); - crb.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY); + MarkId.recordMark(crb, MarkId.DEOPT_HANDLER_ENTRY); SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(DEOPT_HANDLER), null, false, null); } else { // No need to emit the stubs for entries back into the method since diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -23,13 +23,13 @@ package com.oracle.graal.hotspot.sparc; import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; -import static com.oracle.graal.hotspot.bridge.Marks.*; import static com.oracle.graal.sparc.SPARC.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.sparc.*; import com.oracle.graal.lir.asm.*; @@ -61,7 +61,7 @@ public static void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm, HotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register scratch) { final int pos = masm.position(); new Setx(config.safepointPollingAddress, scratch).emit(masm); - crb.recordMark(atReturn ? MARK_POLL_RETURN_FAR : MARK_POLL_FAR); + MarkId.recordMark(crb, atReturn ? MarkId.POLL_RETURN_FAR : MarkId.POLL_FAR); if (state != null) { crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT); } diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -28,7 +28,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.sparc.SPARCCall.DirectCallOp; @@ -42,7 +42,6 @@ @Opcode("CALL_DIRECT") final class SPARCHotspotDirectStaticCallOp extends DirectCallOp { - private static final long nonOopBits = HotSpotGraalRuntime.runtime().getConfig().nonOopBits; private final Constant metaspaceMethod; private final InvokeKind invokeKind; @@ -58,9 +57,9 @@ // The mark for an invocation that uses an inline cache must be placed at the // instruction that loads the Klass from the inline cache. SPARCMove.move(crb, masm, g5.asValue(Kind.Long), metaspaceMethod); - crb.recordMark(invokeKind == InvokeKind.Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL); + MarkId.recordMark(crb, invokeKind == InvokeKind.Static ? MarkId.INVOKESTATIC : MarkId.INVOKESPECIAL); // SPARCMove.move(crb, masm, g3.asValue(Kind.Long), Constant.LONG_0); - new Setx(nonOopBits, g3, true).emit(masm); + new Setx(HotSpotGraalRuntime.runtime().getConfig().nonOopBits, g3, true).emit(masm); super.emitCode(crb, masm); } } diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -29,7 +29,7 @@ import com.oracle.graal.asm.sparc.*; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.sparc.SPARCCall.DirectCallOp; import com.oracle.graal.lir.asm.*; @@ -54,7 +54,7 @@ public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { // The mark for an invocation that uses an inline cache must be placed at the // instruction that loads the Klass from the inline cache. - crb.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE); + MarkId.recordMark(crb, invokeKind == Virtual ? MarkId.INVOKEVIRTUAL : MarkId.INVOKEINTERFACE); new Setx(HotSpotGraalRuntime.runtime().getConfig().nonOopBits, g3, true).emit(masm); super.emitCode(crb, masm); } diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java Mon Mar 17 17:32:35 2014 -0700 @@ -29,7 +29,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; -import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.sparc.*; import com.oracle.graal.lir.sparc.SPARCCall.IndirectCallOp; @@ -58,7 +58,7 @@ @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { - crb.recordMark(Marks.MARK_INLINE_INVOKE); + MarkId.recordMark(crb, MarkId.INLINE_INVOKE); Register callReg = asRegister(targetAddress); assert !callReg.equals(METHOD); SPARCCall.indirectCall(crb, masm, callReg, callTarget, state); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Mon Mar 17 17:32:35 2014 -0700 @@ -27,7 +27,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.target.*; -import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.lir.*; @@ -51,7 +50,8 @@ /** * Descriptor for {@link ExceptionHandlerStub}. This stub is called by the - * {@linkplain Marks#MARK_EXCEPTION_HANDLER_ENTRY exception handler} in a compiled method. + * {@linkplain HotSpotVMConfig#codeInstallerMarkIdExceptionHandlerEntry exception handler} in a + * compiled method. */ public static final ForeignCallDescriptor EXCEPTION_HANDLER = new ForeignCallDescriptor("exceptionHandler", void.class, Object.class, Word.class); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Mar 17 17:32:35 2014 -0700 @@ -1422,6 +1422,22 @@ @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag; @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag; + @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int codeInstallerMarkIdVerifiedEntry; + @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int codeInstallerMarkIdUnverifiedEntry; + @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int codeInstallerMarkIdOsrEntry; + @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int codeInstallerMarkIdExceptionHandlerEntry; + @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int codeInstallerMarkIdDeoptHandlerEntry; + @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int codeInstallerMarkIdInvokeinterface; + @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int codeInstallerMarkIdInvokevirtual; + @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int codeInstallerMarkIdInvokestatic; + @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int codeInstallerMarkIdInvokespecial; + @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int codeInstallerMarkIdInlineInvoke; + @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int codeInstallerMarkIdPollNear; + @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int codeInstallerMarkIdPollReturnNear; + @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int codeInstallerMarkIdPollFar; + @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int codeInstallerMarkIdPollReturnFar; + @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int codeInstallerMarkIdInvokeInvalid; + public boolean check() { for (Field f : getClass().getDeclaredFields()) { int modifiers = f.getModifiers(); diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java Mon Mar 17 23:46:20 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.bridge; - -/** - * Constants used to mark special positions in code being installed into the code cache by Graal C++ - * code. These constants need to be kept in sync with those of the same name defined in - * graalCodeInstaller.hpp. - */ -public interface Marks { - - int MARK_VERIFIED_ENTRY = 1; - int MARK_UNVERIFIED_ENTRY = 2; - int MARK_OSR_ENTRY = 3; - int MARK_EXCEPTION_HANDLER_ENTRY = 4; - int MARK_DEOPT_HANDLER_ENTRY = 5; - int MARK_INVOKEINTERFACE = 6; - int MARK_INVOKEVIRTUAL = 7; - int MARK_INVOKESTATIC = 8; - int MARK_INVOKESPECIAL = 9; - int MARK_INLINE_INVOKE = 10; - int MARK_POLL_NEAR = 11; - int MARK_POLL_RETURN_NEAR = 12; - int MARK_POLL_FAR = 13; - int MARK_POLL_RETURN_FAR = 14; -} diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Mon Mar 17 17:32:35 2014 -0700 @@ -36,11 +36,13 @@ import com.oracle.graal.api.code.CompilationResult.PrimitiveData; import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; +import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult; import com.oracle.graal.hotspot.data.*; import com.oracle.graal.java.*; +import com.oracle.graal.lir.asm.*; import com.oracle.graal.printer.*; /** @@ -60,6 +62,54 @@ protected abstract RegisterConfig createRegisterConfig(); + /** + * Constants used to mark special positions in code being installed into the code cache by Graal + * C++ code. + */ + public enum MarkId { + VERIFIED_ENTRY(config().codeInstallerMarkIdVerifiedEntry), + UNVERIFIED_ENTRY(config().codeInstallerMarkIdUnverifiedEntry), + OSR_ENTRY(config().codeInstallerMarkIdOsrEntry), + EXCEPTION_HANDLER_ENTRY(config().codeInstallerMarkIdExceptionHandlerEntry), + DEOPT_HANDLER_ENTRY(config().codeInstallerMarkIdDeoptHandlerEntry), + INVOKEINTERFACE(config().codeInstallerMarkIdInvokeinterface), + INVOKEVIRTUAL(config().codeInstallerMarkIdInvokevirtual), + INVOKESTATIC(config().codeInstallerMarkIdInvokestatic), + INVOKESPECIAL(config().codeInstallerMarkIdInvokespecial), + INLINE_INVOKE(config().codeInstallerMarkIdInlineInvoke), + POLL_NEAR(config().codeInstallerMarkIdPollNear), + POLL_RETURN_NEAR(config().codeInstallerMarkIdPollReturnNear), + POLL_FAR(config().codeInstallerMarkIdPollFar), + POLL_RETURN_FAR(config().codeInstallerMarkIdPollReturnFar); + + private final int value; + + private MarkId(int value) { + this.value = value; + } + + private static HotSpotVMConfig config() { + return HotSpotGraalRuntime.runtime().getConfig(); + } + + public static MarkId getEnum(int value) { + for (MarkId e : values()) { + if (e.value == value) { + return e; + } + } + throw GraalInternalError.shouldNotReachHere("unknown enum value " + value); + } + + /** + * Helper method to {@link CompilationResultBuilder#recordMark(Object) record a mark} with a + * {@link CompilationResultBuilder}. + */ + public static void recordMark(CompilationResultBuilder crb, MarkId mark) { + crb.recordMark(mark.value); + } + } + @Override public String disassemble(CompilationResult compResult, InstalledCode installedCode) { byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode(); @@ -88,7 +138,7 @@ hcf.addOperandComment(site.pcOffset, "{" + site.data.toString() + "}"); } for (Mark mark : compResult.getMarks()) { - hcf.addComment(mark.pcOffset, getMarkName(mark)); + hcf.addComment(mark.pcOffset, MarkId.getEnum((int) mark.id).toString()); } } return hcf.toEmbeddedString(); @@ -114,25 +164,6 @@ return String.valueOf(call.target); } - /** - * Decodes a mark to a mnemonic if possible. - */ - private static String getMarkName(Mark mark) { - Field[] fields = Marks.class.getDeclaredFields(); - for (Field f : fields) { - if (Modifier.isStatic(f.getModifiers()) && f.getName().startsWith("MARK_")) { - f.setAccessible(true); - try { - if (f.get(null).equals(mark.id)) { - return f.getName(); - } - } catch (Exception e) { - } - } - } - return "MARK:" + mark.id; - } - private static void addExceptionHandlersComment(CompilationResult compResult, HexCodeFile hcf) { if (!compResult.getExceptionHandlers().isEmpty()) { String nl = HexCodeFile.NEW_LINE; diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Mon Mar 17 17:32:35 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,16 +31,16 @@ import com.oracle.graal.graph.Node.ConstantNodeParameter; import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.Snippet.*; import com.oracle.graal.word.*; /** - * Stub called by the {@linkplain Marks#MARK_EXCEPTION_HANDLER_ENTRY exception handler entry point} - * in a compiled method. This entry point is used when returning to a method to handle an exception + * Stub called by the {@linkplain MarkId#EXCEPTION_HANDLER_ENTRY exception handler entry point} in a + * compiled method. This entry point is used when returning to a method to handle an exception * thrown by a callee. It is not used for routing implicit exceptions. Therefore, it does not need * to save any registers as HotSpot uses a caller save convention. *

diff -r e3888db8b8a1 -r 6bab029d6e3a graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java Mon Mar 17 23:46:20 2014 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java Mon Mar 17 17:32:35 2014 -0700 @@ -29,8 +29,8 @@ import com.oracle.graal.asm.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.truffle.*; @@ -51,10 +51,9 @@ @Override public Mark recordMark(Object id) { Mark mark = super.recordMark(id); - if (Integer.valueOf(Marks.MARK_VERIFIED_ENTRY).equals(id)) { - HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig(); + if (MarkId.getEnum((int) id) == MarkId.VERIFIED_ENTRY) { HotSpotRegistersProvider registers = HotSpotGraalRuntime.runtime().getHostProviders().getRegisters(); - injectTailCallCode(config, registers); + injectTailCallCode(HotSpotGraalRuntime.runtime().getConfig(), registers); } return mark; } diff -r e3888db8b8a1 -r 6bab029d6e3a src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp --- a/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp Mon Mar 17 23:46:20 2014 +0100 +++ b/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp Mon Mar 17 17:32:35 2014 -0700 @@ -98,24 +98,24 @@ } #endif switch (_next_call_type) { - case MARK_INLINE_INVOKE: + case INLINE_INVOKE: break; - case MARK_INVOKEVIRTUAL: - case MARK_INVOKEINTERFACE: { + case INVOKEVIRTUAL: + case INVOKEINTERFACE: { assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc)); break; } - case MARK_INVOKESTATIC: { + case INVOKESTATIC: { assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); call->set_destination(SharedRuntime::get_resolve_static_call_stub()); _instructions->relocate(call->instruction_address(), relocInfo::static_call_type); break; } - case MARK_INVOKESPECIAL: { + case INVOKESPECIAL: { assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub()); @@ -130,16 +130,16 @@ inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) { switch (mark) { - case MARK_POLL_NEAR: { + case POLL_NEAR: { fatal("unimplemented"); } - case MARK_POLL_FAR: + case POLL_FAR: _instructions->relocate(pc, relocInfo::poll_type); break; - case MARK_POLL_RETURN_NEAR: { + case POLL_RETURN_NEAR: { fatal("unimplemented"); } - case MARK_POLL_RETURN_FAR: + case POLL_RETURN_FAR: _instructions->relocate(pc, relocInfo::poll_return_type); break; default: diff -r e3888db8b8a1 -r 6bab029d6e3a src/cpu/x86/vm/graalCodeInstaller_x86.hpp --- a/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Mon Mar 17 23:46:20 2014 +0100 +++ b/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Mon Mar 17 17:32:35 2014 -0700 @@ -151,10 +151,10 @@ } #endif switch (_next_call_type) { - case MARK_INLINE_INVOKE: + case INLINE_INVOKE: break; - case MARK_INVOKEVIRTUAL: - case MARK_INVOKEINTERFACE: { + case INVOKEVIRTUAL: + case INVOKEINTERFACE: { assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); @@ -164,7 +164,7 @@ Assembler::call32_operand); break; } - case MARK_INVOKESTATIC: { + case INVOKESTATIC: { assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); @@ -173,7 +173,7 @@ relocInfo::static_call_type, Assembler::call32_operand); break; } - case MARK_INVOKESPECIAL: { + case INVOKESPECIAL: { assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub()); @@ -197,24 +197,24 @@ inline void CodeInstaller::pd_relocate_poll(address pc, jint mark) { switch (mark) { - case MARK_POLL_NEAR: { + case POLL_NEAR: { relocate_poll_near(pc); _instructions->relocate(pc, relocInfo::poll_type, Assembler::disp32_operand); break; } - case MARK_POLL_FAR: + case POLL_FAR: // This is a load from a register so there is no relocatable operand. // We just have to ensure that the format is not disp32_operand // so that poll_Relocation::fix_relocation_after_move does the right // thing (i.e. ignores this relocation record) _instructions->relocate(pc, relocInfo::poll_type, Assembler::imm_operand); break; - case MARK_POLL_RETURN_NEAR: { + case POLL_RETURN_NEAR: { relocate_poll_near(pc); _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::disp32_operand); break; } - case MARK_POLL_RETURN_FAR: + case POLL_RETURN_FAR: // see comment above for MARK_POLL_FAR _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::imm_operand); break; diff -r e3888db8b8a1 -r 6bab029d6e3a src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Mon Mar 17 23:46:20 2014 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Mon Mar 17 17:32:35 2014 -0700 @@ -469,7 +469,7 @@ _comments = (arrayOop) HotSpotCompiledCode::comments(compiled_code); #endif - _next_call_type = MARK_INVOKE_INVALID; + _next_call_type = INVOKE_INVALID; } // perform data and call relocation on the CodeBuffer @@ -776,7 +776,7 @@ CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset); } - _next_call_type = MARK_INVOKE_INVALID; + _next_call_type = INVOKE_INVALID; if (debug_info != NULL) { _debug_recorder->end_safepoint(next_pc_offset); @@ -806,33 +806,33 @@ address pc = _instructions->start() + pc_offset; switch (id) { - case MARK_UNVERIFIED_ENTRY: + case UNVERIFIED_ENTRY: _offsets.set_value(CodeOffsets::Entry, pc_offset); break; - case MARK_VERIFIED_ENTRY: + case VERIFIED_ENTRY: _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset); break; - case MARK_OSR_ENTRY: + case OSR_ENTRY: _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset); break; - case MARK_EXCEPTION_HANDLER_ENTRY: + case EXCEPTION_HANDLER_ENTRY: _offsets.set_value(CodeOffsets::Exceptions, pc_offset); break; - case MARK_DEOPT_HANDLER_ENTRY: + case DEOPT_HANDLER_ENTRY: _offsets.set_value(CodeOffsets::Deopt, pc_offset); break; - case MARK_INVOKEVIRTUAL: - case MARK_INVOKEINTERFACE: - case MARK_INLINE_INVOKE: - case MARK_INVOKESTATIC: - case MARK_INVOKESPECIAL: + case INVOKEVIRTUAL: + case INVOKEINTERFACE: + case INLINE_INVOKE: + case INVOKESTATIC: + case INVOKESPECIAL: _next_call_type = (MarkId) id; _invoke_mark_pc = pc; break; - case MARK_POLL_NEAR: - case MARK_POLL_FAR: - case MARK_POLL_RETURN_NEAR: - case MARK_POLL_RETURN_FAR: + case POLL_NEAR: + case POLL_FAR: + case POLL_RETURN_NEAR: + case POLL_RETURN_FAR: pd_relocate_poll(pc, id); break; default: diff -r e3888db8b8a1 -r 6bab029d6e3a src/share/vm/graal/graalCodeInstaller.hpp --- a/src/share/vm/graal/graalCodeInstaller.hpp Mon Mar 17 23:46:20 2014 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Mon Mar 17 17:32:35 2014 -0700 @@ -24,28 +24,30 @@ #ifndef SHARE_VM_GRAAL_GRAAL_CODE_INSTALLER_HPP #define SHARE_VM_GRAAL_GRAAL_CODE_INSTALLER_HPP +#include "graal/graalEnv.hpp" + /* * This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod. */ class CodeInstaller { + friend class VMStructs; private: - // these need to correspond to Marks.java enum MarkId { - MARK_VERIFIED_ENTRY = 1, - MARK_UNVERIFIED_ENTRY = 2, - MARK_OSR_ENTRY = 3, - MARK_EXCEPTION_HANDLER_ENTRY = 4, - MARK_DEOPT_HANDLER_ENTRY = 5, - MARK_INVOKEINTERFACE = 6, - MARK_INVOKEVIRTUAL = 7, - MARK_INVOKESTATIC = 8, - MARK_INVOKESPECIAL = 9, - MARK_INLINE_INVOKE = 10, - MARK_POLL_NEAR = 11, - MARK_POLL_RETURN_NEAR = 12, - MARK_POLL_FAR = 13, - MARK_POLL_RETURN_FAR = 14, - MARK_INVOKE_INVALID = -1 + VERIFIED_ENTRY = 1, + UNVERIFIED_ENTRY = 2, + OSR_ENTRY = 3, + EXCEPTION_HANDLER_ENTRY = 4, + DEOPT_HANDLER_ENTRY = 5, + INVOKEINTERFACE = 6, + INVOKEVIRTUAL = 7, + INVOKESTATIC = 8, + INVOKESPECIAL = 9, + INLINE_INVOKE = 10, + POLL_NEAR = 11, + POLL_RETURN_NEAR = 12, + POLL_FAR = 13, + POLL_RETURN_FAR = 14, + INVOKE_INVALID = -1 }; Arena _arena; diff -r e3888db8b8a1 -r 6bab029d6e3a src/share/vm/graal/vmStructs_graal.hpp --- a/src/share/vm/graal/vmStructs_graal.hpp Mon Mar 17 23:46:20 2014 +0100 +++ b/src/share/vm/graal/vmStructs_graal.hpp Mon Mar 17 17:32:35 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define SHARE_VM_GRAAL_VMSTRUCTS_GRAAL_HPP #include "compiler/abstractCompiler.hpp" +#include "graal/graalCodeInstaller.hpp" #include "graal/graalCompilerToVM.hpp" #include "graal/graalEnv.hpp" @@ -48,5 +49,21 @@ \ declare_constant(CompilerToVM::KLASS_TAG) \ declare_constant(CompilerToVM::SYMBOL_TAG) \ + \ + declare_constant(CodeInstaller::VERIFIED_ENTRY) \ + declare_constant(CodeInstaller::UNVERIFIED_ENTRY) \ + declare_constant(CodeInstaller::OSR_ENTRY) \ + declare_constant(CodeInstaller::EXCEPTION_HANDLER_ENTRY) \ + declare_constant(CodeInstaller::DEOPT_HANDLER_ENTRY) \ + declare_constant(CodeInstaller::INVOKEINTERFACE) \ + declare_constant(CodeInstaller::INVOKEVIRTUAL) \ + declare_constant(CodeInstaller::INVOKESTATIC) \ + declare_constant(CodeInstaller::INVOKESPECIAL) \ + declare_constant(CodeInstaller::INLINE_INVOKE) \ + declare_constant(CodeInstaller::POLL_NEAR) \ + declare_constant(CodeInstaller::POLL_RETURN_NEAR) \ + declare_constant(CodeInstaller::POLL_FAR) \ + declare_constant(CodeInstaller::POLL_RETURN_FAR) \ + declare_constant(CodeInstaller::INVOKE_INVALID) \ #endif // SHARE_VM_GRAAL_VMSTRUCTS_GRAAL_HPP