# HG changeset patch # User twisti # Date 1386300510 28800 # Node ID 4eacfd0767ed4158d148e01de12c7a9bedc35ed9 # Parent 14100434f4219da47baa8f5c9c13dddc84ac0b6b get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig diff -r 14100434f421 -r 4eacfd0767ed 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 Sat Dec 07 19:34:42 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Thu Dec 05 19:28:30 2013 -0800 @@ -1197,6 +1197,13 @@ @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant; @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable; + @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits; + @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits; + @HotSpotVMConstant(name = "Deoptimization::_speculation_id_bits") @Stable public int deoptimizationSpeculationIdBits; + @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift; + @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift; + @HotSpotVMConstant(name = "Deoptimization::_speculation_id_shift") @Stable public int deoptimizationSpeculationIdShift; + @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic; @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual; @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic; diff -r 14100434f421 -r 4eacfd0767ed graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Sat Dec 07 19:34:42 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Thu Dec 05 19:28:30 2013 -0800 @@ -79,20 +79,6 @@ return runtime.getCompilerToVM().getJavaField(reflectionField); } - // These are synchronized with values in deoptimization.hpp:105 - private static final int ACTION_BITS = 3; - private static final int REASON_BITS = 5; - private static final int SPECULATION_BITS = 23; - - private static final int ACTION_SHIFT = 0; - private static final int ACTION_MASK = intMaskRight(ACTION_BITS); - - private static final int REASON_SHIFT = ACTION_SHIFT + ACTION_BITS; - private static final int REASON_MASK = intMaskRight(REASON_BITS); - - private static final int SPECULATION_SHIFT = REASON_SHIFT + REASON_BITS; - private static final int SPECULATION_MASK = intMaskRight(SPECULATION_BITS); - private static int intMaskRight(int n) { assert n <= 32; return n == 32 ? -1 : (1 << n) - 1; @@ -100,133 +86,157 @@ @Override public Constant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int speculationId) { + HotSpotVMConfig config = runtime.getConfig(); int actionValue = convertDeoptAction(action); int reasonValue = convertDeoptReason(reason); - int speculationValue = speculationId & SPECULATION_MASK; - Constant c = Constant.forInt(~((speculationValue << SPECULATION_SHIFT) | (reasonValue << REASON_SHIFT) | (actionValue << ACTION_SHIFT))); + int speculationValue = speculationId & intMaskRight(config.deoptimizationSpeculationIdBits); + Constant c = Constant.forInt(~((speculationValue << config.deoptimizationSpeculationIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift))); assert c.asInt() < 0; return c; } public DeoptimizationReason decodeDeoptReason(Constant constant) { - int reasonValue = ((~constant.asInt()) >> REASON_SHIFT) & REASON_MASK; + HotSpotVMConfig config = runtime.getConfig(); + int reasonValue = ((~constant.asInt()) >> config.deoptimizationReasonShift) & intMaskRight(config.deoptimizationReasonBits); DeoptimizationReason reason = convertDeoptReason(reasonValue); return reason; } public DeoptimizationAction decodeDeoptAction(Constant constant) { - int actionValue = ((~constant.asInt()) >> ACTION_SHIFT) & ACTION_MASK; + HotSpotVMConfig config = runtime.getConfig(); + int actionValue = ((~constant.asInt()) >> config.deoptimizationActionShift) & intMaskRight(config.deoptimizationActionBits); DeoptimizationAction action = convertDeoptAction(actionValue); return action; } public short decodeSpeculationId(Constant constant) { - return (short) (((~constant.asInt()) >> SPECULATION_SHIFT) & SPECULATION_MASK); + HotSpotVMConfig config = runtime.getConfig(); + return (short) (((~constant.asInt()) >> config.deoptimizationSpeculationIdShift) & intMaskRight(config.deoptimizationSpeculationIdBits)); } public int convertDeoptAction(DeoptimizationAction action) { + HotSpotVMConfig config = runtime.getConfig(); switch (action) { case None: - return runtime.getConfig().deoptActionNone; + return config.deoptActionNone; case RecompileIfTooManyDeopts: - return runtime.getConfig().deoptActionMaybeRecompile; + return config.deoptActionMaybeRecompile; case InvalidateReprofile: - return runtime.getConfig().deoptActionReinterpret; + return config.deoptActionReinterpret; case InvalidateRecompile: - return runtime.getConfig().deoptActionMakeNotEntrant; + return config.deoptActionMakeNotEntrant; case InvalidateStopCompiling: - return runtime.getConfig().deoptActionMakeNotCompilable; + return config.deoptActionMakeNotCompilable; default: throw GraalInternalError.shouldNotReachHere(); } } public DeoptimizationAction convertDeoptAction(int action) { - if (action == runtime.getConfig().deoptActionNone) { + HotSpotVMConfig config = runtime.getConfig(); + if (action == config.deoptActionNone) { return DeoptimizationAction.None; - } else if (action == runtime.getConfig().deoptActionMaybeRecompile) { + } + if (action == config.deoptActionMaybeRecompile) { return DeoptimizationAction.RecompileIfTooManyDeopts; - } else if (action == runtime.getConfig().deoptActionReinterpret) { + } + if (action == config.deoptActionReinterpret) { return DeoptimizationAction.InvalidateReprofile; - } else if (action == runtime.getConfig().deoptActionMakeNotEntrant) { + } + if (action == config.deoptActionMakeNotEntrant) { return DeoptimizationAction.InvalidateRecompile; - } else if (action == runtime.getConfig().deoptActionMakeNotCompilable) { + } + if (action == config.deoptActionMakeNotCompilable) { return DeoptimizationAction.InvalidateStopCompiling; - } else { - throw GraalInternalError.shouldNotReachHere(); } + throw GraalInternalError.shouldNotReachHere(); } public int convertDeoptReason(DeoptimizationReason reason) { + HotSpotVMConfig config = runtime.getConfig(); switch (reason) { case None: - return runtime.getConfig().deoptReasonNone; + return config.deoptReasonNone; case NullCheckException: - return runtime.getConfig().deoptReasonNullCheck; + return config.deoptReasonNullCheck; case BoundsCheckException: - return runtime.getConfig().deoptReasonRangeCheck; + return config.deoptReasonRangeCheck; case ClassCastException: - return runtime.getConfig().deoptReasonClassCheck; + return config.deoptReasonClassCheck; case ArrayStoreException: - return runtime.getConfig().deoptReasonArrayCheck; + return config.deoptReasonArrayCheck; case UnreachedCode: - return runtime.getConfig().deoptReasonUnreached0; + return config.deoptReasonUnreached0; case TypeCheckedInliningViolated: - return runtime.getConfig().deoptReasonTypeCheckInlining; + return config.deoptReasonTypeCheckInlining; case OptimizedTypeCheckViolated: - return runtime.getConfig().deoptReasonOptimizedTypeCheck; + return config.deoptReasonOptimizedTypeCheck; case NotCompiledExceptionHandler: - return runtime.getConfig().deoptReasonNotCompiledExceptionHandler; + return config.deoptReasonNotCompiledExceptionHandler; case Unresolved: - return runtime.getConfig().deoptReasonUnresolved; + return config.deoptReasonUnresolved; case JavaSubroutineMismatch: - return runtime.getConfig().deoptReasonJsrMismatch; + return config.deoptReasonJsrMismatch; case ArithmeticException: - return runtime.getConfig().deoptReasonDiv0Check; + return config.deoptReasonDiv0Check; case RuntimeConstraint: - return runtime.getConfig().deoptReasonConstraint; + return config.deoptReasonConstraint; case LoopLimitCheck: - return runtime.getConfig().deoptReasonLoopLimitCheck; + return config.deoptReasonLoopLimitCheck; case Aliasing: - return runtime.getConfig().deoptReasonAliasing; + return config.deoptReasonAliasing; default: throw GraalInternalError.shouldNotReachHere(); } } public DeoptimizationReason convertDeoptReason(int reason) { - if (reason == runtime.getConfig().deoptReasonNone) { + HotSpotVMConfig config = runtime.getConfig(); + if (reason == config.deoptReasonNone) { return DeoptimizationReason.None; - } else if (reason == runtime.getConfig().deoptReasonNullCheck) { + } + if (reason == config.deoptReasonNullCheck) { return DeoptimizationReason.NullCheckException; - } else if (reason == runtime.getConfig().deoptReasonRangeCheck) { + } + if (reason == config.deoptReasonRangeCheck) { return DeoptimizationReason.BoundsCheckException; - } else if (reason == runtime.getConfig().deoptReasonClassCheck) { + } + if (reason == config.deoptReasonClassCheck) { return DeoptimizationReason.ClassCastException; - } else if (reason == runtime.getConfig().deoptReasonArrayCheck) { + } + if (reason == config.deoptReasonArrayCheck) { return DeoptimizationReason.ArrayStoreException; - } else if (reason == runtime.getConfig().deoptReasonUnreached0) { + } + if (reason == config.deoptReasonUnreached0) { return DeoptimizationReason.UnreachedCode; - } else if (reason == runtime.getConfig().deoptReasonTypeCheckInlining) { + } + if (reason == config.deoptReasonTypeCheckInlining) { return DeoptimizationReason.TypeCheckedInliningViolated; - } else if (reason == runtime.getConfig().deoptReasonOptimizedTypeCheck) { + } + if (reason == config.deoptReasonOptimizedTypeCheck) { return DeoptimizationReason.OptimizedTypeCheckViolated; - } else if (reason == runtime.getConfig().deoptReasonNotCompiledExceptionHandler) { + } + if (reason == config.deoptReasonNotCompiledExceptionHandler) { return DeoptimizationReason.NotCompiledExceptionHandler; - } else if (reason == runtime.getConfig().deoptReasonUnresolved) { + } + if (reason == config.deoptReasonUnresolved) { return DeoptimizationReason.Unresolved; - } else if (reason == runtime.getConfig().deoptReasonJsrMismatch) { + } + if (reason == config.deoptReasonJsrMismatch) { return DeoptimizationReason.JavaSubroutineMismatch; - } else if (reason == runtime.getConfig().deoptReasonDiv0Check) { + } + if (reason == config.deoptReasonDiv0Check) { return DeoptimizationReason.ArithmeticException; - } else if (reason == runtime.getConfig().deoptReasonConstraint) { + } + if (reason == config.deoptReasonConstraint) { return DeoptimizationReason.RuntimeConstraint; - } else if (reason == runtime.getConfig().deoptReasonLoopLimitCheck) { + } + if (reason == config.deoptReasonLoopLimitCheck) { return DeoptimizationReason.LoopLimitCheck; - } else if (reason == runtime.getConfig().deoptReasonAliasing) { + } + if (reason == config.deoptReasonAliasing) { return DeoptimizationReason.Aliasing; - } else { - throw GraalInternalError.shouldNotReachHere(Integer.toHexString(reason)); } + throw GraalInternalError.shouldNotReachHere(Integer.toHexString(reason)); } } diff -r 14100434f421 -r 4eacfd0767ed src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp Sat Dec 07 19:34:42 2013 +0100 +++ b/src/share/vm/runtime/vmStructs.cpp Thu Dec 05 19:28:30 2013 -0800 @@ -2560,6 +2560,13 @@ declare_constant(Deoptimization::Unpack_uncommon_trap) \ declare_constant(Deoptimization::Unpack_reexecute) \ \ + declare_constant(Deoptimization::_action_bits) \ + declare_constant(Deoptimization::_reason_bits) \ + declare_constant(Deoptimization::_speculation_id_bits) \ + declare_constant(Deoptimization::_action_shift) \ + declare_constant(Deoptimization::_reason_shift) \ + declare_constant(Deoptimization::_speculation_id_shift) \ + \ /*********************/ \ /* Matcher (C2 only) */ \ /*********************/ \