< prev index next >

src/hotspot/share/opto/runtime.hpp

Print this page

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

137   static const TypeFunc* _multianewarray2_Type;
138   static const TypeFunc* _multianewarray3_Type;
139   static const TypeFunc* _multianewarray4_Type;
140   static const TypeFunc* _multianewarray5_Type;
141   static const TypeFunc* _multianewarrayN_Type;
142   static const TypeFunc* _complete_monitor_enter_Type;
143   static const TypeFunc* _complete_monitor_exit_Type;
144   static const TypeFunc* _monitor_notify_Type;
145   static const TypeFunc* _uncommon_trap_Type;
146   static const TypeFunc* _athrow_Type;
147   static const TypeFunc* _rethrow_Type;
148   static const TypeFunc* _Math_D_D_Type;
149   static const TypeFunc* _Math_DD_D_Type;
150   static const TypeFunc* _modf_Type;
151   static const TypeFunc* _l2f_Type;
152   static const TypeFunc* _void_long_Type;
153   static const TypeFunc* _void_void_Type;
154   static const TypeFunc* _jfr_write_checkpoint_Type;
155   static const TypeFunc* _flush_windows_Type;
156   static const TypeFunc* _fast_arraycopy_Type;

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

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


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


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

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

671 
672 
673   // leaf on stack replacement interpreter accessor types
674   static inline const TypeFunc* osr_end_Type() {
675     assert(_osr_end_Type != nullptr, "should be initialized");
676     return _osr_end_Type;
677   }
678 
679   static inline const TypeFunc* register_finalizer_Type() {
680     assert(_register_finalizer_Type != nullptr, "should be initialized");
681     return _register_finalizer_Type;
682   }
683 
684 #if INCLUDE_JFR
685   static inline const TypeFunc* class_id_load_barrier_Type() {
686     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
687     return _class_id_load_barrier_Type;
688   }
689 #endif // INCLUDE_JFR
690 






691 #if INCLUDE_JVMTI
692   static inline const TypeFunc* notify_jvmti_vthread_Type() {
693     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
694     return _notify_jvmti_vthread_Type;
695   }
696 #endif
697 
698   // Dtrace support. entry and exit probes have the same signature
699   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
700     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
701     return _dtrace_method_entry_exit_Type;
702   }
703 
704   static inline const TypeFunc* dtrace_object_alloc_Type() {
705     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
706     return _dtrace_object_alloc_Type;
707   }
708 
709  private:
710  static NamedCounter * volatile _named_counters;

117  private:
118   // declare opto stub address/blob holder static fields
119 #define C2_BLOB_FIELD_DECLARE(name, type) \
120   static type        BLOB_FIELD_NAME(name);
121 #define C2_STUB_FIELD_NAME(name) _ ## name ## _Java
122 #define C2_STUB_FIELD_DECLARE(name, f, t, r) \
123   static address     C2_STUB_FIELD_NAME(name) ;
124 #define C2_JVMTI_STUB_FIELD_DECLARE(name) \
125   static address     STUB_FIELD_NAME(name);
126 
127   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE, C2_JVMTI_STUB_FIELD_DECLARE)
128 
129 #undef C2_BLOB_FIELD_DECLARE
130 #undef C2_STUB_FIELD_NAME
131 #undef C2_STUB_FIELD_DECLARE
132 #undef C2_JVMTI_STUB_FIELD_DECLARE
133 
134   // static TypeFunc* data members
135   static const TypeFunc* _new_instance_Type;
136   static const TypeFunc* _new_array_Type;
137   static const TypeFunc* _new_array_nozero_Type;
138   static const TypeFunc* _multianewarray2_Type;
139   static const TypeFunc* _multianewarray3_Type;
140   static const TypeFunc* _multianewarray4_Type;
141   static const TypeFunc* _multianewarray5_Type;
142   static const TypeFunc* _multianewarrayN_Type;
143   static const TypeFunc* _complete_monitor_enter_Type;
144   static const TypeFunc* _complete_monitor_exit_Type;
145   static const TypeFunc* _monitor_notify_Type;
146   static const TypeFunc* _uncommon_trap_Type;
147   static const TypeFunc* _athrow_Type;
148   static const TypeFunc* _rethrow_Type;
149   static const TypeFunc* _Math_D_D_Type;
150   static const TypeFunc* _Math_DD_D_Type;
151   static const TypeFunc* _modf_Type;
152   static const TypeFunc* _l2f_Type;
153   static const TypeFunc* _void_long_Type;
154   static const TypeFunc* _void_void_Type;
155   static const TypeFunc* _jfr_write_checkpoint_Type;
156   static const TypeFunc* _flush_windows_Type;
157   static const TypeFunc* _fast_arraycopy_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   // Stub names indexed by sharedStubId
210   static const char *_stub_names[];
211 
212   // define stubs
213   static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, int is_fancy_jump, bool pass_tls, bool return_pc);
214 
215   //
216   // Implementation of runtime methods
217   // =================================
218 
219   // Allocate storage for a Java instance.
220   static void new_instance_C(Klass* instance_klass, bool is_larval, JavaThread* current);
221 
222   // Allocate storage for a objArray or typeArray
223   static void new_array_C(Klass* array_klass, int len, oopDesc* init_val, JavaThread* current);
224   static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
225 
226   // Allocate storage for a multi-dimensional arrays
227   // Note: needs to be fixed for arbitrary number of dimensions
228   static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread* current);
229   static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread* current);
230   static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread* current);
231   static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread* current);
232   static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread* current);
233 
234   // local methods passed as arguments to stub generator that forward
235   // control to corresponding JRT methods of SharedRuntime
236   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
237                                oopDesc* dest, jint dest_pos,
238                                jint length, JavaThread* thread);
239   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
240 
241 public:
242   static void monitor_notify_C(oopDesc* obj, JavaThread* current);
243   static void monitor_notifyAll_C(oopDesc* obj, JavaThread* current);

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

677 
678 
679   // leaf on stack replacement interpreter accessor types
680   static inline const TypeFunc* osr_end_Type() {
681     assert(_osr_end_Type != nullptr, "should be initialized");
682     return _osr_end_Type;
683   }
684 
685   static inline const TypeFunc* register_finalizer_Type() {
686     assert(_register_finalizer_Type != nullptr, "should be initialized");
687     return _register_finalizer_Type;
688   }
689 
690 #if INCLUDE_JFR
691   static inline const TypeFunc* class_id_load_barrier_Type() {
692     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
693     return _class_id_load_barrier_Type;
694   }
695 #endif // INCLUDE_JFR
696 
697   static const TypeFunc* load_unknown_inline_Type();
698   static const TypeFunc* store_unknown_inline_Type();
699 
700   static const TypeFunc* store_inline_type_fields_Type();
701   static const TypeFunc* pack_inline_type_Type();
702 
703 #if INCLUDE_JVMTI
704   static inline const TypeFunc* notify_jvmti_vthread_Type() {
705     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
706     return _notify_jvmti_vthread_Type;
707   }
708 #endif
709 
710   // Dtrace support. entry and exit probes have the same signature
711   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
712     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
713     return _dtrace_method_entry_exit_Type;
714   }
715 
716   static inline const TypeFunc* dtrace_object_alloc_Type() {
717     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
718     return _dtrace_object_alloc_Type;
719   }
720 
721  private:
722  static NamedCounter * volatile _named_counters;
< prev index next >