39 class AdapterFingerPrint;
40 class vframeStream;
41
42 // Runtime is the base class for various runtime interfaces
43 // (InterpreterRuntime, CompilerRuntime, etc.). It provides
44 // shared functionality such as exception forwarding (C++ to
45 // Java exceptions), locking/unlocking mechanisms, statistical
46 // information, etc.
47
48 class SharedRuntime: AllStatic {
49 friend class VMStructs;
50
51 private:
52 static methodHandle resolve_sub_helper(JavaThread *thread,
53 bool is_virtual,
54 bool is_optimized, TRAPS);
55
56 // Shared stub locations
57
58 static RuntimeStub* _wrong_method_blob;
59 static RuntimeStub* _ic_miss_blob;
60 static RuntimeStub* _resolve_opt_virtual_call_blob;
61 static RuntimeStub* _resolve_virtual_call_blob;
62 static RuntimeStub* _resolve_static_call_blob;
63
64 static DeoptimizationBlob* _deopt_blob;
65
66 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob;
67 static SafepointBlob* _polling_page_safepoint_handler_blob;
68 static SafepointBlob* _polling_page_return_handler_blob;
69
70 #ifdef COMPILER2
71 static UncommonTrapBlob* _uncommon_trap_blob;
72 #endif // COMPILER2
73
74 #ifndef PRODUCT
75 // Counters
76 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable)
77 #endif // !PRODUCT
78
189 static void throw_NullPointerException(JavaThread* thread);
190 static void throw_NullPointerException_at_call(JavaThread* thread);
191 static void throw_StackOverflowError(JavaThread* thread);
192 static address continuation_for_implicit_exception(JavaThread* thread,
193 address faulting_pc,
194 ImplicitExceptionKind exception_kind);
195
196 // Shared stub locations
197 static address get_poll_stub(address pc);
198
199 static address get_ic_miss_stub() {
200 assert(_ic_miss_blob!= NULL, "oops");
201 return _ic_miss_blob->entry_point();
202 }
203
204 static address get_handle_wrong_method_stub() {
205 assert(_wrong_method_blob!= NULL, "oops");
206 return _wrong_method_blob->entry_point();
207 }
208
209 #ifdef COMPILER2
210 static void generate_uncommon_trap_blob(void);
211 static UncommonTrapBlob* uncommon_trap_blob() { return _uncommon_trap_blob; }
212 #endif // COMPILER2
213
214 static address get_resolve_opt_virtual_call_stub(){
215 assert(_resolve_opt_virtual_call_blob != NULL, "oops");
216 return _resolve_opt_virtual_call_blob->entry_point();
217 }
218 static address get_resolve_virtual_call_stub() {
219 assert(_resolve_virtual_call_blob != NULL, "oops");
220 return _resolve_virtual_call_blob->entry_point();
221 }
222 static address get_resolve_static_call_stub() {
223 assert(_resolve_static_call_blob != NULL, "oops");
224 return _resolve_static_call_blob->entry_point();
225 }
226
227 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; }
228 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; }
464 // exists. Patch the caller so he no longer calls into the interpreter.
465 static void fixup_callers_callsite(Method* moop, address ret_pc);
466
467 // Slow-path Locking and Unlocking
468 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
469 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock);
470
471 // Resolving of calls
472 static address resolve_static_call_C (JavaThread *thread);
473 static address resolve_virtual_call_C (JavaThread *thread);
474 static address resolve_opt_virtual_call_C(JavaThread *thread);
475
476 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
477 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
478 oopDesc* dest, jint dest_pos,
479 jint length, JavaThread* thread);
480
481 // handle ic miss with caller being compiled code
482 // wrong method handling (inline cache misses, zombie methods)
483 static address handle_wrong_method(JavaThread* thread);
484 static address handle_wrong_method_ic_miss(JavaThread* thread);
485
486 #ifndef PRODUCT
487
488 // Collect and print inline cache miss statistics
489 private:
490 enum { maxICmiss_count = 100 };
491 static int _ICmiss_index; // length of IC miss histogram
492 static int _ICmiss_count[maxICmiss_count]; // miss counts
493 static address _ICmiss_at[maxICmiss_count]; // miss addresses
494 static void trace_ic_miss(address at);
495
496 public:
497 static int _monitor_enter_ctr; // monitor enter slow
498 static int _monitor_exit_ctr; // monitor exit slow
499 static int _throw_null_ctr; // throwing a null-pointer exception
500 static int _ic_miss_ctr; // total # of IC misses
501 static int _wrong_method_ctr;
502 static int _resolve_static_ctr;
503 static int _resolve_virtual_ctr;
|
39 class AdapterFingerPrint;
40 class vframeStream;
41
42 // Runtime is the base class for various runtime interfaces
43 // (InterpreterRuntime, CompilerRuntime, etc.). It provides
44 // shared functionality such as exception forwarding (C++ to
45 // Java exceptions), locking/unlocking mechanisms, statistical
46 // information, etc.
47
48 class SharedRuntime: AllStatic {
49 friend class VMStructs;
50
51 private:
52 static methodHandle resolve_sub_helper(JavaThread *thread,
53 bool is_virtual,
54 bool is_optimized, TRAPS);
55
56 // Shared stub locations
57
58 static RuntimeStub* _wrong_method_blob;
59 static RuntimeStub* _wrong_method_abstract_blob;
60 static RuntimeStub* _ic_miss_blob;
61 static RuntimeStub* _resolve_opt_virtual_call_blob;
62 static RuntimeStub* _resolve_virtual_call_blob;
63 static RuntimeStub* _resolve_static_call_blob;
64
65 static DeoptimizationBlob* _deopt_blob;
66
67 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob;
68 static SafepointBlob* _polling_page_safepoint_handler_blob;
69 static SafepointBlob* _polling_page_return_handler_blob;
70
71 #ifdef COMPILER2
72 static UncommonTrapBlob* _uncommon_trap_blob;
73 #endif // COMPILER2
74
75 #ifndef PRODUCT
76 // Counters
77 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable)
78 #endif // !PRODUCT
79
190 static void throw_NullPointerException(JavaThread* thread);
191 static void throw_NullPointerException_at_call(JavaThread* thread);
192 static void throw_StackOverflowError(JavaThread* thread);
193 static address continuation_for_implicit_exception(JavaThread* thread,
194 address faulting_pc,
195 ImplicitExceptionKind exception_kind);
196
197 // Shared stub locations
198 static address get_poll_stub(address pc);
199
200 static address get_ic_miss_stub() {
201 assert(_ic_miss_blob!= NULL, "oops");
202 return _ic_miss_blob->entry_point();
203 }
204
205 static address get_handle_wrong_method_stub() {
206 assert(_wrong_method_blob!= NULL, "oops");
207 return _wrong_method_blob->entry_point();
208 }
209
210 static address get_handle_wrong_method_abstract_stub() {
211 assert(_wrong_method_abstract_blob!= NULL, "oops");
212 return _wrong_method_abstract_blob->entry_point();
213 }
214
215 #ifdef COMPILER2
216 static void generate_uncommon_trap_blob(void);
217 static UncommonTrapBlob* uncommon_trap_blob() { return _uncommon_trap_blob; }
218 #endif // COMPILER2
219
220 static address get_resolve_opt_virtual_call_stub(){
221 assert(_resolve_opt_virtual_call_blob != NULL, "oops");
222 return _resolve_opt_virtual_call_blob->entry_point();
223 }
224 static address get_resolve_virtual_call_stub() {
225 assert(_resolve_virtual_call_blob != NULL, "oops");
226 return _resolve_virtual_call_blob->entry_point();
227 }
228 static address get_resolve_static_call_stub() {
229 assert(_resolve_static_call_blob != NULL, "oops");
230 return _resolve_static_call_blob->entry_point();
231 }
232
233 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; }
234 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; }
470 // exists. Patch the caller so he no longer calls into the interpreter.
471 static void fixup_callers_callsite(Method* moop, address ret_pc);
472
473 // Slow-path Locking and Unlocking
474 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
475 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock);
476
477 // Resolving of calls
478 static address resolve_static_call_C (JavaThread *thread);
479 static address resolve_virtual_call_C (JavaThread *thread);
480 static address resolve_opt_virtual_call_C(JavaThread *thread);
481
482 // arraycopy, the non-leaf version. (See StubRoutines for all the leaf calls.)
483 static void slow_arraycopy_C(oopDesc* src, jint src_pos,
484 oopDesc* dest, jint dest_pos,
485 jint length, JavaThread* thread);
486
487 // handle ic miss with caller being compiled code
488 // wrong method handling (inline cache misses, zombie methods)
489 static address handle_wrong_method(JavaThread* thread);
490 static address handle_wrong_method_abstract(JavaThread* thread);
491 static address handle_wrong_method_ic_miss(JavaThread* thread);
492
493 #ifndef PRODUCT
494
495 // Collect and print inline cache miss statistics
496 private:
497 enum { maxICmiss_count = 100 };
498 static int _ICmiss_index; // length of IC miss histogram
499 static int _ICmiss_count[maxICmiss_count]; // miss counts
500 static address _ICmiss_at[maxICmiss_count]; // miss addresses
501 static void trace_ic_miss(address at);
502
503 public:
504 static int _monitor_enter_ctr; // monitor enter slow
505 static int _monitor_exit_ctr; // monitor exit slow
506 static int _throw_null_ctr; // throwing a null-pointer exception
507 static int _ic_miss_ctr; // total # of IC misses
508 static int _wrong_method_ctr;
509 static int _resolve_static_ctr;
510 static int _resolve_virtual_ctr;
|