2454 // exception paths do not take memory state from the memory barrier, 2455 // so there's no problems making a strong assert about mixing users 2456 // of safe & unsafe memory. 2457 if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder); 2458 2459 if (!is_store) { 2460 Node* p = NULL; 2461 // Try to constant fold a load from a constant field 2462 ciField* field = alias_type->field(); 2463 if (heap_base_oop != top() && field != NULL && field->is_constant() && !mismatched) { 2464 // final or stable field 2465 p = make_constant_from_field(field, heap_base_oop); 2466 } 2467 if (p == NULL) { 2468 // To be valid, unsafe loads may depend on other conditions than 2469 // the one that guards them: pin the Load node 2470 p = make_load(control(), adr, value_type, type, adr_type, mo, LoadNode::Pinned, requires_atomic_access, unaligned, mismatched); 2471 // load value 2472 switch (type) { 2473 case T_BOOLEAN: 2474 case T_CHAR: 2475 case T_BYTE: 2476 case T_SHORT: 2477 case T_INT: 2478 case T_LONG: 2479 case T_FLOAT: 2480 case T_DOUBLE: 2481 break; 2482 case T_OBJECT: 2483 if (need_read_barrier) { 2484 // We do not require a mem bar inside pre_barrier if need_mem_bar 2485 // is set: the barriers would be emitted by us. 2486 insert_pre_barrier(heap_base_oop, offset, p, !need_mem_bar); 2487 } 2488 break; 2489 case T_ADDRESS: 2490 // Cast to an int type. 2491 p = _gvn.transform(new CastP2XNode(NULL, p)); 2492 p = ConvX2UL(p); 2493 break; | 2454 // exception paths do not take memory state from the memory barrier, 2455 // so there's no problems making a strong assert about mixing users 2456 // of safe & unsafe memory. 2457 if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder); 2458 2459 if (!is_store) { 2460 Node* p = NULL; 2461 // Try to constant fold a load from a constant field 2462 ciField* field = alias_type->field(); 2463 if (heap_base_oop != top() && field != NULL && field->is_constant() && !mismatched) { 2464 // final or stable field 2465 p = make_constant_from_field(field, heap_base_oop); 2466 } 2467 if (p == NULL) { 2468 // To be valid, unsafe loads may depend on other conditions than 2469 // the one that guards them: pin the Load node 2470 p = make_load(control(), adr, value_type, type, adr_type, mo, LoadNode::Pinned, requires_atomic_access, unaligned, mismatched); 2471 // load value 2472 switch (type) { 2473 case T_BOOLEAN: 2474 { 2475 // Normalize the value returned by getBoolean in the following cases 2476 if (mismatched || 2477 heap_base_oop == top() || // - heap_base_oop is NULL or 2478 (can_access_non_heap && alias_type->field() == NULL) // - heap_base_oop is potentially NULL 2479 // and the unsafe access is made to large offset 2480 // (i.e., larger than the maximum offset necessary for any 2481 // field access) 2482 ) { 2483 IdealKit ideal = IdealKit(this); 2484 #define __ ideal. 2485 IdealVariable normalized_result(ideal); 2486 __ declarations_done(); 2487 __ set(normalized_result, p); 2488 __ if_then(p, BoolTest::ne, ideal.ConI(0)); 2489 __ set(normalized_result, ideal.ConI(1)); 2490 ideal.end_if(); 2491 final_sync(ideal); 2492 p = __ value(normalized_result); 2493 #undef __ 2494 } 2495 } 2496 case T_CHAR: 2497 case T_BYTE: 2498 case T_SHORT: 2499 case T_INT: 2500 case T_LONG: 2501 case T_FLOAT: 2502 case T_DOUBLE: 2503 break; 2504 case T_OBJECT: 2505 if (need_read_barrier) { 2506 // We do not require a mem bar inside pre_barrier if need_mem_bar 2507 // is set: the barriers would be emitted by us. 2508 insert_pre_barrier(heap_base_oop, offset, p, !need_mem_bar); 2509 } 2510 break; 2511 case T_ADDRESS: 2512 // Cast to an int type. 2513 p = _gvn.transform(new CastP2XNode(NULL, p)); 2514 p = ConvX2UL(p); 2515 break; |