# HG changeset patch # User jiangli # Date 1368131271 14400 # Node ID d3c98423c146625cd1b11e9190ac9eba3928e85e # Parent 7243490a684726330004cacb1e76dbd269327411# Parent a258a8351528e83e9788a15e6587551e5e2f1a03 Merge diff -r 7243490a6847 -r d3c98423c146 src/cpu/sparc/vm/globalDefinitions_sparc.hpp --- a/src/cpu/sparc/vm/globalDefinitions_sparc.hpp Tue May 07 14:30:11 2013 -0700 +++ b/src/cpu/sparc/vm/globalDefinitions_sparc.hpp Thu May 09 16:27:51 2013 -0400 @@ -30,4 +30,6 @@ const int StackAlignmentInBytes = (2*wordSize); +#define SUPPORTS_NATIVE_CX8 + #endif // CPU_SPARC_VM_GLOBALDEFINITIONS_SPARC_HPP diff -r 7243490a6847 -r d3c98423c146 src/cpu/x86/vm/globalDefinitions_x86.hpp --- a/src/cpu/x86/vm/globalDefinitions_x86.hpp Tue May 07 14:30:11 2013 -0700 +++ b/src/cpu/x86/vm/globalDefinitions_x86.hpp Thu May 09 16:27:51 2013 -0400 @@ -27,4 +27,6 @@ const int StackAlignmentInBytes = 16; +#define SUPPORTS_NATIVE_CX8 + #endif // CPU_X86_VM_GLOBALDEFINITIONS_X86_HPP diff -r 7243490a6847 -r d3c98423c146 src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue May 07 14:30:11 2013 -0700 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu May 09 16:27:51 2013 -0400 @@ -212,7 +212,13 @@ // Update the invocation counter if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) { - InvocationCounter *counter = method->invocation_counter(); + MethodCounters* mcs = method->method_counters(); + if (mcs == NULL) { + CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method)); + if (HAS_PENDING_EXCEPTION) + goto unwind_and_return; + } + InvocationCounter *counter = mcs->invocation_counter(); counter->increment(); if (counter->reached_InvocationLimit()) { CALL_VM_NOCHECK( diff -r 7243490a6847 -r d3c98423c146 src/share/vm/interpreter/bytecodeInterpreter.cpp --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue May 07 14:30:11 2013 -0700 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Thu May 09 16:27:51 2013 -0400 @@ -32,6 +32,7 @@ #include "interpreter/interpreterRuntime.hpp" #include "memory/cardTableModRefBS.hpp" #include "memory/resourceArea.hpp" +#include "oops/methodCounters.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" @@ -304,11 +305,12 @@ #define METHOD istate->method() -#define INVOCATION_COUNT METHOD->invocation_counter() -#define BACKEDGE_COUNT METHOD->backedge_counter() - - -#define INCR_INVOCATION_COUNT INVOCATION_COUNT->increment() +#define GET_METHOD_COUNTERS(res) \ + res = METHOD->method_counters(); \ + if (res == NULL) { \ + CALL_VM(res = InterpreterRuntime::build_method_counters(THREAD, METHOD), handle_exception); \ + } + #define OSR_REQUEST(res, branch_pc) \ CALL_VM(res=InterpreterRuntime::frequency_counter_overflow(THREAD, branch_pc), handle_exception); /* @@ -325,10 +327,12 @@ #define DO_BACKEDGE_CHECKS(skip, branch_pc) \ if ((skip) <= 0) { \ + MethodCounters* mcs; \ + GET_METHOD_COUNTERS(mcs); \ if (UseLoopCounter) { \ bool do_OSR = UseOnStackReplacement; \ - BACKEDGE_COUNT->increment(); \ - if (do_OSR) do_OSR = BACKEDGE_COUNT->reached_InvocationLimit(); \ + mcs->backedge_counter()->increment(); \ + if (do_OSR) do_OSR = mcs->backedge_counter()->reached_InvocationLimit(); \ if (do_OSR) { \ nmethod* osr_nmethod; \ OSR_REQUEST(osr_nmethod, branch_pc); \ @@ -341,7 +345,7 @@ } \ } \ } /* UseCompiler ... */ \ - INCR_INVOCATION_COUNT; \ + mcs->invocation_counter()->increment(); \ SAFEPOINT; \ } @@ -618,11 +622,13 @@ // count invocations assert(initialized, "Interpreter not initialized"); if (_compiling) { + MethodCounters* mcs; + GET_METHOD_COUNTERS(mcs); if (ProfileInterpreter) { - METHOD->increment_interpreter_invocation_count(); + METHOD->increment_interpreter_invocation_count(THREAD); } - INCR_INVOCATION_COUNT; - if (INVOCATION_COUNT->reached_InvocationLimit()) { + mcs->invocation_counter()->increment(); + if (mcs->invocation_counter()->reached_InvocationLimit()) { CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception); // We no longer retry on a counter overflow diff -r 7243490a6847 -r d3c98423c146 src/share/vm/oops/method.hpp --- a/src/share/vm/oops/method.hpp Tue May 07 14:30:11 2013 -0700 +++ b/src/share/vm/oops/method.hpp Thu May 09 16:27:51 2013 -0400 @@ -67,7 +67,7 @@ // | ConstMethod* (oop) | // |------------------------------------------------------| // | methodData (oop) | -// | interp_invocation_count | +// | methodCounters | // |------------------------------------------------------| // | access_flags | // | vtable_index | @@ -76,16 +76,6 @@ // |------------------------------------------------------| // | method_size | intrinsic_id| flags | // |------------------------------------------------------| -// | throwout_count | num_breakpoints | -// |------------------------------------------------------| -// | invocation_counter | -// | backedge_counter | -// |------------------------------------------------------| -// | prev_time (tiered only, 64 bit wide) | -// | | -// |------------------------------------------------------| -// | rate (tiered) | -// |------------------------------------------------------| // | code (pointer) | // | i2i (pointer) | // | adapter (pointer) | diff -r 7243490a6847 -r d3c98423c146 src/share/vm/prims/unsafe.cpp --- a/src/share/vm/prims/unsafe.cpp Tue May 07 14:30:11 2013 -0700 +++ b/src/share/vm/prims/unsafe.cpp Thu May 09 16:27:51 2013 -0400 @@ -315,10 +315,7 @@ OrderAccess::fence(); UNSAFE_END -#if defined(SPARC) || defined(X86) -// Sparc and X86 have atomic jlong (8 bytes) instructions - -#else +#ifndef SUPPORTS_NATIVE_CX8 // Keep old code for platforms which may not have atomic jlong (8 bytes) instructions // Volatile long versions must use locks if !VM_Version::supports_cx8(). @@ -356,7 +353,7 @@ } UNSAFE_END -#endif // not SPARC and not X86 +#endif // not SUPPORTS_NATIVE_CX8 #define DEFINE_GETSETOOP(jboolean, Boolean) \ \ @@ -420,8 +417,7 @@ DEFINE_GETSETOOP_VOLATILE(jfloat, Float); DEFINE_GETSETOOP_VOLATILE(jdouble, Double); -#if defined(SPARC) || defined(X86) -// Sparc and X86 have atomic jlong (8 bytes) instructions +#ifdef SUPPORTS_NATIVE_CX8 DEFINE_GETSETOOP_VOLATILE(jlong, Long); #endif @@ -450,8 +446,7 @@ UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) UnsafeWrapper("Unsafe_SetOrderedLong"); -#if defined(SPARC) || defined(X86) - // Sparc and X86 have atomic jlong (8 bytes) instructions +#ifdef SUPPORTS_NATIVE_CX8 SET_FIELD_VOLATILE(obj, offset, jlong, x); #else // Keep old code for platforms which may not have atomic long (8 bytes) instructions