src/cpu/x86/vm/templateTable_x86_64.cpp

Print this page
rev 4482 : G1: Fix bug with compressed oops in template interpreter on x86 and sparc.

In do_oop_store an uncompressed oop needs to be preserved and passed to
g1_write_barrier_post. This is necessary for the heap region cross
check which did not work correctly.


 141     case BarrierSet::G1SATBCT:
 142     case BarrierSet::G1SATBCTLogging:
 143       {
 144         // flatten object address if needed
 145         if (obj.index() == noreg && obj.disp() == 0) {
 146           if (obj.base() != rdx) {
 147             __ movq(rdx, obj.base());
 148           }
 149         } else {
 150           __ leaq(rdx, obj);
 151         }
 152         __ g1_write_barrier_pre(rdx /* obj */,
 153                                 rbx /* pre_val */,
 154                                 r15_thread /* thread */,
 155                                 r8  /* tmp */,
 156                                 val != noreg /* tosca_live */,
 157                                 false /* expand_call */);
 158         if (val == noreg) {
 159           __ store_heap_oop_null(Address(rdx, 0));
 160         } else {






 161           __ store_heap_oop(Address(rdx, 0), val);
 162           __ g1_write_barrier_post(rdx /* store_adr */,
 163                                    val /* new_val */,
 164                                    r15_thread /* thread */,
 165                                    r8 /* tmp */,
 166                                    rbx /* tmp2 */);
 167         }
 168 
 169       }
 170       break;
 171 #endif // INCLUDE_ALL_GCS
 172     case BarrierSet::CardTableModRef:
 173     case BarrierSet::CardTableExtension:
 174       {
 175         if (val == noreg) {
 176           __ store_heap_oop_null(obj);
 177         } else {
 178           __ store_heap_oop(obj, val);
 179           // flatten object address if needed
 180           if (!precise || (obj.index() == noreg && obj.disp() == 0)) {
 181             __ store_check(obj.base());
 182           } else {
 183             __ leaq(rdx, obj);




 141     case BarrierSet::G1SATBCT:
 142     case BarrierSet::G1SATBCTLogging:
 143       {
 144         // flatten object address if needed
 145         if (obj.index() == noreg && obj.disp() == 0) {
 146           if (obj.base() != rdx) {
 147             __ movq(rdx, obj.base());
 148           }
 149         } else {
 150           __ leaq(rdx, obj);
 151         }
 152         __ g1_write_barrier_pre(rdx /* obj */,
 153                                 rbx /* pre_val */,
 154                                 r15_thread /* thread */,
 155                                 r8  /* tmp */,
 156                                 val != noreg /* tosca_live */,
 157                                 false /* expand_call */);
 158         if (val == noreg) {
 159           __ store_heap_oop_null(Address(rdx, 0));
 160         } else {
 161           // G1 barrier needs uncompressed oop for region cross check.
 162           Register new_val = val; 
 163           if (UseCompressedOops) {
 164             new_val = rbx;
 165             __ movptr(new_val, val);
 166           }
 167           __ store_heap_oop(Address(rdx, 0), val);
 168           __ g1_write_barrier_post(rdx /* store_adr */,
 169                                    new_val /* new_val */,
 170                                    r15_thread /* thread */,
 171                                    r8 /* tmp */,
 172                                    rbx /* tmp2 */);
 173         }
 174 
 175       }
 176       break;
 177 #endif // INCLUDE_ALL_GCS
 178     case BarrierSet::CardTableModRef:
 179     case BarrierSet::CardTableExtension:
 180       {
 181         if (val == noreg) {
 182           __ store_heap_oop_null(obj);
 183         } else {
 184           __ store_heap_oop(obj, val);
 185           // flatten object address if needed
 186           if (!precise || (obj.index() == noreg && obj.disp() == 0)) {
 187             __ store_check(obj.base());
 188           } else {
 189             __ leaq(rdx, obj);