< prev index next >

src/hotspot/share/opto/runtime.hpp

Print this page

108   friend class Matcher;  // allow access to stub names
109   friend class AOTCodeAddressTable;
110 
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 
119   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE)
120 
121 #undef C2_BLOB_FIELD_DECLARE
122 #undef C2_STUB_FIELD_NAME
123 #undef C2_STUB_FIELD_DECLARE
124 
125   // static TypeFunc* data members
126   static const TypeFunc* _new_instance_Type;
127   static const TypeFunc* _new_array_Type;

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

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

748 
749   static inline const TypeFunc* vthread_start_final_transition_Type() {
750     return vthread_transition_Type();
751   }
752 
753   static inline const TypeFunc* vthread_start_transition_Type() {
754     return vthread_transition_Type();
755   }
756 
757   static inline const TypeFunc* vthread_end_transition_Type() {
758     return vthread_transition_Type();
759   }
760 
761 #if INCLUDE_JFR
762   static inline const TypeFunc* class_id_load_barrier_Type() {
763     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
764     return _class_id_load_barrier_Type;
765   }
766 #endif // INCLUDE_JFR
767 






768   // Dtrace support. entry and exit probes have the same signature
769   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
770     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
771     return _dtrace_method_entry_exit_Type;
772   }
773 
774   static inline const TypeFunc* dtrace_object_alloc_Type() {
775     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
776     return _dtrace_object_alloc_Type;
777   }
778 
779 #ifndef PRODUCT
780   // Signature for runtime calls in debug printing nodes, which depends on which nodes are actually passed
781   // Note: we do not allow more than 7 node arguments as GraphKit::make_runtime_call only allows 8, and we need
782   // one for the static string
783   static const TypeFunc* debug_print_Type(Node* parm0 = nullptr, Node* parm1 = nullptr,
784                                           Node* parm2 = nullptr, Node* parm3 = nullptr,
785                                           Node* parm4 = nullptr, Node* parm5 = nullptr,
786                                           Node* parm6 = nullptr);
787 #endif // PRODUCT

108   friend class Matcher;  // allow access to stub names
109   friend class AOTCodeAddressTable;
110 
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 
119   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE)
120 
121 #undef C2_BLOB_FIELD_DECLARE
122 #undef C2_STUB_FIELD_NAME
123 #undef C2_STUB_FIELD_DECLARE
124 
125   // static TypeFunc* data members
126   static const TypeFunc* _new_instance_Type;
127   static const TypeFunc* _new_array_Type;
128   static const TypeFunc* _new_array_nozero_Type;
129   static const TypeFunc* _multianewarray2_Type;
130   static const TypeFunc* _multianewarray3_Type;
131   static const TypeFunc* _multianewarray4_Type;
132   static const TypeFunc* _multianewarray5_Type;
133   static const TypeFunc* _multianewarrayN_Type;
134   static const TypeFunc* _complete_monitor_enter_Type;
135   static const TypeFunc* _complete_monitor_exit_Type;
136   static const TypeFunc* _monitor_notify_Type;
137   static const TypeFunc* _uncommon_trap_Type;
138   static const TypeFunc* _athrow_Type;
139   static const TypeFunc* _rethrow_Type;
140   static const TypeFunc* _Math_D_D_Type;
141   static const TypeFunc* _Math_DD_D_Type;
142   static const TypeFunc* _modf_Type;
143   static const TypeFunc* _l2f_Type;
144   static const TypeFunc* _void_long_Type;
145   static const TypeFunc* _void_void_Type;
146   static const TypeFunc* _jfr_write_checkpoint_Type;
147   static const TypeFunc* _flush_windows_Type;
148   static const TypeFunc* _fast_arraycopy_Type;

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

248   // Implicit exception support
249   static void throw_null_exception_C(JavaThread* thread);
250 
251   // Exception handling
252   static address handle_exception_C       (JavaThread* current);
253   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
254   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
255   static void deoptimize_caller_frame     (JavaThread *thread);
256   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
257   static bool is_deoptimized_caller_frame (JavaThread *thread);
258 
259   // CodeBlob support
260   // ===================================================================
261 
262   static UncommonTrapBlob* generate_uncommon_trap_blob(void);
263   static ExceptionBlob* generate_exception_blob();
264 
265   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
266 
267  public:
268   static void load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current);
269   static void store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current);
270 
271   static bool is_callee_saved_register(MachRegisterNumbers reg);
272 
273   // One time only generate runtime code stubs. Returns true
274   // when runtime stubs have been generated successfully and
275   // false otherwise.
276   static bool generate(ciEnv* env);
277 
278   // Returns the name of a stub
279   static const char* stub_name(address entry);
280 
281   // Returns the name associated with a given stub id
282   static const char* stub_name(StubId id) {
283     assert(StubInfo::is_c2(id), "not a C2 stub %s", StubInfo::name(id));
284     return StubInfo::name(id);
285   }
286 
287   // access to runtime stubs entry points for java code
288   static address new_instance_Java()                     { return _new_instance_Java; }
289   static address new_array_Java()                        { return _new_array_Java; }
290   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
291   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
292   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
293   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
294   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
295   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
296   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
297   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
298   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
299 
300   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
301   static address register_finalizer_Java()               { return _register_finalizer_Java; }
302   static address load_unknown_inline_Java()              { return _load_unknown_inline_Java; }
303   static address store_unknown_inline_Java()             { return _store_unknown_inline_Java; }
304 
305   static address vthread_end_first_transition_Java()     { return _vthread_end_first_transition_Java; }
306   static address vthread_start_final_transition_Java()   { return _vthread_start_final_transition_Java; }
307   static address vthread_start_transition_Java()         { return _vthread_start_transition_Java; }
308   static address vthread_end_transition_Java()           { return _vthread_end_transition_Java; }
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() {

754 
755   static inline const TypeFunc* vthread_start_final_transition_Type() {
756     return vthread_transition_Type();
757   }
758 
759   static inline const TypeFunc* vthread_start_transition_Type() {
760     return vthread_transition_Type();
761   }
762 
763   static inline const TypeFunc* vthread_end_transition_Type() {
764     return vthread_transition_Type();
765   }
766 
767 #if INCLUDE_JFR
768   static inline const TypeFunc* class_id_load_barrier_Type() {
769     assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
770     return _class_id_load_barrier_Type;
771   }
772 #endif // INCLUDE_JFR
773 
774   static const TypeFunc* load_unknown_inline_Type();
775   static const TypeFunc* store_unknown_inline_Type();
776 
777   static const TypeFunc* store_inline_type_fields_Type();
778   static const TypeFunc* pack_inline_type_Type();
779 
780   // Dtrace support. entry and exit probes have the same signature
781   static inline const TypeFunc* dtrace_method_entry_exit_Type() {
782     assert(_dtrace_method_entry_exit_Type != nullptr, "should be initialized");
783     return _dtrace_method_entry_exit_Type;
784   }
785 
786   static inline const TypeFunc* dtrace_object_alloc_Type() {
787     assert(_dtrace_object_alloc_Type != nullptr, "should be initialized");
788     return _dtrace_object_alloc_Type;
789   }
790 
791 #ifndef PRODUCT
792   // Signature for runtime calls in debug printing nodes, which depends on which nodes are actually passed
793   // Note: we do not allow more than 7 node arguments as GraphKit::make_runtime_call only allows 8, and we need
794   // one for the static string
795   static const TypeFunc* debug_print_Type(Node* parm0 = nullptr, Node* parm1 = nullptr,
796                                           Node* parm2 = nullptr, Node* parm3 = nullptr,
797                                           Node* parm4 = nullptr, Node* parm5 = nullptr,
798                                           Node* parm6 = nullptr);
799 #endif // PRODUCT
< prev index next >