comparison src/share/vm/opto/runtime.cpp @ 3961:a92cdbac8b9e

7081933: Use zeroing elimination optimization for large array Summary: Don't zero new typeArray during runtime call if the allocation is followed by arraycopy into it. Reviewed-by: twisti
author kvn
date Mon, 26 Sep 2011 10:24:05 -0700
parents c124e2e7463e
children ec5ce9326985
comparison
equal deleted inserted replaced
3960:f08d439fab8c 3961:a92cdbac8b9e
100 100
101 101
102 // Compiled code entry points 102 // Compiled code entry points
103 address OptoRuntime::_new_instance_Java = NULL; 103 address OptoRuntime::_new_instance_Java = NULL;
104 address OptoRuntime::_new_array_Java = NULL; 104 address OptoRuntime::_new_array_Java = NULL;
105 address OptoRuntime::_new_array_nozero_Java = NULL;
105 address OptoRuntime::_multianewarray2_Java = NULL; 106 address OptoRuntime::_multianewarray2_Java = NULL;
106 address OptoRuntime::_multianewarray3_Java = NULL; 107 address OptoRuntime::_multianewarray3_Java = NULL;
107 address OptoRuntime::_multianewarray4_Java = NULL; 108 address OptoRuntime::_multianewarray4_Java = NULL;
108 address OptoRuntime::_multianewarray5_Java = NULL; 109 address OptoRuntime::_multianewarray5_Java = NULL;
109 address OptoRuntime::_multianewarrayN_Java = NULL; 110 address OptoRuntime::_multianewarrayN_Java = NULL;
149 // 150 //
150 // variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc 151 // variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc
151 // ------------------------------------------------------------------------------------------------------------------------------- 152 // -------------------------------------------------------------------------------------------------------------------------------
152 gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false); 153 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, _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);
154 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false); 156 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); 157 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); 158 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); 159 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); 160 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
291 // the compiler prefers the array_type, since it must already have 293 // the compiler prefers the array_type, since it must already have
292 // that latter value in hand for the fast path. 294 // that latter value in hand for the fast path.
293 klassOopDesc* elem_type = objArrayKlass::cast(array_type)->element_klass(); 295 klassOopDesc* elem_type = objArrayKlass::cast(array_type)->element_klass();
294 result = oopFactory::new_objArray(elem_type, len, THREAD); 296 result = oopFactory::new_objArray(elem_type, len, THREAD);
295 } 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);
296 328
297 // Pass oops back through thread local storage. Our apparent type to Java 329 // 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 330 // 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 331 // 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. 332 // fetch the oop from TLS after any possible GC.