8277411: C2 fast_unlock intrinsic on AArch64 has unnecessary ownership check

Reviewed-by: ngasson, neliasso
This commit is contained in:
Erik Österlund 2021-11-26 14:55:02 +00:00
parent ce0234b47d
commit 3d810ad691

View File

@ -4007,19 +4007,15 @@ encode %{
__ bind(object_has_monitor);
STATIC_ASSERT(markWord::monitor_value <= INT_MAX);
__ add(tmp, tmp, -(int)markWord::monitor_value); // monitor
__ ldr(rscratch1, Address(tmp, ObjectMonitor::owner_offset_in_bytes()));
__ ldr(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset_in_bytes()));
Label notRecursive;
__ cmp(rscratch1, rthread);
__ br(Assembler::NE, cont);
__ cbz(disp_hdr, notRecursive);
// Recursive lock
__ sub(disp_hdr, disp_hdr, 1u);
__ str(disp_hdr, Address(tmp, ObjectMonitor::recursions_offset_in_bytes()));
// flag == EQ was set in the ownership check above
__ cmp(disp_hdr, disp_hdr); // Sets flags for result
__ b(cont);
__ bind(notRecursive);