< prev index next >

src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp

Print this page

 80 
 81 void C2_MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2) {
 82   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
 83 
 84   Register Rmark      = Rscratch2;
 85 
 86   assert(Roop != Rscratch, "");
 87   assert(Roop != Rmark, "");
 88   assert(Rbox != Rscratch, "");
 89   assert(Rbox != Rmark, "");
 90 
 91   Label fast_lock, done;
 92 
 93   if (DiagnoseSyncOnValueBasedClasses != 0) {
 94     load_klass(Rscratch, Roop);
 95     ldr_u32(Rscratch, Address(Rscratch, Klass::access_flags_offset()));
 96     tst(Rscratch, JVM_ACC_IS_VALUE_BASED_CLASS);
 97     b(done, ne);
 98   }
 99 
100   ldr(Rmark, Address(Roop, oopDesc::mark_offset_in_bytes()));
101   tst(Rmark, markWord::unlocked_value);
102   b(fast_lock, ne);
103 
104   // Check for recursive lock
105   // See comments in InterpreterMacroAssembler::lock_object for
106   // explanations on the fast recursive locking check.
107   // -1- test low 2 bits
108   movs(Rscratch, AsmOperand(Rmark, lsl, 30));
109   // -2- test (hdr - SP) if the low two bits are 0
110   sub(Rscratch, Rmark, SP, eq);
111   movs(Rscratch, AsmOperand(Rscratch, lsr, exact_log2(os::vm_page_size())), eq);
112   // If still 'eq' then recursive locking OK
113   // set to zero if recursive lock, set to non zero otherwise (see discussion in JDK-8153107)
114   str(Rscratch, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
115   b(done);
116 
117   bind(fast_lock);
118   str(Rmark, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
119 
120   bool allow_fallthrough_on_failure = true;
121   bool one_shot = true;
122   cas_for_lock_acquire(Rmark, Rbox, Roop, Rscratch, done, allow_fallthrough_on_failure, one_shot);
123 
124   bind(done);
125 
126   // At this point flags are set as follows:
127   //  EQ -> Success
128   //  NE -> Failure, branch to slow path
129 }
130 
131 void C2_MacroAssembler::fast_unlock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2) {
132   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
133 
134   Register Rmark      = Rscratch2;
135 
136   assert(Roop != Rscratch, "");
137   assert(Roop != Rmark, "");
138   assert(Rbox != Rscratch, "");
139   assert(Rbox != Rmark, "");
140 
141   Label done;
142 
143   ldr(Rmark, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
144   // If hdr is NULL, we've got recursive locking and there's nothing more to do
145   cmp(Rmark, 0);
146   b(done, eq);
147 
148   // Restore the object header
149   bool allow_fallthrough_on_failure = true;
150   bool one_shot = true;
151   cas_for_lock_release(Rmark, Rbox, Roop, Rscratch, done, allow_fallthrough_on_failure, one_shot);
152 
153   bind(done);
154 }
155 

 80 
 81 void C2_MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2) {
 82   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
 83 
 84   Register Rmark      = Rscratch2;
 85 
 86   assert(Roop != Rscratch, "");
 87   assert(Roop != Rmark, "");
 88   assert(Rbox != Rscratch, "");
 89   assert(Rbox != Rmark, "");
 90 
 91   Label fast_lock, done;
 92 
 93   if (DiagnoseSyncOnValueBasedClasses != 0) {
 94     load_klass(Rscratch, Roop);
 95     ldr_u32(Rscratch, Address(Rscratch, Klass::access_flags_offset()));
 96     tst(Rscratch, JVM_ACC_IS_VALUE_BASED_CLASS);
 97     b(done, ne);
 98   }
 99 
100   // TODO: Implement fast-locking.
101   tst(Roop, Roop); // Indicate failure -> take slow path






















102   bind(done);
103 
104   // At this point flags are set as follows:
105   //  EQ -> Success
106   //  NE -> Failure, branch to slow path
107 }
108 
109 void C2_MacroAssembler::fast_unlock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2) {
110   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
111 
112   Register Rmark      = Rscratch2;
113 
114   assert(Roop != Rscratch, "");
115   assert(Roop != Rmark, "");
116   assert(Rbox != Rscratch, "");
117   assert(Rbox != Rmark, "");
118 
119   Label done;
120 
121   // TODO: Implement fast-unlocking.
122   tst(Roop, Roop); // Indicate failure -> take slow path








123   bind(done);
124 }
125 
< prev index next >