< prev index next >

src/hotspot/cpu/arm/macroAssembler_arm.cpp

Print this page




2997     biased_locking_enter(Roop, Rmark, Rscratch, false, Rscratch3, done, failed);
2998 #else
2999     biased_locking_enter(Roop, Rmark, Rscratch, false, noreg, done, failed);
3000 #endif
3001     bind(failed);
3002   }
3003 
3004   ldr(Rmark, Address(Roop, oopDesc::mark_offset_in_bytes()));
3005   tst(Rmark, markOopDesc::unlocked_value);
3006   b(fast_lock, ne);
3007 
3008   // Check for recursive lock
3009   // See comments in InterpreterMacroAssembler::lock_object for
3010   // explanations on the fast recursive locking check.
3011 #ifdef AARCH64
3012   intptr_t mask = ((intptr_t)3) - ((intptr_t)os::vm_page_size());
3013   Assembler::LogicalImmediate imm(mask, false);
3014   mov(Rscratch, SP);
3015   sub(Rscratch, Rmark, Rscratch);
3016   ands(Rscratch, Rscratch, imm);
3017   b(done, ne); // exit with failure
3018   str(Rscratch, Address(Rbox, BasicLock::displaced_header_offset_in_bytes())); // set to zero
3019   b(done);
3020 
3021 #else
3022   // -1- test low 2 bits
3023   movs(Rscratch, AsmOperand(Rmark, lsl, 30));
3024   // -2- test (hdr - SP) if the low two bits are 0
3025   sub(Rscratch, Rmark, SP, eq);
3026   movs(Rscratch, AsmOperand(Rscratch, lsr, exact_log2(os::vm_page_size())), eq);
3027   // If still 'eq' then recursive locking OK
3028   str(Rscratch, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()), eq); // set to zero

3029   b(done);
3030 #endif
3031 
3032   bind(fast_lock);
3033   str(Rmark, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
3034 
3035   bool allow_fallthrough_on_failure = true;
3036   bool one_shot = true;
3037   cas_for_lock_acquire(Rmark, Rbox, Roop, Rscratch, done, allow_fallthrough_on_failure, one_shot);
3038 
3039   bind(done);
3040 
3041 }
3042 
3043 void MacroAssembler::fast_unlock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2  AARCH64_ONLY_ARG(Register Rscratch3))
3044 {
3045   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
3046 
3047   Register Rmark      = Rscratch2;
3048 




2997     biased_locking_enter(Roop, Rmark, Rscratch, false, Rscratch3, done, failed);
2998 #else
2999     biased_locking_enter(Roop, Rmark, Rscratch, false, noreg, done, failed);
3000 #endif
3001     bind(failed);
3002   }
3003 
3004   ldr(Rmark, Address(Roop, oopDesc::mark_offset_in_bytes()));
3005   tst(Rmark, markOopDesc::unlocked_value);
3006   b(fast_lock, ne);
3007 
3008   // Check for recursive lock
3009   // See comments in InterpreterMacroAssembler::lock_object for
3010   // explanations on the fast recursive locking check.
3011 #ifdef AARCH64
3012   intptr_t mask = ((intptr_t)3) - ((intptr_t)os::vm_page_size());
3013   Assembler::LogicalImmediate imm(mask, false);
3014   mov(Rscratch, SP);
3015   sub(Rscratch, Rmark, Rscratch);
3016   ands(Rscratch, Rscratch, imm);
3017   // set to zero if recursive lock, set to non zero otherwise (see discussion in JDK-8153107)
3018   str(Rscratch, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
3019   b(done);
3020 
3021 #else
3022   // -1- test low 2 bits
3023   movs(Rscratch, AsmOperand(Rmark, lsl, 30));
3024   // -2- test (hdr - SP) if the low two bits are 0
3025   sub(Rscratch, Rmark, SP, eq);
3026   movs(Rscratch, AsmOperand(Rscratch, lsr, exact_log2(os::vm_page_size())), eq);
3027   // If still 'eq' then recursive locking OK
3028   // set to zero if recursive lock, set to non zero otherwise (see discussion in JDK-8153107)
3029   str(Rscratch, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
3030   b(done);
3031 #endif
3032 
3033   bind(fast_lock);
3034   str(Rmark, Address(Rbox, BasicLock::displaced_header_offset_in_bytes()));
3035 
3036   bool allow_fallthrough_on_failure = true;
3037   bool one_shot = true;
3038   cas_for_lock_acquire(Rmark, Rbox, Roop, Rscratch, done, allow_fallthrough_on_failure, one_shot);
3039 
3040   bind(done);
3041 
3042 }
3043 
3044 void MacroAssembler::fast_unlock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2  AARCH64_ONLY_ARG(Register Rscratch3))
3045 {
3046   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
3047 
3048   Register Rmark      = Rscratch2;
3049 


< prev index next >