hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
changeset 17314 28fab19f2ccd
parent 15475 73896d91270c
child 17875 9d4aa49a1d76
equal deleted inserted replaced
17098:7aa4c9e7f85b 17314:28fab19f2ccd
    30 #include "interpreter/bytecodeInterpreter.inline.hpp"
    30 #include "interpreter/bytecodeInterpreter.inline.hpp"
    31 #include "interpreter/interpreter.hpp"
    31 #include "interpreter/interpreter.hpp"
    32 #include "interpreter/interpreterRuntime.hpp"
    32 #include "interpreter/interpreterRuntime.hpp"
    33 #include "memory/cardTableModRefBS.hpp"
    33 #include "memory/cardTableModRefBS.hpp"
    34 #include "memory/resourceArea.hpp"
    34 #include "memory/resourceArea.hpp"
       
    35 #include "oops/methodCounters.hpp"
    35 #include "oops/objArrayKlass.hpp"
    36 #include "oops/objArrayKlass.hpp"
    36 #include "oops/oop.inline.hpp"
    37 #include "oops/oop.inline.hpp"
    37 #include "prims/jvmtiExport.hpp"
    38 #include "prims/jvmtiExport.hpp"
    38 #include "runtime/frame.inline.hpp"
    39 #include "runtime/frame.inline.hpp"
    39 #include "runtime/handles.inline.hpp"
    40 #include "runtime/handles.inline.hpp"
   302    istate->set_bcp(pc+opsize);        \
   303    istate->set_bcp(pc+opsize);        \
   303    return;
   304    return;
   304 
   305 
   305 
   306 
   306 #define METHOD istate->method()
   307 #define METHOD istate->method()
   307 #define INVOCATION_COUNT METHOD->invocation_counter()
   308 #define GET_METHOD_COUNTERS(res)    \
   308 #define BACKEDGE_COUNT METHOD->backedge_counter()
   309   res = METHOD->method_counters();  \
   309 
   310   if (res == NULL) {                \
   310 
   311     CALL_VM(res = InterpreterRuntime::build_method_counters(THREAD, METHOD), handle_exception); \
   311 #define INCR_INVOCATION_COUNT INVOCATION_COUNT->increment()
   312   }
       
   313 
   312 #define OSR_REQUEST(res, branch_pc) \
   314 #define OSR_REQUEST(res, branch_pc) \
   313             CALL_VM(res=InterpreterRuntime::frequency_counter_overflow(THREAD, branch_pc), handle_exception);
   315             CALL_VM(res=InterpreterRuntime::frequency_counter_overflow(THREAD, branch_pc), handle_exception);
   314 /*
   316 /*
   315  * For those opcodes that need to have a GC point on a backwards branch
   317  * For those opcodes that need to have a GC point on a backwards branch
   316  */
   318  */
   323 // skip is delta from current bcp/bci for target, branch_pc is pre-branch bcp
   325 // skip is delta from current bcp/bci for target, branch_pc is pre-branch bcp
   324 
   326 
   325 
   327 
   326 #define DO_BACKEDGE_CHECKS(skip, branch_pc)                                                         \
   328 #define DO_BACKEDGE_CHECKS(skip, branch_pc)                                                         \
   327     if ((skip) <= 0) {                                                                              \
   329     if ((skip) <= 0) {                                                                              \
       
   330       MethodCounters* mcs;                                                                          \
       
   331       GET_METHOD_COUNTERS(mcs);                                                                     \
   328       if (UseLoopCounter) {                                                                         \
   332       if (UseLoopCounter) {                                                                         \
   329         bool do_OSR = UseOnStackReplacement;                                                        \
   333         bool do_OSR = UseOnStackReplacement;                                                        \
   330         BACKEDGE_COUNT->increment();                                                                \
   334         mcs->backedge_counter()->increment();                                                       \
   331         if (do_OSR) do_OSR = BACKEDGE_COUNT->reached_InvocationLimit();                             \
   335         if (do_OSR) do_OSR = mcs->backedge_counter()->reached_InvocationLimit();                    \
   332         if (do_OSR) {                                                                               \
   336         if (do_OSR) {                                                                               \
   333           nmethod*  osr_nmethod;                                                                    \
   337           nmethod*  osr_nmethod;                                                                    \
   334           OSR_REQUEST(osr_nmethod, branch_pc);                                                      \
   338           OSR_REQUEST(osr_nmethod, branch_pc);                                                      \
   335           if (osr_nmethod != NULL && osr_nmethod->osr_entry_bci() != InvalidOSREntryBci) {          \
   339           if (osr_nmethod != NULL && osr_nmethod->osr_entry_bci() != InvalidOSREntryBci) {          \
   336             intptr_t* buf = SharedRuntime::OSR_migration_begin(THREAD);                             \
   340             intptr_t* buf = SharedRuntime::OSR_migration_begin(THREAD);                             \
   339             istate->set_osr_entry(osr_nmethod->osr_entry());                                        \
   343             istate->set_osr_entry(osr_nmethod->osr_entry());                                        \
   340             return;                                                                                 \
   344             return;                                                                                 \
   341           }                                                                                         \
   345           }                                                                                         \
   342         }                                                                                           \
   346         }                                                                                           \
   343       }  /* UseCompiler ... */                                                                      \
   347       }  /* UseCompiler ... */                                                                      \
   344       INCR_INVOCATION_COUNT;                                                                        \
   348       mcs->invocation_counter()->increment();                                                       \
   345       SAFEPOINT;                                                                                    \
   349       SAFEPOINT;                                                                                    \
   346     }
   350     }
   347 
   351 
   348 /*
   352 /*
   349  * For those opcodes that need to have a GC point on a backwards branch
   353  * For those opcodes that need to have a GC point on a backwards branch
   616     case method_entry: {
   620     case method_entry: {
   617       THREAD->set_do_not_unlock();
   621       THREAD->set_do_not_unlock();
   618       // count invocations
   622       // count invocations
   619       assert(initialized, "Interpreter not initialized");
   623       assert(initialized, "Interpreter not initialized");
   620       if (_compiling) {
   624       if (_compiling) {
       
   625         MethodCounters* mcs;
       
   626         GET_METHOD_COUNTERS(mcs);
   621         if (ProfileInterpreter) {
   627         if (ProfileInterpreter) {
   622           METHOD->increment_interpreter_invocation_count();
   628           METHOD->increment_interpreter_invocation_count(THREAD);
   623         }
   629         }
   624         INCR_INVOCATION_COUNT;
   630         mcs->invocation_counter()->increment();
   625         if (INVOCATION_COUNT->reached_InvocationLimit()) {
   631         if (mcs->invocation_counter()->reached_InvocationLimit()) {
   626             CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
   632             CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
   627 
   633 
   628             // We no longer retry on a counter overflow
   634             // We no longer retry on a counter overflow
   629 
   635 
   630             // istate->set_msg(retry_method);
   636             // istate->set_msg(retry_method);