2176 (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile); |
2176 (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile); |
2177 } else { |
2177 } else { |
2178 // Possibly an oop being stored to Java heap or native memory |
2178 // Possibly an oop being stored to Java heap or native memory |
2179 if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) { |
2179 if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) { |
2180 // oop to Java heap. |
2180 // oop to Java heap. |
2181 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, val->bottom_type(), type); |
2181 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type); |
2182 } else { |
2182 } else { |
2183 |
|
2184 // We can't tell at compile time if we are storing in the Java heap or outside |
2183 // We can't tell at compile time if we are storing in the Java heap or outside |
2185 // of it. So we need to emit code to conditionally do the proper type of |
2184 // of it. So we need to emit code to conditionally do the proper type of |
2186 // store. |
2185 // store. |
2187 |
2186 |
2188 IdealKit kit(gvn(), control(), merged_memory()); |
2187 IdealKit kit(gvn(), control(), merged_memory()); |
2189 kit.declares_done(); |
2188 kit.declares_done(); |
2190 // QQQ who knows what probability is here?? |
2189 // QQQ who knows what probability is here?? |
2191 kit.if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); { |
2190 kit.if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); { |
2192 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, val->bottom_type(), type); |
2191 (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type); |
2193 } kit.else_(); { |
2192 } kit.else_(); { |
2194 (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile); |
2193 (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile); |
2195 } kit.end_if(); |
2194 } kit.end_if(); |
2196 } |
2195 } |
2197 } |
2196 } |
2392 cas = _gvn.transform(new (C, 5) CompareAndSwapLNode(control(), mem, adr, newval, oldval)); |
2391 cas = _gvn.transform(new (C, 5) CompareAndSwapLNode(control(), mem, adr, newval, oldval)); |
2393 break; |
2392 break; |
2394 case T_OBJECT: |
2393 case T_OBJECT: |
2395 // reference stores need a store barrier. |
2394 // reference stores need a store barrier. |
2396 // (They don't if CAS fails, but it isn't worth checking.) |
2395 // (They don't if CAS fails, but it isn't worth checking.) |
2397 pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT); |
2396 pre_barrier(control(), base, adr, alias_idx, newval, value_type->is_oopptr(), T_OBJECT); |
2398 #ifdef _LP64 |
2397 #ifdef _LP64 |
2399 if (adr->bottom_type()->is_ptr_to_narrowoop()) { |
2398 if (adr->bottom_type()->is_ptr_to_narrowoop()) { |
2400 Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); |
2399 Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); |
2401 Node *oldval_enc = _gvn.transform(new (C, 2) EncodePNode(oldval, oldval->bottom_type()->make_narrowoop())); |
2400 Node *oldval_enc = _gvn.transform(new (C, 2) EncodePNode(oldval, oldval->bottom_type()->make_narrowoop())); |
2402 cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr, |
2401 cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr, |
2487 insert_mem_bar(Op_MemBarCPUOrder); |
2486 insert_mem_bar(Op_MemBarCPUOrder); |
2488 // Ensure that the store is atomic for longs: |
2487 // Ensure that the store is atomic for longs: |
2489 bool require_atomic_access = true; |
2488 bool require_atomic_access = true; |
2490 Node* store; |
2489 Node* store; |
2491 if (type == T_OBJECT) // reference stores need a store barrier. |
2490 if (type == T_OBJECT) // reference stores need a store barrier. |
2492 store = store_oop_to_unknown(control(), base, adr, adr_type, val, value_type, type); |
2491 store = store_oop_to_unknown(control(), base, adr, adr_type, val, type); |
2493 else { |
2492 else { |
2494 store = store_to_memory(control(), adr, val, type, adr_type, require_atomic_access); |
2493 store = store_to_memory(control(), adr, val, type, adr_type, require_atomic_access); |
2495 } |
2494 } |
2496 insert_mem_bar(Op_MemBarCPUOrder); |
2495 insert_mem_bar(Op_MemBarCPUOrder); |
2497 return true; |
2496 return true; |