< prev index next >

src/hotspot/share/opto/runtime.hpp

Print this page

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

125   static const TypeFunc* _multianewarray2_Type;
126   static const TypeFunc* _multianewarray3_Type;
127   static const TypeFunc* _multianewarray4_Type;
128   static const TypeFunc* _multianewarray5_Type;
129   static const TypeFunc* _multianewarrayN_Type;
130   static const TypeFunc* _complete_monitor_enter_Type;
131   static const TypeFunc* _complete_monitor_exit_Type;
132   static const TypeFunc* _monitor_notify_Type;
133   static const TypeFunc* _uncommon_trap_Type;
134   static const TypeFunc* _athrow_Type;
135   static const TypeFunc* _rethrow_Type;
136   static const TypeFunc* _Math_D_D_Type;
137   static const TypeFunc* _Math_DD_D_Type;
138   static const TypeFunc* _modf_Type;
139   static const TypeFunc* _l2f_Type;
140   static const TypeFunc* _void_long_Type;
141   static const TypeFunc* _void_void_Type;
142   static const TypeFunc* _jfr_write_checkpoint_Type;
143   static const TypeFunc* _flush_windows_Type;
144   static const TypeFunc* _fast_arraycopy_Type;

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

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


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


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

323   }
324 
325   static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
326 
327   static inline const TypeFunc* multianewarray2_Type() {
328     assert(_multianewarray2_Type != nullptr, "should be initialized");
329     return _multianewarray2_Type;
330   }
331 
332   static inline const TypeFunc* multianewarray3_Type() {
333     assert(_multianewarray3_Type != nullptr, "should be initialized");
334     return _multianewarray3_Type;
335   }
336 
337   static inline const TypeFunc* multianewarray4_Type() {
338     assert(_multianewarray4_Type != nullptr, "should be initialized");
339     return _multianewarray4_Type;
340   }
341 
342   static inline const TypeFunc* multianewarray5_Type() {

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






722 #if INCLUDE_JVMTI
723   static inline const TypeFunc* notify_jvmti_vthread_Type() {
724     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
725     return _notify_jvmti_vthread_Type;
726   }
727 #endif
728 
729   // Dtrace support. entry and exit probes have the same signature
730   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
731     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
732     return _dtrace_method_entry_exit_Type;
733   }
734 
735   static inline const TypeFunc* dtrace_object_alloc_Type() {
736     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
737     return _dtrace_object_alloc_Type;
738   }
739 
740  private:
741  static NamedCounter * volatile _named_counters;

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

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

239   // Implicit exception support
240   static void throw_null_exception_C(JavaThread* thread);
241 
242   // Exception handling
243   static address handle_exception_C       (JavaThread* current);
244   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
245   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
246   static void deoptimize_caller_frame     (JavaThread *thread);
247   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
248   static bool is_deoptimized_caller_frame (JavaThread *thread);
249 
250   // CodeBlob support
251   // ===================================================================
252 
253   static UncommonTrapBlob* generate_uncommon_trap_blob(void);
254   static ExceptionBlob* generate_exception_blob();
255 
256   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
257 
258  public:
259   static void load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current);
260   static void store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current);
261 
262   static bool is_callee_saved_register(MachRegisterNumbers reg);
263 
264   // One time only generate runtime code stubs. Returns true
265   // when runtime stubs have been generated successfully and
266   // false otherwise.
267   static bool generate(ciEnv* env);
268 
269   // Returns the name of a stub
270   static const char* stub_name(address entry);
271 
272   // Returns the name associated with a given stub id
273   static const char* stub_name(StubId id) {
274     assert(StubInfo::is_c2(id), "not a C2 stub %s", StubInfo::name(id));
275     return StubInfo::name(id);
276   }
277 
278   // access to runtime stubs entry points for java code
279   static address new_instance_Java()                     { return _new_instance_Java; }
280   static address new_array_Java()                        { return _new_array_Java; }
281   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
282   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
283   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
284   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
285   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
286   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
287   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
288   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
289   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
290 
291   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
292   static address register_finalizer_Java()               { return _register_finalizer_Java; }
293   static address load_unknown_inline_Java()              { return _load_unknown_inline_Java; }
294   static address store_unknown_inline_Java()             { return _store_unknown_inline_Java; }
295 #if INCLUDE_JVMTI
296   static address notify_jvmti_vthread_start()            { return _notify_jvmti_vthread_start; }
297   static address notify_jvmti_vthread_end()              { return _notify_jvmti_vthread_end; }
298   static address notify_jvmti_vthread_mount()            { return _notify_jvmti_vthread_mount; }
299   static address notify_jvmti_vthread_unmount()          { return _notify_jvmti_vthread_unmount; }
300 #endif
301 
302   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
303   static ExceptionBlob*    exception_blob()                      { return _exception_blob; }
304 
305   // Implicit exception support
306   static void throw_div0_exception_C      (JavaThread* thread);
307   static void throw_stack_overflow_error_C(JavaThread* thread);
308 
309   // Exception handling
310   static address rethrow_stub()             { return _rethrow_Java; }
311 
312 
313   // Type functions
314   // ======================================================
315 
316   static inline const TypeFunc* new_instance_Type() {
317     assert(_new_instance_Type != nullptr, "should be initialized");
318     return _new_instance_Type;
319   }
320 
321   static inline const TypeFunc* new_array_Type() {
322     assert(_new_array_Type != nullptr, "should be initialized");
323     return _new_array_Type;
324   }
325 
326   static inline const TypeFunc* new_array_nozero_Type() {
327     assert(_new_array_nozero_Type != nullptr, "should be initialized");
328     return _new_array_nozero_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   static const TypeFunc* load_unknown_inline_Type();
729   static const TypeFunc* store_unknown_inline_Type();
730 
731   static const TypeFunc* store_inline_type_fields_Type();
732   static const TypeFunc* pack_inline_type_Type();
733 
734 #if INCLUDE_JVMTI
735   static inline const TypeFunc* notify_jvmti_vthread_Type() {
736     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
737     return _notify_jvmti_vthread_Type;
738   }
739 #endif
740 
741   // Dtrace support. entry and exit probes have the same signature
742   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
743     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
744     return _dtrace_method_entry_exit_Type;
745   }
746 
747   static inline const TypeFunc* dtrace_object_alloc_Type() {
748     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
749     return _dtrace_object_alloc_Type;
750   }
751 
752  private:
753  static NamedCounter * volatile _named_counters;
< prev index next >