< prev index next >

src/cpu/aarch64/vm/c1_MacroAssembler_aarch64.cpp

Print this page
rev 12152 : [mq]: verification.patch


  52     // greater than.
  53     cset(result, NE);  // Not equal or unordered
  54     cneg(result, result, LT);  // Less than or unordered
  55   } else {
  56     // we want -1 for less than, 0 for equal and 1 for unordered or
  57     // greater than.
  58     cset(result, NE);  // Not equal or unordered
  59     cneg(result, result, LO);  // Less than
  60   }
  61 }
  62 
  63 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
  64   const int aligned_mask = BytesPerWord -1;
  65   const int hdr_offset = oopDesc::mark_offset_in_bytes();
  66   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
  67   Label done, fail;
  68   int null_check_offset = -1;
  69 
  70   verify_oop(obj);
  71 
  72   shenandoah_store_check(obj);
  73 
  74   // save object being locked into the BasicObjectLock
  75   str(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
  76 
  77   if (UseBiasedLocking) {
  78     assert(scratch != noreg, "should have scratch register at this point");
  79     null_check_offset = biased_locking_enter(disp_hdr, obj, hdr, scratch, false, done, &slow_case);
  80   } else {
  81     null_check_offset = offset();
  82   }
  83 
  84   // Load object header
  85   ldr(hdr, Address(obj, hdr_offset));
  86   // and mark it as unlocked
  87   orr(hdr, hdr, markOopDesc::unlocked_value);
  88   // save unlocked object header into the displaced header location on the stack
  89   str(hdr, Address(disp_hdr, 0));
  90   // test if object header is still the same (i.e. unlocked), and if so, store the
  91   // displaced header address in the object header - if it is not the same, get the
  92   // object header instead


 117   // done
 118   bind(done);
 119   if (PrintBiasedLockingStatistics) {
 120     lea(rscratch2, ExternalAddress((address)BiasedLocking::fast_path_entry_count_addr()));
 121     addmw(Address(rscratch2, 0), 1, rscratch1);
 122   }
 123   return null_check_offset;
 124 }
 125 
 126 
 127 void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
 128   const int aligned_mask = BytesPerWord -1;
 129   const int hdr_offset = oopDesc::mark_offset_in_bytes();
 130   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
 131   Label done;
 132 
 133   if (UseBiasedLocking) {
 134     // load object
 135     ldr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
 136 
 137     shenandoah_store_check(obj);
 138 
 139     biased_locking_exit(obj, hdr, done);
 140   }
 141 
 142   // load displaced header
 143   ldr(hdr, Address(disp_hdr, 0));
 144   // if the loaded hdr is NULL we had recursive locking
 145   // if we had recursive locking, we are done
 146   cbz(hdr, done);
 147   if (!UseBiasedLocking) {
 148     // load object
 149     ldr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
 150   }
 151   verify_oop(obj);
 152   shenandoah_store_check(obj);

 153 
 154   // test if object header is pointing to the displaced header, and if so, restore
 155   // the displaced header in the object - if the object header is not pointing to
 156   // the displaced header, get the object header instead
 157   // if the object header was not pointing to the displaced header,
 158   // we do unlocking via runtime call
 159   if (hdr_offset) {
 160     lea(rscratch1, Address(obj, hdr_offset));
 161     cmpxchgptr(disp_hdr, hdr, rscratch1, rscratch2, done, &slow_case);
 162   } else {
 163     cmpxchgptr(disp_hdr, hdr, obj, rscratch2, done, &slow_case);
 164   }
 165   // done
 166   bind(done);
 167 }
 168 
 169 
 170 // Defines obj, preserves var_size_in_bytes
 171 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, Label& slow_case) {
 172   if (UseTLAB) {




  52     // greater than.
  53     cset(result, NE);  // Not equal or unordered
  54     cneg(result, result, LT);  // Less than or unordered
  55   } else {
  56     // we want -1 for less than, 0 for equal and 1 for unordered or
  57     // greater than.
  58     cset(result, NE);  // Not equal or unordered
  59     cneg(result, result, LO);  // Less than
  60   }
  61 }
  62 
  63 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
  64   const int aligned_mask = BytesPerWord -1;
  65   const int hdr_offset = oopDesc::mark_offset_in_bytes();
  66   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
  67   Label done, fail;
  68   int null_check_offset = -1;
  69 
  70   verify_oop(obj);
  71 
  72   shenandoah_store_addr_check(obj);
  73 
  74   // save object being locked into the BasicObjectLock
  75   str(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
  76 
  77   if (UseBiasedLocking) {
  78     assert(scratch != noreg, "should have scratch register at this point");
  79     null_check_offset = biased_locking_enter(disp_hdr, obj, hdr, scratch, false, done, &slow_case);
  80   } else {
  81     null_check_offset = offset();
  82   }
  83 
  84   // Load object header
  85   ldr(hdr, Address(obj, hdr_offset));
  86   // and mark it as unlocked
  87   orr(hdr, hdr, markOopDesc::unlocked_value);
  88   // save unlocked object header into the displaced header location on the stack
  89   str(hdr, Address(disp_hdr, 0));
  90   // test if object header is still the same (i.e. unlocked), and if so, store the
  91   // displaced header address in the object header - if it is not the same, get the
  92   // object header instead


 117   // done
 118   bind(done);
 119   if (PrintBiasedLockingStatistics) {
 120     lea(rscratch2, ExternalAddress((address)BiasedLocking::fast_path_entry_count_addr()));
 121     addmw(Address(rscratch2, 0), 1, rscratch1);
 122   }
 123   return null_check_offset;
 124 }
 125 
 126 
 127 void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
 128   const int aligned_mask = BytesPerWord -1;
 129   const int hdr_offset = oopDesc::mark_offset_in_bytes();
 130   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
 131   Label done;
 132 
 133   if (UseBiasedLocking) {
 134     // load object
 135     ldr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
 136 


 137     biased_locking_exit(obj, hdr, done);
 138   }
 139 
 140   // load displaced header
 141   ldr(hdr, Address(disp_hdr, 0));
 142   // if the loaded hdr is NULL we had recursive locking
 143   // if we had recursive locking, we are done
 144   cbz(hdr, done);
 145   if (!UseBiasedLocking) {
 146     // load object
 147     ldr(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
 148   }
 149   verify_oop(obj);
 150 
 151   shenandoah_store_addr_check(obj);
 152 
 153   // test if object header is pointing to the displaced header, and if so, restore
 154   // the displaced header in the object - if the object header is not pointing to
 155   // the displaced header, get the object header instead
 156   // if the object header was not pointing to the displaced header,
 157   // we do unlocking via runtime call
 158   if (hdr_offset) {
 159     lea(rscratch1, Address(obj, hdr_offset));
 160     cmpxchgptr(disp_hdr, hdr, rscratch1, rscratch2, done, &slow_case);
 161   } else {
 162     cmpxchgptr(disp_hdr, hdr, obj, rscratch2, done, &slow_case);
 163   }
 164   // done
 165   bind(done);
 166 }
 167 
 168 
 169 // Defines obj, preserves var_size_in_bytes
 170 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, Label& slow_case) {
 171   if (UseTLAB) {


< prev index next >