# HG changeset patch # User Thomas Wuerthinger # Date 1395225837 -3600 # Node ID 1617b1e25d3118dcfcc40225bd9fb1a5c629de91 # Parent 54fa8e06831c0a92e2edf1691090a26ea7b73933# Parent aef9e422407699c4a1521935f16184d86cc13519 Merge. diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ObjectLocationIdentity.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ObjectLocationIdentity.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ObjectLocationIdentity.java Wed Mar 19 11:43:57 2014 +0100 @@ -25,7 +25,7 @@ import java.util.*; /** - * A {@link LocationIdentity} warpping an object. + * A {@link LocationIdentity} wrapping an object. */ public final class ObjectLocationIdentity implements LocationIdentity { diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed Mar 19 11:43:57 2014 +0100 @@ -360,9 +360,9 @@ } @Override - public void emitNullCheck(ValueNode v, DeoptimizingNode deoping) { - assert v.stamp() instanceof ObjectStamp; - append(new AMD64Move.NullCheckOp(load(operand(v)), state(deoping))); + public void emitNullCheck(ValueNode v, DeoptimizingNode deopt) { + assert v.kind() == Kind.Object : v + " - " + v.stamp() + " @ " + deopt; + append(new AMD64Move.NullCheckOp(load(operand(v)), state(deopt))); } @Override diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Mar 19 11:43:57 2014 +0100 @@ -200,7 +200,7 @@ SchedulePhase schedule = new SchedulePhase(); schedule.apply(graph); - Debug.dump(schedule, "final schedule"); + Debug.dump(schedule, "Final HIR schedule"); return schedule; } diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Wed Mar 19 11:43:57 2014 +0100 @@ -167,7 +167,7 @@ * @return the scope entered by this method which will be exited when its {@link Scope#close()} * method is called */ - public static Scope scope(String name, Object... context) { + public static Scope scope(CharSequence name, Object... context) { if (ENABLED) { return DebugScope.getInstance().scope(name, null, context); } else { @@ -195,7 +195,7 @@ * @return the scope entered by this method which will be exited when its {@link Scope#close()} * method is called */ - public static Scope sandbox(String name, DebugConfig config, Object... context) { + public static Scope sandbox(CharSequence name, DebugConfig config, Object... context) { if (ENABLED) { DebugConfig sandboxConfig = config == null ? silentConfig() : config; return DebugScope.getInstance().scope(name, sandboxConfig, context); @@ -379,11 +379,11 @@ *

* A disabled metric has virtually no overhead. */ - public static DebugMetric metric(String name) { - if (Boolean.getBoolean(ENABLE_METRIC_PROPERTY_NAME_PREFIX + name)) { - return new MetricImpl(name, false); + public static DebugMetric metric(CharSequence name) { + if (enabledMetrics != null && enabledMetrics.contains(name.toString())) { + return new MetricImpl(name.toString(), false); } else if (ENABLED) { - return new MetricImpl(name, true); + return new MetricImpl(name.toString(), true); } else { return VOID_METRIC; } @@ -495,15 +495,33 @@ }; /** - * @see #timer(String) + * @see #timer(CharSequence) */ public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "graal.debug.timer."; /** - * @see #metric(String) + * @see #metric(CharSequence) */ public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "graal.debug.metric."; + private static final Set enabledMetrics; + private static final Set enabledTimers; + static { + Set metrics = new HashSet<>(); + Set timers = new HashSet<>(); + for (Map.Entry e : System.getProperties().entrySet()) { + String name = e.getKey().toString(); + if (name.startsWith(ENABLE_METRIC_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) { + metrics.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length())); + } + if (name.startsWith(ENABLE_TIMER_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) { + timers.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length())); + } + } + enabledMetrics = metrics.isEmpty() ? null : metrics; + enabledTimers = timers.isEmpty() ? null : timers; + } + /** * Creates a {@linkplain DebugTimer timer} that is enabled iff debugging is * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to @@ -514,11 +532,11 @@ *

* A disabled timer has virtually no overhead. */ - public static DebugTimer timer(String name) { - if (Boolean.getBoolean(ENABLE_TIMER_PROPERTY_NAME_PREFIX + name)) { - return new TimerImpl(name, false); + public static DebugTimer timer(CharSequence name) { + if (enabledTimers != null && enabledTimers.contains(name.toString())) { + return new TimerImpl(name.toString(), false); } else if (ENABLED) { - return new TimerImpl(name, true); + return new TimerImpl(name.toString(), true); } else { return VOID_TIMER; } diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Wed Mar 19 11:43:57 2014 +0100 @@ -45,7 +45,7 @@ * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug * scope}. * - * @see Debug#metric(String) + * @see Debug#metric(CharSequence) */ boolean isMeterEnabled(); @@ -76,7 +76,7 @@ void removeFromContext(Object o); /** - * @see Debug#timer(String) + * @see Debug#timer(CharSequence) */ boolean isTimeEnabled(); diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugHistogram.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugHistogram.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugHistogram.java Wed Mar 19 11:43:57 2014 +0100 @@ -72,6 +72,10 @@ count++; } + public void add(int n) { + count += n; + } + public int getCount() { return count; } diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java Wed Mar 19 11:43:57 2014 +0100 @@ -231,13 +231,13 @@ * @param newContextObjects objects to be appended to the debug context * @return the new scope which will be exited when its {@link #close()} method is called */ - public DebugScope scope(String name, DebugConfig sandboxConfig, Object... newContextObjects) { + public DebugScope scope(CharSequence name, DebugConfig sandboxConfig, Object... newContextObjects) { DebugScope newScope = null; if (sandboxConfig != null) { - newScope = new DebugScope(name, name, this, true, newContextObjects); + newScope = new DebugScope(name.toString(), name.toString(), this, true, newContextObjects); configTL.set(sandboxConfig); } else { - newScope = this.createChild(name, newContextObjects); + newScope = this.createChild(name.toString(), newContextObjects); } instanceTL.set(newScope); newScope.updateFlags(); diff -r 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Wed Mar 19 11:43:57 2014 +0100 @@ -458,6 +458,7 @@ * newInput: removes this node from oldInput's usages and adds this node to newInput's usages. */ protected void updateUsages(Node oldInput, Node newInput) { + assert isAlive() && (newInput == null || newInput.isAlive()) : "adding " + newInput + " to " + this + " instead of " + oldInput; if (oldInput != newInput) { if (oldInput != null) { if (oldInput.recordsUsages()) { @@ -482,6 +483,7 @@ * this node to newSuccessor's predecessors. */ protected void updatePredecessor(Node oldSuccessor, Node newSuccessor) { + assert isAlive() && (newSuccessor == null || newSuccessor.isAlive()) : "adding " + newSuccessor + " to " + this + " instead of " + oldSuccessor; assert graph == null || !graph.isFrozen(); if (oldSuccessor != newSuccessor) { if (oldSuccessor != null) { diff -r 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Mar 19 11:43:57 2014 +0100 @@ -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 54fa8e06831c -r 1617b1e25d31 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 16:43:34 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 54fa8e06831c -r 1617b1e25d31 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Mon Mar 17 16:43:34 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Wed Mar 19 11:43:57 2014 +0100 @@ -50,10 +50,10 @@ * infrastructure is enabled by specifying either the GenericDynamicCounters or * BenchmarkDynamicCounters option.
* - * The counters are kept in a special area in the native JavaThread object, and the number of - * counters is configured in {@code thread.hpp (GRAAL_COUNTERS_SIZE)}. This file also contains an - * option to exclude compiler threads ({@code GRAAL_COUNTERS_EXCLUDE_COMPILER_THREADS}, which - * defaults to true). + * The counters are kept in a special area allocated for each native JavaThread object, and the + * number of counters is configured using {@code -XX:GraalCounterSize=value}. + * {@code -XX:+/-GraalCountersExcludeCompiler} configures whether to exclude compiler threads + * (defaults to true). * * The subsystems that use the logging need to have their own options to turn on the counters, and * insert DynamicCounterNodes when they're enabled. @@ -64,12 +64,10 @@ *

Example

In order to create statistics about allocations within the DaCapo pmd benchmark * the following steps are necessary: *