52
52
#include " runtime/sharedRuntime.hpp"
53
53
#include " runtime/threadCritical.hpp"
54
54
#include " utilities/exceptions.hpp"
55
+ #include " utilities/macros.hpp"
55
56
56
57
// no precompiled headers
57
58
153
154
#endif
154
155
155
156
#undef DEBUGGER_SINGLE_STEP_NOTIFY
156
- #ifdef VM_JVMTI
157
+ #if INCLUDE_JVMTI
157
158
/* NOTE: (kbr) This macro must be called AFTER the PC has been
158
159
incremented. JvmtiExport::at_single_stepping_point() may cause a
159
160
breakpoint opcode to get inserted at the current PC to allow the
163
164
to get the current opcode. This will override any other prefetching
164
165
that might have occurred.
165
166
*/
166
- #define DEBUGGER_SINGLE_STEP_NOTIFY () \
167
- { \
168
- if (_jvmti_interp_events) { \
169
- if (JvmtiExport::should_post_single_step ()) { \
170
- DECACHE_STATE (); \
171
- SET_LAST_JAVA_FRAME (); \
172
- ThreadInVMfromJava trans (THREAD); \
173
- JvmtiExport::at_single_stepping_point (THREAD, \
174
- istate->method (), \
175
- pc); \
176
- RESET_LAST_JAVA_FRAME (); \
177
- CACHE_STATE (); \
178
- if (THREAD->has_pending_popframe () && \
179
- !THREAD->pop_frame_in_process ()) { \
180
- goto handle_Pop_Frame; \
181
- } \
182
- if (THREAD->jvmti_thread_state () && \
183
- THREAD->jvmti_thread_state ()->is_earlyret_pending ()) { \
184
- goto handle_Early_Return; \
185
- } \
186
- opcode = *pc; \
187
- } \
188
- } \
167
+ #define DEBUGGER_SINGLE_STEP_NOTIFY () \
168
+ { \
169
+ if (JVMTI_ENABLED && JvmtiExport::should_post_single_step ()) { \
170
+ DECACHE_STATE (); \
171
+ SET_LAST_JAVA_FRAME (); \
172
+ ThreadInVMfromJava trans (THREAD); \
173
+ JvmtiExport::at_single_stepping_point (THREAD, \
174
+ istate->method (), \
175
+ pc); \
176
+ RESET_LAST_JAVA_FRAME (); \
177
+ CACHE_STATE (); \
178
+ if (THREAD->has_pending_popframe () && \
179
+ !THREAD->pop_frame_in_process ()) { \
180
+ goto handle_Pop_Frame; \
181
+ } \
182
+ if (THREAD->jvmti_thread_state () && \
183
+ THREAD->jvmti_thread_state ()->is_earlyret_pending ()) { \
184
+ goto handle_Early_Return; \
185
+ } \
186
+ opcode = *pc; \
187
+ } \
189
188
}
190
189
#else
191
190
#define DEBUGGER_SINGLE_STEP_NOTIFY ()
192
- #endif
191
+ #endif // INCLUDE_JVMTI
193
192
194
193
/*
195
194
* CONTINUE - Macro for executing the next opcode.
387
386
388
387
/*
389
388
* BytecodeInterpreter::run(interpreterState istate)
390
- * BytecodeInterpreter::runWithChecks(interpreterState istate)
391
389
*
392
390
* The real deal. This is where byte codes actually get interpreted.
393
391
* Basically it's a big while loop that iterates until we return from
394
392
* the method passed in.
395
- *
396
- * The runWithChecks is used if JVMTI is enabled.
397
- *
398
393
*/
399
- # if defined(VM_JVMTI)
400
- void
401
- BytecodeInterpreter::runWithChecks (interpreterState istate) {
402
- # else
403
- void
404
- BytecodeInterpreter::run (interpreterState istate) {
405
- #endif
394
+
395
+ // Instantiate two variants of the method for future linking.
396
+ template void BytecodeInterpreter::run< true > (interpreterState istate);
397
+ template void BytecodeInterpreter::run< false >(interpreterState istate);
398
+
399
+ template < bool JVMTI_ENABLED>
400
+ void BytecodeInterpreter::run (interpreterState istate) {
406
401
407
402
// In order to simplify some tests based on switches set at runtime
408
403
// we invoke the interpreter a single time after switches are enabled
@@ -417,9 +412,6 @@ BytecodeInterpreter::run(interpreterState istate) {
417
412
if (checkit && *c_addr != c_value) {
418
413
os::breakpoint ();
419
414
}
420
- #ifdef VM_JVMTI
421
- static bool _jvmti_interp_events = 0 ;
422
- #endif
423
415
424
416
#ifdef ASSERT
425
417
if (istate->_msg != initialize) {
@@ -555,9 +547,6 @@ BytecodeInterpreter::run(interpreterState istate) {
555
547
switch (istate->msg ()) {
556
548
case initialize: {
557
549
if (initialized++) ShouldNotReachHere (); // Only one initialize call.
558
- #ifdef VM_JVMTI
559
- _jvmti_interp_events = JvmtiExport::can_post_interpreter_events ();
560
- #endif
561
550
return ;
562
551
}
563
552
break ;
@@ -667,17 +656,13 @@ BytecodeInterpreter::run(interpreterState istate) {
667
656
}
668
657
THREAD->clr_do_not_unlock ();
669
658
670
- // Notify jvmti
671
- #ifdef VM_JVMTI
672
- if (_jvmti_interp_events) {
673
- // Whenever JVMTI puts a thread in interp_only_mode, method
674
- // entry/exit events are sent for that thread to track stack depth.
675
- if (THREAD->is_interp_only_mode ()) {
676
- CALL_VM (InterpreterRuntime::post_method_entry (THREAD),
677
- handle_exception);
678
- }
659
+ // Notify jvmti.
660
+ // Whenever JVMTI puts a thread in interp_only_mode, method
661
+ // entry/exit events are sent for that thread to track stack depth.
662
+ if (JVMTI_ENABLED && THREAD->is_interp_only_mode ()) {
663
+ CALL_VM (InterpreterRuntime::post_method_entry (THREAD),
664
+ handle_exception);
679
665
}
680
- #endif /* VM_JVMTI */
681
666
682
667
goto run;
683
668
}
@@ -1800,8 +1785,7 @@ BytecodeInterpreter::run(interpreterState istate) {
1800
1785
cache = cp->entry_at (index);
1801
1786
}
1802
1787
1803
- #ifdef VM_JVMTI
1804
- if (_jvmti_interp_events) {
1788
+ if (JVMTI_ENABLED) {
1805
1789
int *count_addr;
1806
1790
oop obj;
1807
1791
// Check to see if a field modification watch has been set
@@ -1820,7 +1804,6 @@ BytecodeInterpreter::run(interpreterState istate) {
1820
1804
handle_exception);
1821
1805
}
1822
1806
}
1823
- #endif /* VM_JVMTI */
1824
1807
1825
1808
oop obj;
1826
1809
if ((Bytecodes::Code)opcode == Bytecodes::_getstatic) {
@@ -1898,8 +1881,7 @@ BytecodeInterpreter::run(interpreterState istate) {
1898
1881
cache = cp->entry_at (index);
1899
1882
}
1900
1883
1901
- #ifdef VM_JVMTI
1902
- if (_jvmti_interp_events) {
1884
+ if (JVMTI_ENABLED) {
1903
1885
int *count_addr;
1904
1886
oop obj;
1905
1887
// Check to see if a field modification watch has been set
@@ -1925,7 +1907,6 @@ BytecodeInterpreter::run(interpreterState istate) {
1925
1907
handle_exception);
1926
1908
}
1927
1909
}
1928
- #endif /* VM_JVMTI */
1929
1910
1930
1911
// QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases
1931
1912
// out so c++ compiler has a chance for constant prop to fold everything possible away.
@@ -2404,11 +2385,9 @@ BytecodeInterpreter::run(interpreterState istate) {
2404
2385
if (callee != NULL ) {
2405
2386
istate->set_callee (callee);
2406
2387
istate->set_callee_entry_point (callee->from_interpreted_entry ());
2407
- #ifdef VM_JVMTI
2408
- if (JvmtiExport::can_post_interpreter_events () && THREAD->is_interp_only_mode ()) {
2388
+ if (JVMTI_ENABLED && THREAD->is_interp_only_mode ()) {
2409
2389
istate->set_callee_entry_point (callee->interpreter_entry ());
2410
2390
}
2411
- #endif /* VM_JVMTI */
2412
2391
istate->set_bcp_advance (5 );
2413
2392
UPDATE_PC_AND_RETURN (0 ); // I'll be back...
2414
2393
}
@@ -2466,11 +2445,9 @@ BytecodeInterpreter::run(interpreterState istate) {
2466
2445
2467
2446
istate->set_callee (callee);
2468
2447
istate->set_callee_entry_point (callee->from_interpreted_entry ());
2469
- #ifdef VM_JVMTI
2470
- if (JvmtiExport::can_post_interpreter_events () && THREAD->is_interp_only_mode ()) {
2448
+ if (JVMTI_ENABLED && THREAD->is_interp_only_mode ()) {
2471
2449
istate->set_callee_entry_point (callee->interpreter_entry ());
2472
2450
}
2473
- #endif /* VM_JVMTI */
2474
2451
istate->set_bcp_advance (5 );
2475
2452
UPDATE_PC_AND_RETURN (0 ); // I'll be back...
2476
2453
}
@@ -2536,11 +2513,9 @@ BytecodeInterpreter::run(interpreterState istate) {
2536
2513
2537
2514
istate->set_callee (callee);
2538
2515
istate->set_callee_entry_point (callee->from_interpreted_entry ());
2539
- #ifdef VM_JVMTI
2540
- if (JvmtiExport::can_post_interpreter_events () && THREAD->is_interp_only_mode ()) {
2516
+ if (JVMTI_ENABLED && THREAD->is_interp_only_mode ()) {
2541
2517
istate->set_callee_entry_point (callee->interpreter_entry ());
2542
2518
}
2543
- #endif /* VM_JVMTI */
2544
2519
istate->set_bcp_advance (3 );
2545
2520
UPDATE_PC_AND_RETURN (0 ); // I'll be back...
2546
2521
}
@@ -2963,25 +2938,16 @@ BytecodeInterpreter::run(interpreterState istate) {
2963
2938
// (with this note) in anticipation of changing the vm and the tests
2964
2939
// simultaneously.
2965
2940
2966
-
2967
- //
2968
2941
suppress_exit_event = suppress_exit_event || illegal_state_oop () != NULL ;
2969
2942
2943
+ // Whenever JVMTI puts a thread in interp_only_mode, method
2944
+ // entry/exit events are sent for that thread to track stack depth.
2970
2945
2971
-
2972
- #ifdef VM_JVMTI
2973
- if (_jvmti_interp_events) {
2974
- // Whenever JVMTI puts a thread in interp_only_mode, method
2975
- // entry/exit events are sent for that thread to track stack depth.
2976
- if ( !suppress_exit_event && THREAD->is_interp_only_mode () ) {
2977
- {
2978
- // Prevent any HandleMarkCleaner from freeing our live handles
2979
- HandleMark __hm (THREAD);
2980
- CALL_VM_NOCHECK (InterpreterRuntime::post_method_exit (THREAD));
2981
- }
2982
- }
2983
- }
2984
- #endif /* VM_JVMTI */
2946
+ if (JVMTI_ENABLED && !suppress_exit_event && THREAD->is_interp_only_mode ()) {
2947
+ // Prevent any HandleMarkCleaner from freeing our live handles
2948
+ HandleMark __hm (THREAD);
2949
+ CALL_VM_NOCHECK (InterpreterRuntime::post_method_exit (THREAD));
2950
+ }
2985
2951
2986
2952
//
2987
2953
// See if we are returning any exception
@@ -3032,13 +2998,6 @@ BytecodeInterpreter::run(interpreterState istate) {
3032
2998
return ;
3033
2999
}
3034
3000
3035
- /*
3036
- * All the code following this point is only produced once and is not present
3037
- * in the JVMTI version of the interpreter
3038
- */
3039
-
3040
- #ifndef VM_JVMTI
3041
-
3042
3001
// This constructor should only be used to contruct the object to signal
3043
3002
// interpreter initialization. All other instances should be created by
3044
3003
// the frame manager.
@@ -3169,5 +3128,3 @@ extern "C" {
3169
3128
}
3170
3129
}
3171
3130
#endif // PRODUCT
3172
-
3173
- #endif // JVMTI
0 commit comments