192 static const TypeFunc* _poly1305_processBlocks_Type;
193 static const TypeFunc* _intpoly_montgomeryMult_P256_Type;
194 static const TypeFunc* _intpoly_assign_Type;
195 static const TypeFunc* _updateBytesCRC32_Type;
196 static const TypeFunc* _updateBytesCRC32C_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
242 private:
243
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 // ======================================================
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
748 // Note: we do not allow more than 7 node arguments as GraphKit::make_runtime_call only allows 8, and we need
749 // one for the static string
750 static const TypeFunc* debug_print_Type(Node* parm0 = nullptr, Node* parm1 = nullptr,
751 Node* parm2 = nullptr, Node* parm3 = nullptr,
752 Node* parm4 = nullptr, Node* parm5 = nullptr,
753 Node* parm6 = nullptr);
754 #endif // PRODUCT
755
756 private:
757 static NamedCounter * volatile _named_counters;
758
759 public:
760 // helper function which creates a named counter labeled with the
761 // if they are available
762 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
763
764 // dumps all the named counters
765 static void print_named_counters();
766
767 static void initialize_types();
768 };
769
770 #endif // SHARE_OPTO_RUNTIME_HPP
|
192 static const TypeFunc* _poly1305_processBlocks_Type;
193 static const TypeFunc* _intpoly_montgomeryMult_P256_Type;
194 static const TypeFunc* _intpoly_assign_Type;
195 static const TypeFunc* _updateBytesCRC32_Type;
196 static const TypeFunc* _updateBytesCRC32C_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 static address _vtable_must_compile_Java;
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
244 private:
245
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 static void class_init_barrier_C(Klass* k, JavaThread* current);
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(StubId id) {
279 assert(StubInfo::is_c2(id), "not a C2 stub %s", StubInfo::name(id));
280 return StubInfo::name(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 vtable_must_compile_stub() { return _vtable_must_compile_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 class_init_barrier_Java() { return _class_init_barrier_Java; }
300 #if INCLUDE_JVMTI
301 static address notify_jvmti_vthread_start() { return _notify_jvmti_vthread_start; }
302 static address notify_jvmti_vthread_end() { return _notify_jvmti_vthread_end; }
303 static address notify_jvmti_vthread_mount() { return _notify_jvmti_vthread_mount; }
304 static address notify_jvmti_vthread_unmount() { return _notify_jvmti_vthread_unmount; }
305 #endif
306
307 static UncommonTrapBlob* uncommon_trap_blob() { return _uncommon_trap_blob; }
308 static ExceptionBlob* exception_blob() { return _exception_blob; }
309
310 // Implicit exception support
311 static void throw_div0_exception_C (JavaThread* thread);
312 static void throw_stack_overflow_error_C(JavaThread* thread);
313
314 // Exception handling
315 static address rethrow_stub() { return _rethrow_Java; }
316
317
318 // Type functions
319 // ======================================================
712
713
714 // leaf on stack replacement interpreter accessor types
715 static inline const TypeFunc* osr_end_Type() {
716 assert(_osr_end_Type != nullptr, "should be initialized");
717 return _osr_end_Type;
718 }
719
720 static inline const TypeFunc* register_finalizer_Type() {
721 assert(_register_finalizer_Type != nullptr, "should be initialized");
722 return _register_finalizer_Type;
723 }
724
725 #if INCLUDE_JFR
726 static inline const TypeFunc* class_id_load_barrier_Type() {
727 assert(_class_id_load_barrier_Type != nullptr, "should be initialized");
728 return _class_id_load_barrier_Type;
729 }
730 #endif // INCLUDE_JFR
731
732 static const TypeFunc* class_init_barrier_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 // runtime upcalls support
742 static const TypeFunc* runtime_up_call_Type();
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 #ifndef PRODUCT
756 // Signature for runtime calls in debug printing nodes, which depends on which nodes are actually passed
757 // Note: we do not allow more than 7 node arguments as GraphKit::make_runtime_call only allows 8, and we need
758 // one for the static string
759 static const TypeFunc* debug_print_Type(Node* parm0 = nullptr, Node* parm1 = nullptr,
760 Node* parm2 = nullptr, Node* parm3 = nullptr,
761 Node* parm4 = nullptr, Node* parm5 = nullptr,
762 Node* parm6 = nullptr);
763 #endif // PRODUCT
764
765 private:
766 static NamedCounter * volatile _named_counters;
767
768 public:
769 // helper function which creates a named counter labeled with the
770 // if they are available
771 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
772
773 // dumps all the named counters
774 static void print_named_counters();
775
776 public:
777 static void init_counters();
778 static void print_counters_on(outputStream* st);
779 static void initialize_types();
780 };
781
782 #endif // SHARE_OPTO_RUNTIME_HPP
|