85 #endif
86 #ifdef TARGET_ARCH_MODEL_ppc
87 # include "adfiles/ad_ppc.hpp"
88 #endif
89
90
91 // For debugging purposes:
92 // To force FullGCALot inside a runtime function, add the following two lines
93 //
94 // Universe::release_fullgc_alot_dummy();
95 // MarkSweep::invoke(0, "Debugging");
96 //
97 // At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000
98
99
100
101
102 // Compiled code entry points
103 address OptoRuntime::_new_instance_Java = NULL;
104 address OptoRuntime::_new_array_Java = NULL;
105 address OptoRuntime::_multianewarray2_Java = NULL;
106 address OptoRuntime::_multianewarray3_Java = NULL;
107 address OptoRuntime::_multianewarray4_Java = NULL;
108 address OptoRuntime::_multianewarray5_Java = NULL;
109 address OptoRuntime::_multianewarrayN_Java = NULL;
110 address OptoRuntime::_g1_wb_pre_Java = NULL;
111 address OptoRuntime::_g1_wb_post_Java = NULL;
112 address OptoRuntime::_vtable_must_compile_Java = NULL;
113 address OptoRuntime::_complete_monitor_locking_Java = NULL;
114 address OptoRuntime::_rethrow_Java = NULL;
115
116 address OptoRuntime::_slow_arraycopy_Java = NULL;
117 address OptoRuntime::_register_finalizer_Java = NULL;
118
119 # ifdef ENABLE_ZAP_DEAD_LOCALS
120 address OptoRuntime::_zap_dead_Java_locals_Java = NULL;
121 address OptoRuntime::_zap_dead_native_locals_Java = NULL;
122 # endif
123
124 ExceptionBlob* OptoRuntime::_exception_blob;
134 assert(caller.is_compiled_frame(), "not being called from compiled like code");
135 #endif /* ASSERT */
136 return true;
137 }
138 #endif
139
140
141 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
142 var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc)
143
144 void OptoRuntime::generate(ciEnv* env) {
145
146 generate_exception_blob();
147
148 // Note: tls: Means fetching the return oop out of the thread-local storage
149 //
150 // variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc
151 // -------------------------------------------------------------------------------------------------------------------------------
152 gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false);
153 gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false);
154 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false);
155 gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false);
156 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false);
157 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false);
158 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
159 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false);
160 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false);
161 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false);
162 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );
163
164 gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false);
165 gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false);
166
167 # ifdef ENABLE_ZAP_DEAD_LOCALS
168 gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false );
169 gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false );
170 # endif
171
172 }
173
278 #endif
279 assert(check_compiled_frame(thread), "incorrect caller");
280
281 // Scavenge and allocate an instance.
282 oop result;
283
284 if (Klass::cast(array_type)->oop_is_typeArray()) {
285 // The oopFactory likes to work with the element type.
286 // (We could bypass the oopFactory, since it doesn't add much value.)
287 BasicType elem_type = typeArrayKlass::cast(array_type)->element_type();
288 result = oopFactory::new_typeArray(elem_type, len, THREAD);
289 } else {
290 // Although the oopFactory likes to work with the elem_type,
291 // the compiler prefers the array_type, since it must already have
292 // that latter value in hand for the fast path.
293 klassOopDesc* elem_type = objArrayKlass::cast(array_type)->element_klass();
294 result = oopFactory::new_objArray(elem_type, len, THREAD);
295 }
296
297 // Pass oops back through thread local storage. Our apparent type to Java
298 // is that we return an oop, but we can block on exit from this routine and
299 // a GC can trash the oop in C's return register. The generated stub will
300 // fetch the oop from TLS after any possible GC.
301 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
302 thread->set_vm_result(result);
303 JRT_BLOCK_END;
304
305 if (GraphKit::use_ReduceInitialCardMarks()) {
306 // inform GC that we won't do card marks for initializing writes.
307 new_store_pre_barrier(thread);
308 }
309 JRT_END
310
311 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
312
313 // multianewarray for 2 dimensions
314 JRT_ENTRY(void, OptoRuntime::multianewarray2_C(klassOopDesc* elem_type, int len1, int len2, JavaThread *thread))
315 #ifndef PRODUCT
316 SharedRuntime::_multi2_ctr++; // multianewarray for 1 dimension
317 #endif
|
85 #endif
86 #ifdef TARGET_ARCH_MODEL_ppc
87 # include "adfiles/ad_ppc.hpp"
88 #endif
89
90
91 // For debugging purposes:
92 // To force FullGCALot inside a runtime function, add the following two lines
93 //
94 // Universe::release_fullgc_alot_dummy();
95 // MarkSweep::invoke(0, "Debugging");
96 //
97 // At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000
98
99
100
101
102 // Compiled code entry points
103 address OptoRuntime::_new_instance_Java = NULL;
104 address OptoRuntime::_new_array_Java = NULL;
105 address OptoRuntime::_new_array_nozero_Java = NULL;
106 address OptoRuntime::_multianewarray2_Java = NULL;
107 address OptoRuntime::_multianewarray3_Java = NULL;
108 address OptoRuntime::_multianewarray4_Java = NULL;
109 address OptoRuntime::_multianewarray5_Java = NULL;
110 address OptoRuntime::_multianewarrayN_Java = NULL;
111 address OptoRuntime::_g1_wb_pre_Java = NULL;
112 address OptoRuntime::_g1_wb_post_Java = NULL;
113 address OptoRuntime::_vtable_must_compile_Java = NULL;
114 address OptoRuntime::_complete_monitor_locking_Java = NULL;
115 address OptoRuntime::_rethrow_Java = NULL;
116
117 address OptoRuntime::_slow_arraycopy_Java = NULL;
118 address OptoRuntime::_register_finalizer_Java = NULL;
119
120 # ifdef ENABLE_ZAP_DEAD_LOCALS
121 address OptoRuntime::_zap_dead_Java_locals_Java = NULL;
122 address OptoRuntime::_zap_dead_native_locals_Java = NULL;
123 # endif
124
125 ExceptionBlob* OptoRuntime::_exception_blob;
135 assert(caller.is_compiled_frame(), "not being called from compiled like code");
136 #endif /* ASSERT */
137 return true;
138 }
139 #endif
140
141
142 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
143 var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc)
144
145 void OptoRuntime::generate(ciEnv* env) {
146
147 generate_exception_blob();
148
149 // Note: tls: Means fetching the return oop out of the thread-local storage
150 //
151 // variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc
152 // -------------------------------------------------------------------------------------------------------------------------------
153 gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false);
154 gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false);
155 gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true , false, false);
156 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false);
157 gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false);
158 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false);
159 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false);
160 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
161 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false);
162 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false);
163 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false);
164 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );
165
166 gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false);
167 gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false);
168
169 # ifdef ENABLE_ZAP_DEAD_LOCALS
170 gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false );
171 gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false );
172 # endif
173
174 }
175
280 #endif
281 assert(check_compiled_frame(thread), "incorrect caller");
282
283 // Scavenge and allocate an instance.
284 oop result;
285
286 if (Klass::cast(array_type)->oop_is_typeArray()) {
287 // The oopFactory likes to work with the element type.
288 // (We could bypass the oopFactory, since it doesn't add much value.)
289 BasicType elem_type = typeArrayKlass::cast(array_type)->element_type();
290 result = oopFactory::new_typeArray(elem_type, len, THREAD);
291 } else {
292 // Although the oopFactory likes to work with the elem_type,
293 // the compiler prefers the array_type, since it must already have
294 // that latter value in hand for the fast path.
295 klassOopDesc* elem_type = objArrayKlass::cast(array_type)->element_klass();
296 result = oopFactory::new_objArray(elem_type, len, THREAD);
297 }
298
299 // Pass oops back through thread local storage. Our apparent type to Java
300 // is that we return an oop, but we can block on exit from this routine and
301 // a GC can trash the oop in C's return register. The generated stub will
302 // fetch the oop from TLS after any possible GC.
303 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
304 thread->set_vm_result(result);
305 JRT_BLOCK_END;
306
307 if (GraphKit::use_ReduceInitialCardMarks()) {
308 // inform GC that we won't do card marks for initializing writes.
309 new_store_pre_barrier(thread);
310 }
311 JRT_END
312
313 // array allocation without zeroing
314 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(klassOopDesc* array_type, int len, JavaThread *thread))
315 JRT_BLOCK;
316 #ifndef PRODUCT
317 SharedRuntime::_new_array_ctr++; // new array requires GC
318 #endif
319 assert(check_compiled_frame(thread), "incorrect caller");
320
321 // Scavenge and allocate an instance.
322 oop result;
323
324 assert(Klass::cast(array_type)->oop_is_typeArray(), "should be called only for type array");
325 // The oopFactory likes to work with the element type.
326 BasicType elem_type = typeArrayKlass::cast(array_type)->element_type();
327 result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD);
328
329 // Pass oops back through thread local storage. Our apparent type to Java
330 // is that we return an oop, but we can block on exit from this routine and
331 // a GC can trash the oop in C's return register. The generated stub will
332 // fetch the oop from TLS after any possible GC.
333 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
334 thread->set_vm_result(result);
335 JRT_BLOCK_END;
336
337 if (GraphKit::use_ReduceInitialCardMarks()) {
338 // inform GC that we won't do card marks for initializing writes.
339 new_store_pre_barrier(thread);
340 }
341 JRT_END
342
343 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array.
344
345 // multianewarray for 2 dimensions
346 JRT_ENTRY(void, OptoRuntime::multianewarray2_C(klassOopDesc* elem_type, int len1, int len2, JavaThread *thread))
347 #ifndef PRODUCT
348 SharedRuntime::_multi2_ctr++; // multianewarray for 1 dimension
349 #endif
|