124 };
125
126 typedef const TypeFunc*(*TypeFunc_generator)();
127
128 class OptoRuntime : public AllStatic {
129 friend class Matcher; // allow access to stub names
130
131 private:
132 // define stubs
133 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
134
135 // References to generated stubs
136 static address _new_instance_Java;
137 static address _new_array_Java;
138 static address _new_array_nozero_Java;
139 static address _multianewarray2_Java;
140 static address _multianewarray3_Java;
141 static address _multianewarray4_Java;
142 static address _multianewarray5_Java;
143 static address _multianewarrayN_Java;
144 static address _g1_wb_pre_Java;
145 static address _g1_wb_post_Java;
146 static address _vtable_must_compile_Java;
147 static address _complete_monitor_locking_Java;
148 static address _rethrow_Java;
149 static address _monitor_notify_Java;
150 static address _monitor_notifyAll_Java;
151
152 static address _slow_arraycopy_Java;
153 static address _register_finalizer_Java;
154
155 # ifdef ENABLE_ZAP_DEAD_LOCALS
156 static address _zap_dead_Java_locals_Java;
157 static address _zap_dead_native_locals_Java;
158 # endif
159
160
161 //
162 // Implementation of runtime methods
163 // =================================
229
230 static bool is_callee_saved_register(MachRegisterNumbers reg);
231
232 // One time only generate runtime code stubs. Returns true
233 // when runtime stubs have been generated successfully and
234 // false otherwise.
235 static bool generate(ciEnv* env);
236
237 // Returns the name of a stub
238 static const char* stub_name(address entry);
239
240 // access to runtime stubs entry points for java code
241 static address new_instance_Java() { return _new_instance_Java; }
242 static address new_array_Java() { return _new_array_Java; }
243 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
244 static address multianewarray2_Java() { return _multianewarray2_Java; }
245 static address multianewarray3_Java() { return _multianewarray3_Java; }
246 static address multianewarray4_Java() { return _multianewarray4_Java; }
247 static address multianewarray5_Java() { return _multianewarray5_Java; }
248 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
249 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; }
250 static address g1_wb_post_Java() { return _g1_wb_post_Java; }
251 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
252 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
253 static address monitor_notify_Java() { return _monitor_notify_Java; }
254 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
255
256 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
257 static address register_finalizer_Java() { return _register_finalizer_Java; }
258
259
260 # ifdef ENABLE_ZAP_DEAD_LOCALS
261 static address zap_dead_locals_stub(bool is_native) { return is_native
262 ? _zap_dead_native_locals_Java
263 : _zap_dead_Java_locals_Java; }
264 static MachNode* node_to_call_zap_dead_locals(Node* n, int block_num, bool is_native);
265 # endif
266
267 static ExceptionBlob* exception_blob() { return _exception_blob; }
268
273 static void throw_div0_exception_C (JavaThread* thread);
274 static void throw_stack_overflow_error_C(JavaThread* thread);
275
276 // Exception handling
277 static address rethrow_stub() { return _rethrow_Java; }
278
279
280 // Type functions
281 // ======================================================
282
283 static const TypeFunc* new_instance_Type(); // object allocation (slow case)
284 static const TypeFunc* new_array_Type (); // [a]newarray (slow case)
285 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
286 static const TypeFunc* multianewarray2_Type(); // multianewarray
287 static const TypeFunc* multianewarray3_Type(); // multianewarray
288 static const TypeFunc* multianewarray4_Type(); // multianewarray
289 static const TypeFunc* multianewarray5_Type(); // multianewarray
290 static const TypeFunc* multianewarrayN_Type(); // multianewarray
291 static const TypeFunc* g1_wb_pre_Type();
292 static const TypeFunc* g1_wb_post_Type();
293 static const TypeFunc* complete_monitor_enter_Type();
294 static const TypeFunc* complete_monitor_exit_Type();
295 static const TypeFunc* monitor_notify_Type();
296 static const TypeFunc* uncommon_trap_Type();
297 static const TypeFunc* athrow_Type();
298 static const TypeFunc* rethrow_Type();
299 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends
300 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
301 static const TypeFunc* modf_Type();
302 static const TypeFunc* l2f_Type();
303 static const TypeFunc* void_long_Type();
304
305 static const TypeFunc* flush_windows_Type();
306
307 // arraycopy routine types
308 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters
309 static const TypeFunc* checkcast_arraycopy_Type();
310 static const TypeFunc* generic_arraycopy_Type();
311 static const TypeFunc* slow_arraycopy_Type(); // the full routine
312
335
336 // leaf on stack replacement interpreter accessor types
337 static const TypeFunc* osr_end_Type();
338
339 // leaf methodData routine types
340 static const TypeFunc* profile_receiver_type_Type();
341
342 // leaf on stack replacement interpreter accessor types
343 static const TypeFunc* fetch_int_Type();
344 static const TypeFunc* fetch_long_Type();
345 static const TypeFunc* fetch_float_Type();
346 static const TypeFunc* fetch_double_Type();
347 static const TypeFunc* fetch_oop_Type();
348 static const TypeFunc* fetch_monitor_Type();
349
350 static const TypeFunc* register_finalizer_Type();
351
352 // Dtrace support
353 static const TypeFunc* dtrace_method_entry_exit_Type();
354 static const TypeFunc* dtrace_object_alloc_Type();
355
356 # ifdef ENABLE_ZAP_DEAD_LOCALS
357 static const TypeFunc* zap_dead_locals_Type();
358 # endif
359
360 private:
361 static NamedCounter * volatile _named_counters;
362
363 public:
364 // helper function which creates a named counter labeled with the
365 // if they are available
366 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
367
368 // dumps all the named counters
369 static void print_named_counters();
370
371 };
372
373 #endif // SHARE_VM_OPTO_RUNTIME_HPP
|
124 };
125
126 typedef const TypeFunc*(*TypeFunc_generator)();
127
128 class OptoRuntime : public AllStatic {
129 friend class Matcher; // allow access to stub names
130
131 private:
132 // define stubs
133 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
134
135 // References to generated stubs
136 static address _new_instance_Java;
137 static address _new_array_Java;
138 static address _new_array_nozero_Java;
139 static address _multianewarray2_Java;
140 static address _multianewarray3_Java;
141 static address _multianewarray4_Java;
142 static address _multianewarray5_Java;
143 static address _multianewarrayN_Java;
144 static address _shenandoah_write_barrier_Java;
145 static address _g1_wb_pre_Java;
146 static address _g1_wb_post_Java;
147 static address _vtable_must_compile_Java;
148 static address _complete_monitor_locking_Java;
149 static address _rethrow_Java;
150 static address _monitor_notify_Java;
151 static address _monitor_notifyAll_Java;
152
153 static address _slow_arraycopy_Java;
154 static address _register_finalizer_Java;
155
156 # ifdef ENABLE_ZAP_DEAD_LOCALS
157 static address _zap_dead_Java_locals_Java;
158 static address _zap_dead_native_locals_Java;
159 # endif
160
161
162 //
163 // Implementation of runtime methods
164 // =================================
230
231 static bool is_callee_saved_register(MachRegisterNumbers reg);
232
233 // One time only generate runtime code stubs. Returns true
234 // when runtime stubs have been generated successfully and
235 // false otherwise.
236 static bool generate(ciEnv* env);
237
238 // Returns the name of a stub
239 static const char* stub_name(address entry);
240
241 // access to runtime stubs entry points for java code
242 static address new_instance_Java() { return _new_instance_Java; }
243 static address new_array_Java() { return _new_array_Java; }
244 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
245 static address multianewarray2_Java() { return _multianewarray2_Java; }
246 static address multianewarray3_Java() { return _multianewarray3_Java; }
247 static address multianewarray4_Java() { return _multianewarray4_Java; }
248 static address multianewarray5_Java() { return _multianewarray5_Java; }
249 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
250 static address shenandoah_write_barrier_Java() { return _shenandoah_write_barrier_Java; }
251 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; }
252 static address g1_wb_post_Java() { return _g1_wb_post_Java; }
253 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
254 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
255 static address monitor_notify_Java() { return _monitor_notify_Java; }
256 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
257
258 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
259 static address register_finalizer_Java() { return _register_finalizer_Java; }
260
261
262 # ifdef ENABLE_ZAP_DEAD_LOCALS
263 static address zap_dead_locals_stub(bool is_native) { return is_native
264 ? _zap_dead_native_locals_Java
265 : _zap_dead_Java_locals_Java; }
266 static MachNode* node_to_call_zap_dead_locals(Node* n, int block_num, bool is_native);
267 # endif
268
269 static ExceptionBlob* exception_blob() { return _exception_blob; }
270
275 static void throw_div0_exception_C (JavaThread* thread);
276 static void throw_stack_overflow_error_C(JavaThread* thread);
277
278 // Exception handling
279 static address rethrow_stub() { return _rethrow_Java; }
280
281
282 // Type functions
283 // ======================================================
284
285 static const TypeFunc* new_instance_Type(); // object allocation (slow case)
286 static const TypeFunc* new_array_Type (); // [a]newarray (slow case)
287 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
288 static const TypeFunc* multianewarray2_Type(); // multianewarray
289 static const TypeFunc* multianewarray3_Type(); // multianewarray
290 static const TypeFunc* multianewarray4_Type(); // multianewarray
291 static const TypeFunc* multianewarray5_Type(); // multianewarray
292 static const TypeFunc* multianewarrayN_Type(); // multianewarray
293 static const TypeFunc* g1_wb_pre_Type();
294 static const TypeFunc* g1_wb_post_Type();
295 static const TypeFunc* shenandoah_clone_barrier_Type();
296 static const TypeFunc* shenandoah_cas_obj_Type();
297 static const TypeFunc* complete_monitor_enter_Type();
298 static const TypeFunc* complete_monitor_exit_Type();
299 static const TypeFunc* monitor_notify_Type();
300 static const TypeFunc* uncommon_trap_Type();
301 static const TypeFunc* athrow_Type();
302 static const TypeFunc* rethrow_Type();
303 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends
304 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
305 static const TypeFunc* modf_Type();
306 static const TypeFunc* l2f_Type();
307 static const TypeFunc* void_long_Type();
308
309 static const TypeFunc* flush_windows_Type();
310
311 // arraycopy routine types
312 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters
313 static const TypeFunc* checkcast_arraycopy_Type();
314 static const TypeFunc* generic_arraycopy_Type();
315 static const TypeFunc* slow_arraycopy_Type(); // the full routine
316
339
340 // leaf on stack replacement interpreter accessor types
341 static const TypeFunc* osr_end_Type();
342
343 // leaf methodData routine types
344 static const TypeFunc* profile_receiver_type_Type();
345
346 // leaf on stack replacement interpreter accessor types
347 static const TypeFunc* fetch_int_Type();
348 static const TypeFunc* fetch_long_Type();
349 static const TypeFunc* fetch_float_Type();
350 static const TypeFunc* fetch_double_Type();
351 static const TypeFunc* fetch_oop_Type();
352 static const TypeFunc* fetch_monitor_Type();
353
354 static const TypeFunc* register_finalizer_Type();
355
356 // Dtrace support
357 static const TypeFunc* dtrace_method_entry_exit_Type();
358 static const TypeFunc* dtrace_object_alloc_Type();
359
360 // Shenandoah support
361 static const TypeFunc* shenandoah_barrier_Type(const Type* type);
362 static const TypeFunc* shenandoah_write_barrier_Type();
363
364 # ifdef ENABLE_ZAP_DEAD_LOCALS
365 static const TypeFunc* zap_dead_locals_Type();
366 # endif
367
368 private:
369 static NamedCounter * volatile _named_counters;
370
371 public:
372 // helper function which creates a named counter labeled with the
373 // if they are available
374 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
375
376 // dumps all the named counters
377 static void print_named_counters();
378
379 };
380
381 #endif // SHARE_VM_OPTO_RUNTIME_HPP
|