< prev index next >

src/hotspot/cpu/aarch64/aarch64.ad

Print this page




3552     // displaced header in the box, which indicates that it is a recursive lock.
3553     __ ands(tmp/*==0?*/, disp_hdr, tmp);   // Sets flags for result
3554     __ str(tmp/*==0, perhaps*/, Address(box, BasicLock::displaced_header_offset_in_bytes()));
3555 
3556     __ b(cont);
3557 
3558     // Handle existing monitor.
3559     __ bind(object_has_monitor);
3560 
3561     // The object's monitor m is unlocked iff m->owner == NULL,
3562     // otherwise m->owner may contain a thread or a stack address.
3563     //
3564     // Try to CAS m->owner from NULL to current thread.
3565     __ add(tmp, disp_hdr, (ObjectMonitor::owner_offset_in_bytes()-markWord::monitor_value));
3566     __ cmpxchg(tmp, zr, rthread, Assembler::xword, /*acquire*/ true,
3567                /*release*/ true, /*weak*/ false, noreg); // Sets flags for result
3568 
3569     // Store a non-null value into the box to avoid looking like a re-entrant
3570     // lock. The fast-path monitor unlock code checks for
3571     // markWord::monitor_value so use markWord::unused_mark which has the
3572     // relevant bit set, and also matches ObjectSynchronizer::slow_enter.
3573     __ mov(tmp, (address)markWord::unused_mark().value());
3574     __ str(tmp, Address(box, BasicLock::displaced_header_offset_in_bytes()));
3575 
3576     __ bind(cont);
3577     // flag == EQ indicates success
3578     // flag == NE indicates failure
3579   %}
3580 
3581   enc_class aarch64_enc_fast_unlock(iRegP object, iRegP box, iRegP tmp, iRegP tmp2) %{
3582     MacroAssembler _masm(&cbuf);
3583     Register oop = as_Register($object$$reg);
3584     Register box = as_Register($box$$reg);
3585     Register disp_hdr = as_Register($tmp$$reg);
3586     Register tmp = as_Register($tmp2$$reg);
3587     Label cont;
3588     Label object_has_monitor;
3589 
3590     assert_different_registers(oop, box, tmp, disp_hdr);
3591 
3592     if (UseBiasedLocking && !UseOptoBiasInlining) {




3552     // displaced header in the box, which indicates that it is a recursive lock.
3553     __ ands(tmp/*==0?*/, disp_hdr, tmp);   // Sets flags for result
3554     __ str(tmp/*==0, perhaps*/, Address(box, BasicLock::displaced_header_offset_in_bytes()));
3555 
3556     __ b(cont);
3557 
3558     // Handle existing monitor.
3559     __ bind(object_has_monitor);
3560 
3561     // The object's monitor m is unlocked iff m->owner == NULL,
3562     // otherwise m->owner may contain a thread or a stack address.
3563     //
3564     // Try to CAS m->owner from NULL to current thread.
3565     __ add(tmp, disp_hdr, (ObjectMonitor::owner_offset_in_bytes()-markWord::monitor_value));
3566     __ cmpxchg(tmp, zr, rthread, Assembler::xword, /*acquire*/ true,
3567                /*release*/ true, /*weak*/ false, noreg); // Sets flags for result
3568 
3569     // Store a non-null value into the box to avoid looking like a re-entrant
3570     // lock. The fast-path monitor unlock code checks for
3571     // markWord::monitor_value so use markWord::unused_mark which has the
3572     // relevant bit set, and also matches ObjectSynchronizer::enter.
3573     __ mov(tmp, (address)markWord::unused_mark().value());
3574     __ str(tmp, Address(box, BasicLock::displaced_header_offset_in_bytes()));
3575 
3576     __ bind(cont);
3577     // flag == EQ indicates success
3578     // flag == NE indicates failure
3579   %}
3580 
3581   enc_class aarch64_enc_fast_unlock(iRegP object, iRegP box, iRegP tmp, iRegP tmp2) %{
3582     MacroAssembler _masm(&cbuf);
3583     Register oop = as_Register($object$$reg);
3584     Register box = as_Register($box$$reg);
3585     Register disp_hdr = as_Register($tmp$$reg);
3586     Register tmp = as_Register($tmp2$$reg);
3587     Label cont;
3588     Label object_has_monitor;
3589 
3590     assert_different_registers(oop, box, tmp, disp_hdr);
3591 
3592     if (UseBiasedLocking && !UseOptoBiasInlining) {


< prev index next >