comparison src/share/vm/opto/runtime.cpp @ 3805:263247c478c5

7058510: multinewarray with 6 dimensions uncommon traps in server compiler Summary: Pass arguments to runtime via java array for arrays with > 5 dimensions Reviewed-by: never, kvn, jrose, pbk
author iveresov
date Fri, 08 Jul 2011 15:33:03 -0700
parents cba7b5c2d53f
children c124e2e7463e
comparison
equal deleted inserted replaced
3804:faa472957b38 3805:263247c478c5
104 address OptoRuntime::_new_array_Java = NULL; 104 address OptoRuntime::_new_array_Java = NULL;
105 address OptoRuntime::_multianewarray2_Java = NULL; 105 address OptoRuntime::_multianewarray2_Java = NULL;
106 address OptoRuntime::_multianewarray3_Java = NULL; 106 address OptoRuntime::_multianewarray3_Java = NULL;
107 address OptoRuntime::_multianewarray4_Java = NULL; 107 address OptoRuntime::_multianewarray4_Java = NULL;
108 address OptoRuntime::_multianewarray5_Java = NULL; 108 address OptoRuntime::_multianewarray5_Java = NULL;
109 address OptoRuntime::_multianewarrayN_Java = NULL;
109 address OptoRuntime::_g1_wb_pre_Java = NULL; 110 address OptoRuntime::_g1_wb_pre_Java = NULL;
110 address OptoRuntime::_g1_wb_post_Java = NULL; 111 address OptoRuntime::_g1_wb_post_Java = NULL;
111 address OptoRuntime::_vtable_must_compile_Java = NULL; 112 address OptoRuntime::_vtable_must_compile_Java = NULL;
112 address OptoRuntime::_complete_monitor_locking_Java = NULL; 113 address OptoRuntime::_complete_monitor_locking_Java = NULL;
113 address OptoRuntime::_rethrow_Java = NULL; 114 address OptoRuntime::_rethrow_Java = NULL;
152 gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false); 153 gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false);
153 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false); 154 gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false);
154 gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false); 155 gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false);
155 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false); 156 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false);
156 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_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);
157 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false); 159 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false);
158 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false); 160 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false);
159 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false); 161 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false);
160 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true ); 162 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );
161 163
372 oop obj = arrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD); 374 oop obj = arrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
373 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); 375 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
374 thread->set_vm_result(obj); 376 thread->set_vm_result(obj);
375 JRT_END 377 JRT_END
376 378
379 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(klassOopDesc* elem_type, arrayOopDesc* dims, JavaThread *thread))
380 assert(check_compiled_frame(thread), "incorrect caller");
381 assert(oop(elem_type)->is_klass(), "not a class");
382 assert(oop(dims)->is_typeArray(), "not an array");
383
384 ResourceMark rm;
385 jint len = dims->length();
386 assert(len > 0, "Dimensions array should contain data");
387 jint *j_dims = typeArrayOop(dims)->int_at_addr(0);
388 jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
389 Copy::conjoint_jints_atomic(j_dims, c_dims, len);
390
391 oop obj = arrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
392 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
393 thread->set_vm_result(obj);
394 JRT_END
395
396
377 const TypeFunc *OptoRuntime::new_instance_Type() { 397 const TypeFunc *OptoRuntime::new_instance_Type() {
378 // create input type (domain) 398 // create input type (domain)
379 const Type **fields = TypeTuple::fields(1); 399 const Type **fields = TypeTuple::fields(1);
380 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated 400 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
381 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); 401 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
450 return multianewarray_Type(4); 470 return multianewarray_Type(4);
451 } 471 }
452 472
453 const TypeFunc *OptoRuntime::multianewarray5_Type() { 473 const TypeFunc *OptoRuntime::multianewarray5_Type() {
454 return multianewarray_Type(5); 474 return multianewarray_Type(5);
475 }
476
477 const TypeFunc *OptoRuntime::multianewarrayN_Type() {
478 // create input type (domain)
479 const Type **fields = TypeTuple::fields(2);
480 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
481 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // array of dim sizes
482 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
483
484 // create result type (range)
485 fields = TypeTuple::fields(1);
486 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
487 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
488
489 return TypeFunc::make(domain, range);
455 } 490 }
456 491
457 const TypeFunc *OptoRuntime::g1_wb_pre_Type() { 492 const TypeFunc *OptoRuntime::g1_wb_pre_Type() {
458 const Type **fields = TypeTuple::fields(2); 493 const Type **fields = TypeTuple::fields(2);
459 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value 494 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value