< prev index next >

src/hotspot/share/opto/runtime.hpp

Print this page

111  private:
112   // declare opto stub address/blob holder static fields
113 #define C2_BLOB_FIELD_DECLARE(name, type) \
114   static type*       BLOB_FIELD_NAME(name);
115 #define C2_STUB_FIELD_NAME(name) _ ## name ## _Java
116 #define C2_STUB_FIELD_DECLARE(name, f, t, r) \
117   static address     C2_STUB_FIELD_NAME(name) ;
118 #define C2_JVMTI_STUB_FIELD_DECLARE(name) \
119   static address     STUB_FIELD_NAME(name);
120 
121   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE, C2_JVMTI_STUB_FIELD_DECLARE)
122 
123 #undef C2_BLOB_FIELD_DECLARE
124 #undef C2_STUB_FIELD_NAME
125 #undef C2_STUB_FIELD_DECLARE
126 #undef C2_JVMTI_STUB_FIELD_DECLARE
127 
128   // static TypeFunc* data members
129   static const TypeFunc* _new_instance_Type;
130   static const TypeFunc* _new_array_Type;

131   static const TypeFunc* _multianewarray2_Type;
132   static const TypeFunc* _multianewarray3_Type;
133   static const TypeFunc* _multianewarray4_Type;
134   static const TypeFunc* _multianewarray5_Type;
135   static const TypeFunc* _multianewarrayN_Type;
136   static const TypeFunc* _complete_monitor_enter_Type;
137   static const TypeFunc* _complete_monitor_exit_Type;
138   static const TypeFunc* _monitor_notify_Type;
139   static const TypeFunc* _uncommon_trap_Type;
140   static const TypeFunc* _athrow_Type;
141   static const TypeFunc* _rethrow_Type;
142   static const TypeFunc* _Math_D_D_Type;
143   static const TypeFunc* _Math_DD_D_Type;
144   static const TypeFunc* _modf_Type;
145   static const TypeFunc* _l2f_Type;
146   static const TypeFunc* _void_long_Type;
147   static const TypeFunc* _void_void_Type;
148   static const TypeFunc* _jfr_write_checkpoint_Type;
149   static const TypeFunc* _flush_windows_Type;
150   static const TypeFunc* _fast_arraycopy_Type;

197   static const TypeFunc* _updateBytesAdler32_Type;
198   static const TypeFunc* _osr_end_Type;
199   static const TypeFunc* _register_finalizer_Type;
200 #if INCLUDE_JFR
201   static const TypeFunc* _class_id_load_barrier_Type;
202 #endif // INCLUDE_JFR
203 #if INCLUDE_JVMTI
204   static const TypeFunc* _notify_jvmti_vthread_Type;
205 #endif // INCLUDE_JVMTI
206   static const TypeFunc* _dtrace_method_entry_exit_Type;
207   static const TypeFunc* _dtrace_object_alloc_Type;
208 
209   // define stubs
210   static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, StubId stub_id, int is_fancy_jump, bool pass_tls, bool return_pc);
211 
212   //
213   // Implementation of runtime methods
214   // =================================
215 
216   // Allocate storage for a Java instance.
217   static void new_instance_C(Klass* instance_klass, JavaThread* current);
218 
219   // Allocate storage for a objArray or typeArray
220   static void new_array_C(Klass* array_klass, int len, JavaThread* current);
221   static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
222 
223   // Allocate storage for a multi-dimensional arrays
224   // Note: needs to be fixed for arbitrary number of dimensions
225   static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread* current);
226   static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread* current);
227   static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread* current);
228   static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread* current);
229   static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread* current);
230 
231   // local methods passed as arguments to stub generator that forward
232   // control to corresponding JRT methods of SharedRuntime
233   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
234                                oopDesc* dest, jint dest_pos,
235                                jint length, JavaThread* thread);
236   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
237 
238 public:
239   static void monitor_notify_C(oopDesc* obj, JavaThread* current);
240   static void monitor_notifyAll_C(oopDesc* obj, JavaThread* current);

244   // Implicit exception support
245   static void throw_null_exception_C(JavaThread* thread);
246 
247   // Exception handling
248   static address handle_exception_C       (JavaThread* current);
249   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
250   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
251   static void deoptimize_caller_frame     (JavaThread *thread);
252   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
253   static bool is_deoptimized_caller_frame (JavaThread *thread);
254 
255   // CodeBlob support
256   // ===================================================================
257 
258   static UncommonTrapBlob* generate_uncommon_trap_blob(void);
259   static ExceptionBlob* generate_exception_blob();
260 
261   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
262 
263  public:


264 
265   static bool is_callee_saved_register(MachRegisterNumbers reg);
266 
267   // One time only generate runtime code stubs. Returns true
268   // when runtime stubs have been generated successfully and
269   // false otherwise.
270   static bool generate(ciEnv* env);
271 
272   // Returns the name of a stub
273   static const char* stub_name(address entry);
274 
275   // Returns the name associated with a given stub id
276   static const char* stub_name(StubId id) {
277     assert(StubInfo::is_c2(id), "not a C2 stub %s", StubInfo::name(id));
278     return StubInfo::name(id);
279   }
280 
281   // access to runtime stubs entry points for java code
282   static address new_instance_Java()                     { return _new_instance_Java; }
283   static address new_array_Java()                        { return _new_array_Java; }
284   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
285   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
286   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
287   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
288   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
289   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
290   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
291   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
292   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
293 
294   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
295   static address register_finalizer_Java()               { return _register_finalizer_Java; }


296 #if INCLUDE_JVMTI
297   static address notify_jvmti_vthread_start()            { return _notify_jvmti_vthread_start; }
298   static address notify_jvmti_vthread_end()              { return _notify_jvmti_vthread_end; }
299   static address notify_jvmti_vthread_mount()            { return _notify_jvmti_vthread_mount; }
300   static address notify_jvmti_vthread_unmount()          { return _notify_jvmti_vthread_unmount; }
301 #endif
302 
303   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
304   static ExceptionBlob*    exception_blob()                      { return _exception_blob; }
305 
306   // Implicit exception support
307   static void throw_div0_exception_C      (JavaThread* thread);
308   static void throw_stack_overflow_error_C(JavaThread* thread);
309 
310   // Exception handling
311   static address rethrow_stub()             { return _rethrow_Java; }
312 
313 
314   // Type functions
315   // ======================================================
316 
317   static inline const TypeFunc* new_instance_Type() {
318     assert(_new_instance_Type != nullptr, "should be initialized");
319     return _new_instance_Type;
320   }
321 
322   static inline const TypeFunc* new_array_Type() {
323     assert(_new_array_Type != nullptr, "should be initialized");
324     return _new_array_Type;
325   }
326 
327   static inline const TypeFunc* new_array_nozero_Type() {
328     return new_array_Type();

329   }
330 
331   static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
332 
333   static inline const TypeFunc* multianewarray2_Type() {
334     assert(_multianewarray2_Type != nullptr, "should be initialized");
335     return _multianewarray2_Type;
336   }
337 
338   static inline const TypeFunc* multianewarray3_Type() {
339     assert(_multianewarray3_Type != nullptr, "should be initialized");
340     return _multianewarray3_Type;
341   }
342 
343   static inline const TypeFunc* multianewarray4_Type() {
344     assert(_multianewarray4_Type != nullptr, "should be initialized");
345     return _multianewarray4_Type;
346   }
347 
348   static inline const TypeFunc* multianewarray5_Type() {

708 
709 
710   // leaf on stack replacement interpreter accessor types
711   static inline const TypeFunc* osr_end_Type() {
712     assert(_osr_end_Type != nullptr, "should be initialized");
713     return _osr_end_Type;
714   }
715 
716   static inline const TypeFunc* register_finalizer_Type() {
717     assert(_register_finalizer_Type != nullptr, "should be initialized");
718     return _register_finalizer_Type;
719   }
720 
721 #if INCLUDE_JFR
722   static inline const TypeFunc* class_id_load_barrier_Type() {
723     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
724     return _class_id_load_barrier_Type;
725   }
726 #endif // INCLUDE_JFR
727 






728 #if INCLUDE_JVMTI
729   static inline const TypeFunc* notify_jvmti_vthread_Type() {
730     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
731     return _notify_jvmti_vthread_Type;
732   }
733 #endif
734 
735   // Dtrace support. entry and exit probes have the same signature
736   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
737     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
738     return _dtrace_method_entry_exit_Type;
739   }
740 
741   static inline const TypeFunc* dtrace_object_alloc_Type() {
742     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
743     return _dtrace_object_alloc_Type;
744   }
745 
746 #ifndef PRODUCT
747   // Signature for runtime calls in debug printing nodes, which depends on which nodes are actually passed

111  private:
112   // declare opto stub address/blob holder static fields
113 #define C2_BLOB_FIELD_DECLARE(name, type) \
114   static type*       BLOB_FIELD_NAME(name);
115 #define C2_STUB_FIELD_NAME(name) _ ## name ## _Java
116 #define C2_STUB_FIELD_DECLARE(name, f, t, r) \
117   static address     C2_STUB_FIELD_NAME(name) ;
118 #define C2_JVMTI_STUB_FIELD_DECLARE(name) \
119   static address     STUB_FIELD_NAME(name);
120 
121   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE, C2_JVMTI_STUB_FIELD_DECLARE)
122 
123 #undef C2_BLOB_FIELD_DECLARE
124 #undef C2_STUB_FIELD_NAME
125 #undef C2_STUB_FIELD_DECLARE
126 #undef C2_JVMTI_STUB_FIELD_DECLARE
127 
128   // static TypeFunc* data members
129   static const TypeFunc* _new_instance_Type;
130   static const TypeFunc* _new_array_Type;
131   static const TypeFunc* _new_array_nozero_Type;
132   static const TypeFunc* _multianewarray2_Type;
133   static const TypeFunc* _multianewarray3_Type;
134   static const TypeFunc* _multianewarray4_Type;
135   static const TypeFunc* _multianewarray5_Type;
136   static const TypeFunc* _multianewarrayN_Type;
137   static const TypeFunc* _complete_monitor_enter_Type;
138   static const TypeFunc* _complete_monitor_exit_Type;
139   static const TypeFunc* _monitor_notify_Type;
140   static const TypeFunc* _uncommon_trap_Type;
141   static const TypeFunc* _athrow_Type;
142   static const TypeFunc* _rethrow_Type;
143   static const TypeFunc* _Math_D_D_Type;
144   static const TypeFunc* _Math_DD_D_Type;
145   static const TypeFunc* _modf_Type;
146   static const TypeFunc* _l2f_Type;
147   static const TypeFunc* _void_long_Type;
148   static const TypeFunc* _void_void_Type;
149   static const TypeFunc* _jfr_write_checkpoint_Type;
150   static const TypeFunc* _flush_windows_Type;
151   static const TypeFunc* _fast_arraycopy_Type;

198   static const TypeFunc* _updateBytesAdler32_Type;
199   static const TypeFunc* _osr_end_Type;
200   static const TypeFunc* _register_finalizer_Type;
201 #if INCLUDE_JFR
202   static const TypeFunc* _class_id_load_barrier_Type;
203 #endif // INCLUDE_JFR
204 #if INCLUDE_JVMTI
205   static const TypeFunc* _notify_jvmti_vthread_Type;
206 #endif // INCLUDE_JVMTI
207   static const TypeFunc* _dtrace_method_entry_exit_Type;
208   static const TypeFunc* _dtrace_object_alloc_Type;
209 
210   // define stubs
211   static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, StubId stub_id, int is_fancy_jump, bool pass_tls, bool return_pc);
212 
213   //
214   // Implementation of runtime methods
215   // =================================
216 
217   // Allocate storage for a Java instance.
218   static void new_instance_C(Klass* instance_klass, bool is_larval, JavaThread* current);
219 
220   // Allocate storage for a objArray or typeArray
221   static void new_array_C(Klass* array_klass, int len, oopDesc* init_val, JavaThread* current);
222   static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
223 
224   // Allocate storage for a multi-dimensional arrays
225   // Note: needs to be fixed for arbitrary number of dimensions
226   static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread* current);
227   static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread* current);
228   static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread* current);
229   static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread* current);
230   static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread* current);
231 
232   // local methods passed as arguments to stub generator that forward
233   // control to corresponding JRT methods of SharedRuntime
234   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
235                                oopDesc* dest, jint dest_pos,
236                                jint length, JavaThread* thread);
237   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
238 
239 public:
240   static void monitor_notify_C(oopDesc* obj, JavaThread* current);
241   static void monitor_notifyAll_C(oopDesc* obj, JavaThread* current);

245   // Implicit exception support
246   static void throw_null_exception_C(JavaThread* thread);
247 
248   // Exception handling
249   static address handle_exception_C       (JavaThread* current);
250   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
251   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
252   static void deoptimize_caller_frame     (JavaThread *thread);
253   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
254   static bool is_deoptimized_caller_frame (JavaThread *thread);
255 
256   // CodeBlob support
257   // ===================================================================
258 
259   static UncommonTrapBlob* generate_uncommon_trap_blob(void);
260   static ExceptionBlob* generate_exception_blob();
261 
262   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
263 
264  public:
265   static void load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current);
266   static void store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current);
267 
268   static bool is_callee_saved_register(MachRegisterNumbers reg);
269 
270   // One time only generate runtime code stubs. Returns true
271   // when runtime stubs have been generated successfully and
272   // false otherwise.
273   static bool generate(ciEnv* env);
274 
275   // Returns the name of a stub
276   static const char* stub_name(address entry);
277 
278   // Returns the name associated with a given stub id
279   static const char* stub_name(StubId id) {
280     assert(StubInfo::is_c2(id), "not a C2 stub %s", StubInfo::name(id));
281     return StubInfo::name(id);
282   }
283 
284   // access to runtime stubs entry points for java code
285   static address new_instance_Java()                     { return _new_instance_Java; }
286   static address new_array_Java()                        { return _new_array_Java; }
287   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
288   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
289   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
290   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
291   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
292   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
293   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
294   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
295   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
296 
297   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
298   static address register_finalizer_Java()               { return _register_finalizer_Java; }
299   static address load_unknown_inline_Java()              { return _load_unknown_inline_Java; }
300   static address store_unknown_inline_Java()             { return _store_unknown_inline_Java; }
301 #if INCLUDE_JVMTI
302   static address notify_jvmti_vthread_start()            { return _notify_jvmti_vthread_start; }
303   static address notify_jvmti_vthread_end()              { return _notify_jvmti_vthread_end; }
304   static address notify_jvmti_vthread_mount()            { return _notify_jvmti_vthread_mount; }
305   static address notify_jvmti_vthread_unmount()          { return _notify_jvmti_vthread_unmount; }
306 #endif
307 
308   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
309   static ExceptionBlob*    exception_blob()                      { return _exception_blob; }
310 
311   // Implicit exception support
312   static void throw_div0_exception_C      (JavaThread* thread);
313   static void throw_stack_overflow_error_C(JavaThread* thread);
314 
315   // Exception handling
316   static address rethrow_stub()             { return _rethrow_Java; }
317 
318 
319   // Type functions
320   // ======================================================
321 
322   static inline const TypeFunc* new_instance_Type() {
323     assert(_new_instance_Type != nullptr, "should be initialized");
324     return _new_instance_Type;
325   }
326 
327   static inline const TypeFunc* new_array_Type() {
328     assert(_new_array_Type != nullptr, "should be initialized");
329     return _new_array_Type;
330   }
331 
332   static inline const TypeFunc* new_array_nozero_Type() {
333     assert(_new_array_nozero_Type != nullptr, "should be initialized");
334     return _new_array_nozero_Type;
335   }
336 
337   static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
338 
339   static inline const TypeFunc* multianewarray2_Type() {
340     assert(_multianewarray2_Type != nullptr, "should be initialized");
341     return _multianewarray2_Type;
342   }
343 
344   static inline const TypeFunc* multianewarray3_Type() {
345     assert(_multianewarray3_Type != nullptr, "should be initialized");
346     return _multianewarray3_Type;
347   }
348 
349   static inline const TypeFunc* multianewarray4_Type() {
350     assert(_multianewarray4_Type != nullptr, "should be initialized");
351     return _multianewarray4_Type;
352   }
353 
354   static inline const TypeFunc* multianewarray5_Type() {

714 
715 
716   // leaf on stack replacement interpreter accessor types
717   static inline const TypeFunc* osr_end_Type() {
718     assert(_osr_end_Type != nullptr, "should be initialized");
719     return _osr_end_Type;
720   }
721 
722   static inline const TypeFunc* register_finalizer_Type() {
723     assert(_register_finalizer_Type != nullptr, "should be initialized");
724     return _register_finalizer_Type;
725   }
726 
727 #if INCLUDE_JFR
728   static inline const TypeFunc* class_id_load_barrier_Type() {
729     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
730     return _class_id_load_barrier_Type;
731   }
732 #endif // INCLUDE_JFR
733 
734   static const TypeFunc* load_unknown_inline_Type();
735   static const TypeFunc* store_unknown_inline_Type();
736 
737   static const TypeFunc* store_inline_type_fields_Type();
738   static const TypeFunc* pack_inline_type_Type();
739 
740 #if INCLUDE_JVMTI
741   static inline const TypeFunc* notify_jvmti_vthread_Type() {
742     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
743     return _notify_jvmti_vthread_Type;
744   }
745 #endif
746 
747   // Dtrace support. entry and exit probes have the same signature
748   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
749     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
750     return _dtrace_method_entry_exit_Type;
751   }
752 
753   static inline const TypeFunc* dtrace_object_alloc_Type() {
754     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
755     return _dtrace_object_alloc_Type;
756   }
757 
758 #ifndef PRODUCT
759   // Signature for runtime calls in debug printing nodes, which depends on which nodes are actually passed
< prev index next >