96 _next = next;
97 }
98
99 };
100
101 class RTMLockingNamedCounter : public NamedCounter {
102 private:
103 RTMLockingCounters _counters;
104
105 public:
106 RTMLockingNamedCounter(const char *n) :
107 NamedCounter(n, RTMLockingCounter), _counters() {}
108
109 RTMLockingCounters* counters() { return &_counters; }
110 };
111
112 typedef const TypeFunc*(*TypeFunc_generator)();
113
114 class OptoRuntime : public AllStatic {
115 friend class Matcher; // allow access to stub names
116
117 private:
118 // define stubs
119 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);
120
121 // References to generated stubs
122 static address _new_instance_Java;
123 static address _new_array_Java;
124 static address _new_array_nozero_Java;
125 static address _multianewarray2_Java;
126 static address _multianewarray3_Java;
127 static address _multianewarray4_Java;
128 static address _multianewarray5_Java;
129 static address _multianewarrayN_Java;
130 static address _vtable_must_compile_Java;
131 static address _complete_monitor_locking_Java;
132 static address _rethrow_Java;
133 static address _monitor_notify_Java;
134 static address _monitor_notifyAll_Java;
135
136 static address _slow_arraycopy_Java;
137 static address _register_finalizer_Java;
138 #if INCLUDE_JVMTI
139 static address _notify_jvmti_vthread_start;
140 static address _notify_jvmti_vthread_end;
141 static address _notify_jvmti_vthread_mount;
142 static address _notify_jvmti_vthread_unmount;
143 #endif
144
145 //
146 // Implementation of runtime methods
147 // =================================
148
149 // Allocate storage for a Java instance.
150 static void new_instance_C(Klass* instance_klass, JavaThread* current);
151
152 // Allocate storage for a objArray or typeArray
153 static void new_array_C(Klass* array_klass, int len, JavaThread* current);
154 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
155
156 // Allocate storage for a multi-dimensional arrays
157 // Note: needs to be fixed for arbitrary number of dimensions
169
170 // Implicit exception support
171 static void throw_null_exception_C(JavaThread* thread);
172
173 // Exception handling
174 static address handle_exception_C (JavaThread* current);
175 static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
176 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
177 static void deoptimize_caller_frame (JavaThread *thread);
178 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
179 static bool is_deoptimized_caller_frame (JavaThread *thread);
180
181 // CodeBlob support
182 // ===================================================================
183
184 static ExceptionBlob* _exception_blob;
185 static void generate_exception_blob();
186
187 static void register_finalizer(oopDesc* obj, JavaThread* current);
188
189 public:
190
191 static bool is_callee_saved_register(MachRegisterNumbers reg);
192
193 // One time only generate runtime code stubs. Returns true
194 // when runtime stubs have been generated successfully and
195 // false otherwise.
196 static bool generate(ciEnv* env);
197
198 // Returns the name of a stub
199 static const char* stub_name(address entry);
200
201 // access to runtime stubs entry points for java code
202 static address new_instance_Java() { return _new_instance_Java; }
203 static address new_array_Java() { return _new_array_Java; }
204 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
205 static address multianewarray2_Java() { return _multianewarray2_Java; }
206 static address multianewarray3_Java() { return _multianewarray3_Java; }
207 static address multianewarray4_Java() { return _multianewarray4_Java; }
208 static address multianewarray5_Java() { return _multianewarray5_Java; }
209 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
210 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
211 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
212 static address monitor_notify_Java() { return _monitor_notify_Java; }
213 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
214
215 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
216 static address register_finalizer_Java() { return _register_finalizer_Java; }
217 #if INCLUDE_JVMTI
218 static address notify_jvmti_vthread_start() { return _notify_jvmti_vthread_start; }
219 static address notify_jvmti_vthread_end() { return _notify_jvmti_vthread_end; }
220 static address notify_jvmti_vthread_mount() { return _notify_jvmti_vthread_mount; }
221 static address notify_jvmti_vthread_unmount() { return _notify_jvmti_vthread_unmount; }
222 #endif
223
224 static ExceptionBlob* exception_blob() { return _exception_blob; }
225
226 // Implicit exception support
227 static void throw_div0_exception_C (JavaThread* thread);
228 static void throw_stack_overflow_error_C(JavaThread* thread);
229
230 // Exception handling
231 static address rethrow_stub() { return _rethrow_Java; }
232
233
234 // Type functions
235 // ======================================================
236
292 static const TypeFunc* bigIntegerShift_Type();
293
294 static const TypeFunc* vectorizedMismatch_Type();
295
296 static const TypeFunc* ghash_processBlocks_Type();
297 static const TypeFunc* chacha20Block_Type();
298 static const TypeFunc* base64_encodeBlock_Type();
299 static const TypeFunc* base64_decodeBlock_Type();
300 static const TypeFunc* poly1305_processBlocks_Type();
301
302 static const TypeFunc* updateBytesCRC32_Type();
303 static const TypeFunc* updateBytesCRC32C_Type();
304
305 static const TypeFunc* updateBytesAdler32_Type();
306
307 // leaf on stack replacement interpreter accessor types
308 static const TypeFunc* osr_end_Type();
309
310 static const TypeFunc* register_finalizer_Type();
311
312 JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
313 #if INCLUDE_JVMTI
314 static const TypeFunc* notify_jvmti_vthread_Type();
315 #endif
316
317 // Dtrace support
318 static const TypeFunc* dtrace_method_entry_exit_Type();
319 static const TypeFunc* dtrace_object_alloc_Type();
320
321 private:
322 static NamedCounter * volatile _named_counters;
323
324 public:
325 // helper function which creates a named counter labeled with the
326 // if they are available
327 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
328
329 // dumps all the named counters
330 static void print_named_counters();
331
332 };
333
334 #endif // SHARE_OPTO_RUNTIME_HPP
|
96 _next = next;
97 }
98
99 };
100
101 class RTMLockingNamedCounter : public NamedCounter {
102 private:
103 RTMLockingCounters _counters;
104
105 public:
106 RTMLockingNamedCounter(const char *n) :
107 NamedCounter(n, RTMLockingCounter), _counters() {}
108
109 RTMLockingCounters* counters() { return &_counters; }
110 };
111
112 typedef const TypeFunc*(*TypeFunc_generator)();
113
114 class OptoRuntime : public AllStatic {
115 friend class Matcher; // allow access to stub names
116 friend class SCAddressTable;
117 private:
118 // define stubs
119 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);
120
121 // References to generated stubs
122 static address _new_instance_Java;
123 static address _new_array_Java;
124 static address _new_array_nozero_Java;
125 static address _multianewarray2_Java;
126 static address _multianewarray3_Java;
127 static address _multianewarray4_Java;
128 static address _multianewarray5_Java;
129 static address _multianewarrayN_Java;
130 static address _vtable_must_compile_Java;
131 static address _complete_monitor_locking_Java;
132 static address _rethrow_Java;
133 static address _monitor_notify_Java;
134 static address _monitor_notifyAll_Java;
135
136 static address _slow_arraycopy_Java;
137 static address _register_finalizer_Java;
138 static address _class_init_barrier_Java;
139 #if INCLUDE_JVMTI
140 static address _notify_jvmti_vthread_start;
141 static address _notify_jvmti_vthread_end;
142 static address _notify_jvmti_vthread_mount;
143 static address _notify_jvmti_vthread_unmount;
144 #endif
145
146 //
147 // Implementation of runtime methods
148 // =================================
149
150 // Allocate storage for a Java instance.
151 static void new_instance_C(Klass* instance_klass, JavaThread* current);
152
153 // Allocate storage for a objArray or typeArray
154 static void new_array_C(Klass* array_klass, int len, JavaThread* current);
155 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
156
157 // Allocate storage for a multi-dimensional arrays
158 // Note: needs to be fixed for arbitrary number of dimensions
170
171 // Implicit exception support
172 static void throw_null_exception_C(JavaThread* thread);
173
174 // Exception handling
175 static address handle_exception_C (JavaThread* current);
176 static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
177 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
178 static void deoptimize_caller_frame (JavaThread *thread);
179 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
180 static bool is_deoptimized_caller_frame (JavaThread *thread);
181
182 // CodeBlob support
183 // ===================================================================
184
185 static ExceptionBlob* _exception_blob;
186 static void generate_exception_blob();
187
188 static void register_finalizer(oopDesc* obj, JavaThread* current);
189
190 static void class_init_barrier(Klass* k, JavaThread* current);
191 public:
192
193 static bool is_callee_saved_register(MachRegisterNumbers reg);
194
195 // One time only generate runtime code stubs. Returns true
196 // when runtime stubs have been generated successfully and
197 // false otherwise.
198 static bool generate(ciEnv* env);
199
200 // Returns the name of a stub
201 static const char* stub_name(address entry);
202
203 // access to runtime stubs entry points for java code
204 static address new_instance_Java() { return _new_instance_Java; }
205 static address new_array_Java() { return _new_array_Java; }
206 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
207 static address multianewarray2_Java() { return _multianewarray2_Java; }
208 static address multianewarray3_Java() { return _multianewarray3_Java; }
209 static address multianewarray4_Java() { return _multianewarray4_Java; }
210 static address multianewarray5_Java() { return _multianewarray5_Java; }
211 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
212 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
213 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
214 static address monitor_notify_Java() { return _monitor_notify_Java; }
215 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
216
217 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
218 static address register_finalizer_Java() { return _register_finalizer_Java; }
219 static address class_init_barrier_Java() { return _class_init_barrier_Java; }
220 #if INCLUDE_JVMTI
221 static address notify_jvmti_vthread_start() { return _notify_jvmti_vthread_start; }
222 static address notify_jvmti_vthread_end() { return _notify_jvmti_vthread_end; }
223 static address notify_jvmti_vthread_mount() { return _notify_jvmti_vthread_mount; }
224 static address notify_jvmti_vthread_unmount() { return _notify_jvmti_vthread_unmount; }
225 #endif
226
227 static ExceptionBlob* exception_blob() { return _exception_blob; }
228
229 // Implicit exception support
230 static void throw_div0_exception_C (JavaThread* thread);
231 static void throw_stack_overflow_error_C(JavaThread* thread);
232
233 // Exception handling
234 static address rethrow_stub() { return _rethrow_Java; }
235
236
237 // Type functions
238 // ======================================================
239
295 static const TypeFunc* bigIntegerShift_Type();
296
297 static const TypeFunc* vectorizedMismatch_Type();
298
299 static const TypeFunc* ghash_processBlocks_Type();
300 static const TypeFunc* chacha20Block_Type();
301 static const TypeFunc* base64_encodeBlock_Type();
302 static const TypeFunc* base64_decodeBlock_Type();
303 static const TypeFunc* poly1305_processBlocks_Type();
304
305 static const TypeFunc* updateBytesCRC32_Type();
306 static const TypeFunc* updateBytesCRC32C_Type();
307
308 static const TypeFunc* updateBytesAdler32_Type();
309
310 // leaf on stack replacement interpreter accessor types
311 static const TypeFunc* osr_end_Type();
312
313 static const TypeFunc* register_finalizer_Type();
314
315 static const TypeFunc* class_init_barrier_Type();
316
317 JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
318 #if INCLUDE_JVMTI
319 static const TypeFunc* notify_jvmti_vthread_Type();
320 #endif
321
322 // Dtrace support
323 static const TypeFunc* dtrace_method_entry_exit_Type();
324 static const TypeFunc* dtrace_object_alloc_Type();
325
326 private:
327 static NamedCounter * volatile _named_counters;
328
329 public:
330 // helper function which creates a named counter labeled with the
331 // if they are available
332 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
333
334 // dumps all the named counters
335 static void print_named_counters();
336
337 public:
338 static void init_counters();
339 static void print_counters_on(outputStream* st);
340 };
341
342 #endif // SHARE_OPTO_RUNTIME_HPP
|