< 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;

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

253   // Implicit exception support
254   static void throw_null_exception_C(JavaThread* thread);
255 
256   // Exception handling
257   static address handle_exception_C       (JavaThread* current);
258   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
259   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
260   static void deoptimize_caller_frame     (JavaThread *thread);
261   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
262   static bool is_deoptimized_caller_frame (JavaThread *thread);
263 
264   // CodeBlob support
265   // ===================================================================
266 
267   static UncommonTrapBlob* generate_uncommon_trap_blob(void);
268   static ExceptionBlob* generate_exception_blob();
269 
270   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
271 
272  public:


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


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

338   }
339 
340   static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
341 
342   static inline const TypeFunc* multianewarray2_Type() {
343     assert(_multianewarray2_Type != nullptr, "should be initialized");
344     return _multianewarray2_Type;
345   }
346 
347   static inline const TypeFunc* multianewarray3_Type() {
348     assert(_multianewarray3_Type != nullptr, "should be initialized");
349     return _multianewarray3_Type;
350   }
351 
352   static inline const TypeFunc* multianewarray4_Type() {
353     assert(_multianewarray4_Type != nullptr, "should be initialized");
354     return _multianewarray4_Type;
355   }
356 
357   static inline const TypeFunc* multianewarray5_Type() {

717 
718 
719   // leaf on stack replacement interpreter accessor types
720   static inline const TypeFunc* osr_end_Type() {
721     assert(_osr_end_Type != nullptr, "should be initialized");
722     return _osr_end_Type;
723   }
724 
725   static inline const TypeFunc* register_finalizer_Type() {
726     assert(_register_finalizer_Type != nullptr, "should be initialized");
727     return _register_finalizer_Type;
728   }
729 
730 #if INCLUDE_JFR
731   static inline const TypeFunc* class_id_load_barrier_Type() {
732     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
733     return _class_id_load_barrier_Type;
734   }
735 #endif // INCLUDE_JFR
736 






737 #if INCLUDE_JVMTI
738   static inline const TypeFunc* notify_jvmti_vthread_Type() {
739     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
740     return _notify_jvmti_vthread_Type;
741   }
742 #endif
743 
744   // Dtrace support. entry and exit probes have the same signature
745   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
746     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
747     return _dtrace_method_entry_exit_Type;
748   }
749 
750   static inline const TypeFunc* dtrace_object_alloc_Type() {
751     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
752     return _dtrace_object_alloc_Type;
753   }
754 
755  private:
756  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;

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

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

723 
724 
725   // leaf on stack replacement interpreter accessor types
726   static inline const TypeFunc* osr_end_Type() {
727     assert(_osr_end_Type != nullptr, "should be initialized");
728     return _osr_end_Type;
729   }
730 
731   static inline const TypeFunc* register_finalizer_Type() {
732     assert(_register_finalizer_Type != nullptr, "should be initialized");
733     return _register_finalizer_Type;
734   }
735 
736 #if INCLUDE_JFR
737   static inline const TypeFunc* class_id_load_barrier_Type() {
738     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
739     return _class_id_load_barrier_Type;
740   }
741 #endif // INCLUDE_JFR
742 
743   static const TypeFunc* load_unknown_inline_Type();
744   static const TypeFunc* store_unknown_inline_Type();
745 
746   static const TypeFunc* store_inline_type_fields_Type();
747   static const TypeFunc* pack_inline_type_Type();
748 
749 #if INCLUDE_JVMTI
750   static inline const TypeFunc* notify_jvmti_vthread_Type() {
751     assert(_notify_jvmti_vthread_Type != nullptr, "should be initialized");
752     return _notify_jvmti_vthread_Type;
753   }
754 #endif
755 
756   // Dtrace support. entry and exit probes have the same signature
757   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
758     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
759     return _dtrace_method_entry_exit_Type;
760   }
761 
762   static inline const TypeFunc* dtrace_object_alloc_Type() {
763     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
764     return _dtrace_object_alloc_Type;
765   }
766 
767  private:
768  static NamedCounter * volatile _named_counters;
< prev index next >