Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @ 3249:e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
Summary: A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer.
Reviewed-by: kvn, iveresov, never, tonyp, dholmes
author | johnc |
---|---|
date | Thu, 07 Apr 2011 09:53:20 -0700 |
parents | f966c66b5463 |
children | 5cceda753a4a |
comparison
equal
deleted
inserted
replaced
3248:e6beb62de02d | 3249:e1162778c1c8 |
---|---|
324 __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info); | 324 __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info); |
325 } | 325 } |
326 | 326 |
327 if (obj_store) { | 327 if (obj_store) { |
328 // Needs GC write barriers. | 328 // Needs GC write barriers. |
329 pre_barrier(LIR_OprFact::address(array_addr), false, NULL); | 329 pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */, |
330 true /* do_load */, false /* patch */, NULL); | |
330 __ move(value.result(), array_addr, null_check_info); | 331 __ move(value.result(), array_addr, null_check_info); |
331 // Seems to be a precise | 332 // Seems to be a precise |
332 post_barrier(LIR_OprFact::address(array_addr), value.result()); | 333 post_barrier(LIR_OprFact::address(array_addr), value.result()); |
333 } else { | 334 } else { |
334 __ move(value.result(), array_addr, null_check_info); | 335 __ move(value.result(), array_addr, null_check_info); |
792 } | 793 } |
793 __ leal(LIR_OprFact::address(a), addr); | 794 __ leal(LIR_OprFact::address(a), addr); |
794 | 795 |
795 if (type == objectType) { // Write-barrier needed for Object fields. | 796 if (type == objectType) { // Write-barrier needed for Object fields. |
796 // Do the pre-write barrier, if any. | 797 // Do the pre-write barrier, if any. |
797 pre_barrier(addr, false, NULL); | 798 pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */, |
799 true /* do_load */, false /* patch */, NULL); | |
798 } | 800 } |
799 | 801 |
800 LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience | 802 LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience |
801 if (type == objectType) | 803 if (type == objectType) |
802 __ cas_obj(addr, cmp.result(), val.result(), ill, ill); | 804 __ cas_obj(addr, cmp.result(), val.result(), ill, ill); |
1337 } else { | 1339 } else { |
1338 LIR_Address* addr = new LIR_Address(src, offset, type); | 1340 LIR_Address* addr = new LIR_Address(src, offset, type); |
1339 bool is_obj = (type == T_ARRAY || type == T_OBJECT); | 1341 bool is_obj = (type == T_ARRAY || type == T_OBJECT); |
1340 if (is_obj) { | 1342 if (is_obj) { |
1341 // Do the pre-write barrier, if any. | 1343 // Do the pre-write barrier, if any. |
1342 pre_barrier(LIR_OprFact::address(addr), false, NULL); | 1344 pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, |
1345 true /* do_load */, false /* patch */, NULL); | |
1343 __ move(data, addr); | 1346 __ move(data, addr); |
1344 assert(src->is_register(), "must be register"); | 1347 assert(src->is_register(), "must be register"); |
1345 // Seems to be a precise address | 1348 // Seems to be a precise address |
1346 post_barrier(LIR_OprFact::address(addr), data); | 1349 post_barrier(LIR_OprFact::address(addr), data); |
1347 } else { | 1350 } else { |