2029 /*current_value=*/current_header,
2030 /*compare_value=*/displaced_header,
2031 /*exchange_value=*/box,
2032 /*where=*/oop,
2033 MacroAssembler::MemBarAcq,
2034 MacroAssembler::cmpxchgx_hint_acquire_lock(),
2035 noreg,
2036 &cas_failed);
2037 assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0");
2038
2039 // If the compare-and-exchange succeeded, then we found an unlocked
2040 // object and we have now locked it.
2041 b(cont);
2042
2043 bind(cas_failed);
2044 // We did not see an unlocked object so try the fast recursive case.
2045
2046 // Check if the owner is self by comparing the value in the markOop of object
2047 // (current_header) with the stack pointer.
2048 sub(current_header, current_header, R1_SP);
2049 load_const_optimized(temp, (address) (~(os::vm_page_size()-1) |
2050 markOopDesc::lock_mask_in_place));
2051
2052 and_(R0/*==0?*/, current_header, temp);
2053 // If condition is true we are cont and hence we can store 0 as the
2054 // displaced header in the box, which indicates that it is a recursive lock.
2055 mcrf(flag,CCR0);
2056 std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), box);
2057
2058 // Handle existing monitor.
2059 if ((EmitSync & 0x02) == 0) {
2060 b(cont);
2061
2062 bind(object_has_monitor);
2063 // The object's monitor m is unlocked iff m->owner == NULL,
2064 // otherwise m->owner may contain a thread or a stack address.
2065 //
2066 // Try to CAS m->owner from NULL to current thread.
2067 addi(temp, displaced_header, ObjectMonitor::owner_offset_in_bytes()-markOopDesc::monitor_value);
2068 li(displaced_header, 0);
2069 // CmpxchgX sets flag to cmpX(current, displaced).
2070 cmpxchgd(/*flag=*/flag,
|
2029 /*current_value=*/current_header,
2030 /*compare_value=*/displaced_header,
2031 /*exchange_value=*/box,
2032 /*where=*/oop,
2033 MacroAssembler::MemBarAcq,
2034 MacroAssembler::cmpxchgx_hint_acquire_lock(),
2035 noreg,
2036 &cas_failed);
2037 assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0");
2038
2039 // If the compare-and-exchange succeeded, then we found an unlocked
2040 // object and we have now locked it.
2041 b(cont);
2042
2043 bind(cas_failed);
2044 // We did not see an unlocked object so try the fast recursive case.
2045
2046 // Check if the owner is self by comparing the value in the markOop of object
2047 // (current_header) with the stack pointer.
2048 sub(current_header, current_header, R1_SP);
2049 load_const_optimized(temp, ~(os::vm_page_size()-1) | markOopDesc::lock_mask_in_place);
2050
2051 and_(R0/*==0?*/, current_header, temp);
2052 // If condition is true we are cont and hence we can store 0 as the
2053 // displaced header in the box, which indicates that it is a recursive lock.
2054 mcrf(flag,CCR0);
2055 std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), box);
2056
2057 // Handle existing monitor.
2058 if ((EmitSync & 0x02) == 0) {
2059 b(cont);
2060
2061 bind(object_has_monitor);
2062 // The object's monitor m is unlocked iff m->owner == NULL,
2063 // otherwise m->owner may contain a thread or a stack address.
2064 //
2065 // Try to CAS m->owner from NULL to current thread.
2066 addi(temp, displaced_header, ObjectMonitor::owner_offset_in_bytes()-markOopDesc::monitor_value);
2067 li(displaced_header, 0);
2068 // CmpxchgX sets flag to cmpX(current, displaced).
2069 cmpxchgd(/*flag=*/flag,
|