comparison src/share/vm/opto/library_call.cpp @ 2468:6c97c830fb6f

Merge
author jrose
date Sat, 09 Apr 2011 21:16:12 -0700
parents 13bc79b5c9c8
children 5d046bf49ce7 66b0e2371912
comparison
equal deleted inserted replaced
2439:0930dc920c18 2468:6c97c830fb6f
1118 Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); 1118 Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
1119 jint target_length = target_array->length(); 1119 jint target_length = target_array->length();
1120 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin)); 1120 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
1121 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot); 1121 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
1122 1122
1123 IdealKit kit(gvn(), control(), merged_memory(), false, true); 1123 IdealKit kit(this, false, true);
1124 #define __ kit. 1124 #define __ kit.
1125 Node* zero = __ ConI(0); 1125 Node* zero = __ ConI(0);
1126 Node* one = __ ConI(1); 1126 Node* one = __ ConI(1);
1127 Node* cache = __ ConI(cache_i); 1127 Node* cache = __ ConI(cache_i);
1128 Node* md2 = __ ConI(md2_i); 1128 Node* md2 = __ ConI(md2_i);
1169 __ bind(outer_loop); 1169 __ bind(outer_loop);
1170 }__ end_loop(); __ dead(i); 1170 }__ end_loop(); __ dead(i);
1171 __ bind(return_); 1171 __ bind(return_);
1172 1172
1173 // Final sync IdealKit and GraphKit. 1173 // Final sync IdealKit and GraphKit.
1174 sync_kit(kit); 1174 final_sync(kit);
1175 Node* result = __ value(rtn); 1175 Node* result = __ value(rtn);
1176 #undef __ 1176 #undef __
1177 C->set_has_loops(true); 1177 C->set_has_loops(true);
1178 return result; 1178 return result;
1179 } 1179 }
2316 } else { 2316 } else {
2317 // We can't tell at compile time if we are storing in the Java heap or outside 2317 // We can't tell at compile time if we are storing in the Java heap or outside
2318 // of it. So we need to emit code to conditionally do the proper type of 2318 // of it. So we need to emit code to conditionally do the proper type of
2319 // store. 2319 // store.
2320 2320
2321 IdealKit ideal(gvn(), control(), merged_memory()); 2321 IdealKit ideal(this);
2322 #define __ ideal. 2322 #define __ ideal.
2323 // QQQ who knows what probability is here?? 2323 // QQQ who knows what probability is here??
2324 __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); { 2324 __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
2325 // Sync IdealKit and graphKit. 2325 // Sync IdealKit and graphKit.
2326 set_all_memory( __ merged_memory()); 2326 sync_kit(ideal);
2327 set_control(__ ctrl());
2328 Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type); 2327 Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
2329 // Update IdealKit memory. 2328 // Update IdealKit memory.
2330 __ set_all_memory(merged_memory()); 2329 __ sync_kit(this);
2331 __ set_ctrl(control());
2332 } __ else_(); { 2330 } __ else_(); {
2333 __ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile); 2331 __ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile);
2334 } __ end_if(); 2332 } __ end_if();
2335 // Final sync IdealKit and GraphKit. 2333 // Final sync IdealKit and GraphKit.
2336 sync_kit(ideal); 2334 final_sync(ideal);
2337 #undef __ 2335 #undef __
2338 } 2336 }
2339 } 2337 }
2340 } 2338 }
2341 2339
4292 push(_gvn.transform(result_val)); 4290 push(_gvn.transform(result_val));
4293 4291
4294 return true; 4292 return true;
4295 } 4293 }
4296 4294
4297
4298 // constants for computing the copy function
4299 enum {
4300 COPYFUNC_UNALIGNED = 0,
4301 COPYFUNC_ALIGNED = 1, // src, dest aligned to HeapWordSize
4302 COPYFUNC_CONJOINT = 0,
4303 COPYFUNC_DISJOINT = 2 // src != dest, or transfer can descend
4304 };
4305
4306 // Note: The condition "disjoint" applies also for overlapping copies
4307 // where an descending copy is permitted (i.e., dest_offset <= src_offset).
4308 static address
4309 select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
4310 int selector =
4311 (aligned ? COPYFUNC_ALIGNED : COPYFUNC_UNALIGNED) +
4312 (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
4313
4314 #define RETURN_STUB(xxx_arraycopy) { \
4315 name = #xxx_arraycopy; \
4316 return StubRoutines::xxx_arraycopy(); }
4317
4318 #define RETURN_STUB_PARM(xxx_arraycopy, parm) { \
4319 name = #xxx_arraycopy; \
4320 return StubRoutines::xxx_arraycopy(parm); }
4321
4322 switch (t) {
4323 case T_BYTE:
4324 case T_BOOLEAN:
4325 switch (selector) {
4326 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_arraycopy);
4327 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_arraycopy);
4328 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_disjoint_arraycopy);
4329 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
4330 }
4331 case T_CHAR:
4332 case T_SHORT:
4333 switch (selector) {
4334 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_arraycopy);
4335 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_arraycopy);
4336 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_disjoint_arraycopy);
4337 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
4338 }
4339 case T_INT:
4340 case T_FLOAT:
4341 switch (selector) {
4342 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_arraycopy);
4343 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_arraycopy);
4344 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_disjoint_arraycopy);
4345 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_disjoint_arraycopy);
4346 }
4347 case T_DOUBLE:
4348 case T_LONG:
4349 switch (selector) {
4350 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_arraycopy);
4351 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_arraycopy);
4352 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_disjoint_arraycopy);
4353 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
4354 }
4355 case T_ARRAY:
4356 case T_OBJECT:
4357 switch (selector) {
4358 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
4359 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
4360 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
4361 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
4362 }
4363 default:
4364 ShouldNotReachHere();
4365 return NULL;
4366 }
4367
4368 #undef RETURN_STUB
4369 #undef RETURN_STUB_PARM
4370 }
4371
4372 //------------------------------basictype2arraycopy---------------------------- 4295 //------------------------------basictype2arraycopy----------------------------
4373 address LibraryCallKit::basictype2arraycopy(BasicType t, 4296 address LibraryCallKit::basictype2arraycopy(BasicType t,
4374 Node* src_offset, 4297 Node* src_offset,
4375 Node* dest_offset, 4298 Node* dest_offset,
4376 bool disjoint_bases, 4299 bool disjoint_bases,
4399 } else if (src_offset == dest_offset && src_offset != NULL) { 4322 } else if (src_offset == dest_offset && src_offset != NULL) {
4400 // This can occur if the offsets are identical non-constants. 4323 // This can occur if the offsets are identical non-constants.
4401 disjoint = true; 4324 disjoint = true;
4402 } 4325 }
4403 4326
4404 return select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized); 4327 return StubRoutines::select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
4405 } 4328 }
4406 4329
4407 4330
4408 //------------------------------inline_arraycopy----------------------- 4331 //------------------------------inline_arraycopy-----------------------
4409 bool LibraryCallKit::inline_arraycopy() { 4332 bool LibraryCallKit::inline_arraycopy() {