mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
8278411: Implement UseHeavyMonitors consistently, s390 port
Reviewed-by: mdoerr, stuefe, lucy
This commit is contained in:
parent
316bc79e0e
commit
41ee125a0f
5 changed files with 99 additions and 71 deletions
|
@ -86,7 +86,6 @@ void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
|
||||||
void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
|
void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
|
||||||
const int hdr_offset = oopDesc::mark_offset_in_bytes();
|
const int hdr_offset = oopDesc::mark_offset_in_bytes();
|
||||||
assert_different_registers(hdr, obj, disp_hdr);
|
assert_different_registers(hdr, obj, disp_hdr);
|
||||||
NearLabel done;
|
|
||||||
|
|
||||||
verify_oop(obj, FILE_AND_LINE);
|
verify_oop(obj, FILE_AND_LINE);
|
||||||
|
|
||||||
|
@ -102,6 +101,12 @@ void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hd
|
||||||
z_btrue(slow_case);
|
z_btrue(slow_case);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(LockingMode != LM_MONITOR, "LM_MONITOR is already handled, by emit_lock()");
|
||||||
|
|
||||||
|
if (LockingMode == LM_LIGHTWEIGHT) {
|
||||||
|
Unimplemented();
|
||||||
|
} else if (LockingMode == LM_LEGACY) {
|
||||||
|
NearLabel done;
|
||||||
// and mark it as unlocked.
|
// and mark it as unlocked.
|
||||||
z_oill(hdr, markWord::unlocked_value);
|
z_oill(hdr, markWord::unlocked_value);
|
||||||
// Save unlocked object header into the displaced header location on the stack.
|
// Save unlocked object header into the displaced header location on the stack.
|
||||||
|
@ -137,6 +142,7 @@ void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hd
|
||||||
// done
|
// done
|
||||||
bind(done);
|
bind(done);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
|
void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
|
||||||
const int aligned_mask = BytesPerWord -1;
|
const int aligned_mask = BytesPerWord -1;
|
||||||
|
@ -144,13 +150,20 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
|
||||||
assert_different_registers(hdr, obj, disp_hdr);
|
assert_different_registers(hdr, obj, disp_hdr);
|
||||||
NearLabel done;
|
NearLabel done;
|
||||||
|
|
||||||
|
if (LockingMode != LM_LIGHTWEIGHT) {
|
||||||
// Load displaced header.
|
// Load displaced header.
|
||||||
z_ltg(hdr, Address(disp_hdr, (intptr_t) 0));
|
z_ltg(hdr, Address(disp_hdr, (intptr_t) 0));
|
||||||
// If the loaded hdr is null we had recursive locking, and we are done.
|
// If the loaded hdr is null we had recursive locking, and we are done.
|
||||||
z_bre(done);
|
z_bre(done);
|
||||||
|
}
|
||||||
|
|
||||||
// Load object.
|
// Load object.
|
||||||
z_lg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
|
z_lg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
|
||||||
verify_oop(obj, FILE_AND_LINE);
|
verify_oop(obj, FILE_AND_LINE);
|
||||||
|
|
||||||
|
if (LockingMode == LM_LIGHTWEIGHT) {
|
||||||
|
Unimplemented();
|
||||||
|
} else {
|
||||||
// Test if object header is pointing to the displaced header, and if so, restore
|
// Test if object header is pointing to the displaced header, and if so, restore
|
||||||
// the displaced header in the object. If the object header is not pointing to
|
// the displaced header in the object. If the object header is not pointing to
|
||||||
// the displaced header, get the object header instead.
|
// the displaced header, get the object header instead.
|
||||||
|
@ -159,6 +172,7 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
|
||||||
// we do unlocking via runtime call.
|
// we do unlocking via runtime call.
|
||||||
branch_optimized(Assembler::bcondNotEqual, slow_case);
|
branch_optimized(Assembler::bcondNotEqual, slow_case);
|
||||||
// done
|
// done
|
||||||
|
}
|
||||||
bind(done);
|
bind(done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3171,6 +3171,7 @@ void MacroAssembler::compiler_fast_lock_object(Register oop, Register box, Regis
|
||||||
z_nill(temp, markWord::monitor_value);
|
z_nill(temp, markWord::monitor_value);
|
||||||
z_brne(object_has_monitor);
|
z_brne(object_has_monitor);
|
||||||
|
|
||||||
|
if (LockingMode != LM_MONITOR) {
|
||||||
// Set mark to markWord | markWord::unlocked_value.
|
// Set mark to markWord | markWord::unlocked_value.
|
||||||
z_oill(displacedHeader, markWord::unlocked_value);
|
z_oill(displacedHeader, markWord::unlocked_value);
|
||||||
|
|
||||||
|
@ -3187,6 +3188,11 @@ void MacroAssembler::compiler_fast_lock_object(Register oop, Register box, Regis
|
||||||
z_csg(displacedHeader, box, 0, oop);
|
z_csg(displacedHeader, box, 0, oop);
|
||||||
assert(currentHeader == displacedHeader, "must be same register"); // Identified two registers from z/Architecture.
|
assert(currentHeader == displacedHeader, "must be same register"); // Identified two registers from z/Architecture.
|
||||||
z_bre(done);
|
z_bre(done);
|
||||||
|
} else {
|
||||||
|
// Set NE to indicate 'failure' -> take slow-path
|
||||||
|
z_ltgr(oop, oop);
|
||||||
|
z_bru(done);
|
||||||
|
}
|
||||||
|
|
||||||
// We did not see an unlocked object so try the fast recursive case.
|
// We did not see an unlocked object so try the fast recursive case.
|
||||||
|
|
||||||
|
@ -3238,10 +3244,12 @@ void MacroAssembler::compiler_fast_unlock_object(Register oop, Register box, Reg
|
||||||
|
|
||||||
BLOCK_COMMENT("compiler_fast_unlock_object {");
|
BLOCK_COMMENT("compiler_fast_unlock_object {");
|
||||||
|
|
||||||
|
if (LockingMode != LM_MONITOR) {
|
||||||
// Find the lock address and load the displaced header from the stack.
|
// Find the lock address and load the displaced header from the stack.
|
||||||
// if the displaced header is zero, we have a recursive unlock.
|
// if the displaced header is zero, we have a recursive unlock.
|
||||||
load_and_test_long(displacedHeader, Address(box, BasicLock::displaced_header_offset_in_bytes()));
|
load_and_test_long(displacedHeader, Address(box, BasicLock::displaced_header_offset_in_bytes()));
|
||||||
z_bre(done);
|
z_bre(done);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle existing monitor.
|
// Handle existing monitor.
|
||||||
// The object has an existing monitor iff (mark & monitor_value) != 0.
|
// The object has an existing monitor iff (mark & monitor_value) != 0.
|
||||||
|
@ -3250,12 +3258,18 @@ void MacroAssembler::compiler_fast_unlock_object(Register oop, Register box, Reg
|
||||||
z_nill(currentHeader, markWord::monitor_value);
|
z_nill(currentHeader, markWord::monitor_value);
|
||||||
z_brne(object_has_monitor);
|
z_brne(object_has_monitor);
|
||||||
|
|
||||||
|
if (LockingMode != LM_MONITOR) {
|
||||||
// Check if it is still a light weight lock, this is true if we see
|
// Check if it is still a light weight lock, this is true if we see
|
||||||
// the stack address of the basicLock in the markWord of the object
|
// the stack address of the basicLock in the markWord of the object
|
||||||
// copy box to currentHeader such that csg does not kill it.
|
// copy box to currentHeader such that csg does not kill it.
|
||||||
z_lgr(currentHeader, box);
|
z_lgr(currentHeader, box);
|
||||||
z_csg(currentHeader, displacedHeader, 0, oop);
|
z_csg(currentHeader, displacedHeader, 0, oop);
|
||||||
z_bru(done); // Csg sets CR as desired.
|
z_bru(done); // Csg sets CR as desired.
|
||||||
|
} else {
|
||||||
|
// Set NE to indicate 'failure' -> take slow-path
|
||||||
|
z_ltgr(oop, oop);
|
||||||
|
z_bru(done);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle existing monitor.
|
// Handle existing monitor.
|
||||||
bind(object_has_monitor);
|
bind(object_has_monitor);
|
||||||
|
|
|
@ -1921,7 +1921,7 @@ bool Arguments::check_vm_args_consistency() {
|
||||||
FLAG_SET_CMDLINE(LockingMode, LM_MONITOR);
|
FLAG_SET_CMDLINE(LockingMode, LM_MONITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(X86) && !defined(AARCH64) && !defined(PPC64) && !defined(RISCV64)
|
#if !defined(X86) && !defined(AARCH64) && !defined(PPC64) && !defined(RISCV64) && !defined(S390)
|
||||||
if (LockingMode == LM_MONITOR) {
|
if (LockingMode == LM_MONITOR) {
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
jio_fprintf(defaultStream::error_stream(),
|
||||||
"LockingMode == 0 (LM_MONITOR) is not fully implemented on this architecture");
|
"LockingMode == 0 (LM_MONITOR) is not fully implemented on this architecture");
|
||||||
|
|
|
@ -486,7 +486,7 @@ void ObjectSynchronizer::handle_sync_on_value_based_class(Handle obj, JavaThread
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool useHeavyMonitors() {
|
static bool useHeavyMonitors() {
|
||||||
#if defined(X86) || defined(AARCH64) || defined(PPC64) || defined(RISCV64)
|
#if defined(X86) || defined(AARCH64) || defined(PPC64) || defined(RISCV64) || defined(S390)
|
||||||
return LockingMode == LM_MONITOR;
|
return LockingMode == LM_MONITOR;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @summary Exercise multithreaded maps, using only heavy monitors.
|
* @summary Exercise multithreaded maps, using only heavy monitors.
|
||||||
* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64"
|
* @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64" | os.arch == "s390x"
|
||||||
* @requires vm.debug
|
* @requires vm.debug
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run main/othervm/timeout=1600 -XX:+UseHeavyMonitors -XX:+VerifyHeavyMonitors MapLoops
|
* @run main/othervm/timeout=1600 -XX:+UseHeavyMonitors -XX:+VerifyHeavyMonitors MapLoops
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue