src/share/vm/c1/c1_Runtime1.cpp

changeset 4142
d8ce2825b193
parent 4037
da91efe96a93
child 4278
070d523b96a7
equal deleted inserted replaced
4122:1b582b1bf7cb 4142:d8ce2825b193
325 NOT_PRODUCT(_new_type_array_slowcase_cnt++;) 325 NOT_PRODUCT(_new_type_array_slowcase_cnt++;)
326 // Note: no handle for klass needed since they are not used 326 // Note: no handle for klass needed since they are not used
327 // anymore after new_typeArray() and no GC can happen before. 327 // anymore after new_typeArray() and no GC can happen before.
328 // (This may have to change if this code changes!) 328 // (This may have to change if this code changes!)
329 assert(klass->is_klass(), "not a class"); 329 assert(klass->is_klass(), "not a class");
330 BasicType elt_type = typeArrayKlass::cast(klass)->element_type(); 330 BasicType elt_type = TypeArrayKlass::cast(klass)->element_type();
331 oop obj = oopFactory::new_typeArray(elt_type, length, CHECK); 331 oop obj = oopFactory::new_typeArray(elt_type, length, CHECK);
332 thread->set_vm_result(obj); 332 thread->set_vm_result(obj);
333 // This is pretty rare but this runtime patch is stressful to deoptimization 333 // This is pretty rare but this runtime patch is stressful to deoptimization
334 // if we deoptimize here so force a deopt to stress the path. 334 // if we deoptimize here so force a deopt to stress the path.
335 if (DeoptimizeALot) { 335 if (DeoptimizeALot) {
344 344
345 // Note: no handle for klass needed since they are not used 345 // Note: no handle for klass needed since they are not used
346 // anymore after new_objArray() and no GC can happen before. 346 // anymore after new_objArray() and no GC can happen before.
347 // (This may have to change if this code changes!) 347 // (This may have to change if this code changes!)
348 assert(array_klass->is_klass(), "not a class"); 348 assert(array_klass->is_klass(), "not a class");
349 Klass* elem_klass = objArrayKlass::cast(array_klass)->element_klass(); 349 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
350 objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK); 350 objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
351 thread->set_vm_result(obj); 351 thread->set_vm_result(obj);
352 // This is pretty rare but this runtime patch is stressful to deoptimization 352 // This is pretty rare but this runtime patch is stressful to deoptimization
353 // if we deoptimize here so force a deopt to stress the path. 353 // if we deoptimize here so force a deopt to stress the path.
354 if (DeoptimizeALot) { 354 if (DeoptimizeALot) {
360 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) 360 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
361 NOT_PRODUCT(_new_multi_array_slowcase_cnt++;) 361 NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
362 362
363 assert(klass->is_klass(), "not a class"); 363 assert(klass->is_klass(), "not a class");
364 assert(rank >= 1, "rank must be nonzero"); 364 assert(rank >= 1, "rank must be nonzero");
365 oop obj = arrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); 365 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
366 thread->set_vm_result(obj); 366 thread->set_vm_result(obj);
367 JRT_END 367 JRT_END
368 368
369 369
370 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id)) 370 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
1232 bs->write_ref_array_pre(dst_addr, length); 1232 bs->write_ref_array_pre(dst_addr, length);
1233 Copy::conjoint_oops_atomic(src_addr, dst_addr, length); 1233 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
1234 bs->write_ref_array((HeapWord*)dst_addr, length); 1234 bs->write_ref_array((HeapWord*)dst_addr, length);
1235 return ac_ok; 1235 return ac_ok;
1236 } else { 1236 } else {
1237 Klass* bound = objArrayKlass::cast(dst->klass())->element_klass(); 1237 Klass* bound = ObjArrayKlass::cast(dst->klass())->element_klass();
1238 Klass* stype = objArrayKlass::cast(src->klass())->element_klass(); 1238 Klass* stype = ObjArrayKlass::cast(src->klass())->element_klass();
1239 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { 1239 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
1240 // Elements are guaranteed to be subtypes, so no check necessary 1240 // Elements are guaranteed to be subtypes, so no check necessary
1241 bs->write_ref_array_pre(dst_addr, length); 1241 bs->write_ref_array_pre(dst_addr, length);
1242 Copy::conjoint_oops_atomic(src_addr, dst_addr, length); 1242 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
1243 bs->write_ref_array((HeapWord*)dst_addr, length); 1243 bs->write_ref_array((HeapWord*)dst_addr, length);
1261 1261
1262 if (length == 0) return ac_ok; 1262 if (length == 0) return ac_ok;
1263 if (src->is_typeArray()) { 1263 if (src->is_typeArray()) {
1264 Klass* const klass_oop = src->klass(); 1264 Klass* const klass_oop = src->klass();
1265 if (klass_oop != dst->klass()) return ac_failed; 1265 if (klass_oop != dst->klass()) return ac_failed;
1266 typeArrayKlass* klass = typeArrayKlass::cast(klass_oop); 1266 TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop);
1267 const int l2es = klass->log2_element_size(); 1267 const int l2es = klass->log2_element_size();
1268 const int ihs = klass->array_header_in_bytes() / wordSize; 1268 const int ihs = klass->array_header_in_bytes() / wordSize;
1269 char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es); 1269 char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es);
1270 char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es); 1270 char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es);
1271 // Potential problem: memmove is not guaranteed to be word atomic 1271 // Potential problem: memmove is not guaranteed to be word atomic

mercurial