256 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; 257 bool on_reference = on_weak || on_phantom; 258 ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); 259 if (on_oop && on_reference) { 260 // LR is live. It must be saved around calls. 261 __ enter(); // barrier may call runtime 262 // Generate the G1 pre-barrier code to log the value of 263 // the referent field in an SATB buffer. 264 g1_write_barrier_pre(masm /* masm */, 265 noreg /* obj */, 266 dst /* pre_val */, 267 rthread /* thread */, 268 tmp1 /* tmp */, 269 true /* tosca_live */, 270 true /* expand_call */); 271 __ leave(); 272 } 273 } 274 275 void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 276 Address dst, Register val, Register tmp1, Register tmp2) { 277 // flatten object address if needed 278 if (dst.index() == noreg && dst.offset() == 0) { 279 if (dst.base() != r3) { 280 __ mov(r3, dst.base()); 281 } 282 } else { 283 __ lea(r3, dst); 284 } 285 286 g1_write_barrier_pre(masm, 287 r3 /* obj */, 288 tmp2 /* pre_val */, 289 rthread /* thread */, 290 tmp1 /* tmp */, 291 val != noreg /* tosca_live */, 292 false /* expand_call */); 293 294 if (val == noreg) { 295 BarrierSetAssembler::store_at(masm, decorators, type, Address(r3, 0), noreg, noreg, noreg); 296 } else { 297 // G1 barrier needs uncompressed oop for region cross check. 298 Register new_val = val; 299 if (UseCompressedOops) { 300 new_val = rscratch2; 301 __ mov(new_val, val); 302 } 303 BarrierSetAssembler::store_at(masm, decorators, type, Address(r3, 0), val, noreg, noreg); 304 g1_write_barrier_post(masm, 305 r3 /* store_adr */, 306 new_val /* new_val */, 307 rthread /* thread */, 308 tmp1 /* tmp */, 309 tmp2 /* tmp2 */); 310 } 311 312 } 313 314 #ifdef COMPILER1 315 316 #undef __ 317 #define __ ce->masm()-> 318 319 void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub) { 320 G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1(); 321 // At this point we know that marking is in progress. 322 // If do_load() is true then we have to emit the 323 // load of the previous value; otherwise it has already | 256 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; 257 bool on_reference = on_weak || on_phantom; 258 ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); 259 if (on_oop && on_reference) { 260 // LR is live. It must be saved around calls. 261 __ enter(); // barrier may call runtime 262 // Generate the G1 pre-barrier code to log the value of 263 // the referent field in an SATB buffer. 264 g1_write_barrier_pre(masm /* masm */, 265 noreg /* obj */, 266 dst /* pre_val */, 267 rthread /* thread */, 268 tmp1 /* tmp */, 269 true /* tosca_live */, 270 true /* expand_call */); 271 __ leave(); 272 } 273 } 274 275 void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 276 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) { 277 278 if (tmp3 == noreg) { 279 tmp3 = r8; 280 } 281 282 // flatten object address if needed 283 if (dst.index() == noreg && dst.offset() == 0) { 284 if (dst.base() != r3) { 285 __ mov(r3, dst.base()); 286 } 287 } else { 288 __ lea(r3, dst); 289 } 290 291 g1_write_barrier_pre(masm, 292 r3 /* obj */, 293 tmp2 /* pre_val */, 294 rthread /* thread */, 295 tmp1 /* tmp */, 296 val != noreg /* tosca_live */, 297 false /* expand_call */); 298 299 if (val == noreg) { 300 BarrierSetAssembler::store_at(masm, decorators, type, Address(r3, 0), noreg, noreg, noreg, noreg); 301 } else { 302 // G1 barrier needs uncompressed oop for region cross check. 303 Register new_val = val; 304 if (UseCompressedOops) { 305 new_val = rscratch2; 306 __ mov(new_val, val); 307 } 308 BarrierSetAssembler::store_at(masm, decorators, type, Address(r3, 0), val, noreg, noreg, noreg); 309 g1_write_barrier_post(masm, 310 r3 /* store_adr */, 311 new_val /* new_val */, 312 rthread /* thread */, 313 tmp1 /* tmp */, 314 tmp2 /* tmp2 */); 315 } 316 317 } 318 319 #ifdef COMPILER1 320 321 #undef __ 322 #define __ ce->masm()-> 323 324 void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub) { 325 G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1(); 326 // At this point we know that marking is in progress. 327 // If do_load() is true then we have to emit the 328 // load of the previous value; otherwise it has already |