Skip to content

Commit ba1a305

Browse files
committed
8370509: [lworld] EnableValhalla is not needed for sync
Reviewed-by: phubner, fparain
1 parent c3b382e commit ba1a305

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7873,10 +7873,9 @@ void MacroAssembler::lightweight_lock(Register basic_lock, Register obj, Registe
78737873
// Try to lock. Transition lock bits 0b01 => 0b00
78747874
assert(oopDesc::mark_offset_in_bytes() == 0, "required to avoid lea");
78757875
orr(mark, mark, markWord::unlocked_value);
7876-
if (EnableValhalla) {
7877-
// Mask inline_type bit such that we go to the slow path if object is an inline type
7878-
andr(mark, mark, ~((int) markWord::inline_type_bit_in_place));
7879-
}
7876+
// Mask inline_type bit such that we go to the slow path if object is an inline type
7877+
andr(mark, mark, ~((int) markWord::inline_type_bit_in_place));
7878+
78807879
eor(t, mark, markWord::unlocked_value);
78817880
cmpxchg(/*addr*/ obj, /*expected*/ mark, /*new*/ t, Assembler::xword,
78827881
/*acquire*/ true, /*release*/ false, /*weak*/ false, noreg);

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10439,10 +10439,9 @@ void MacroAssembler::lightweight_lock(Register basic_lock, Register obj, Registe
1043910439
movptr(tmp, reg_rax);
1044010440
andptr(tmp, ~(int32_t)markWord::unlocked_value);
1044110441
orptr(reg_rax, markWord::unlocked_value);
10442-
if (EnableValhalla) {
10443-
// Mask inline_type bit such that we go to the slow path if object is an inline type
10444-
andptr(reg_rax, ~((int) markWord::inline_type_bit_in_place));
10445-
}
10442+
// Mask inline_type bit such that we go to the slow path if object is an inline type
10443+
andptr(reg_rax, ~((int) markWord::inline_type_bit_in_place));
10444+
1044610445
lock(); cmpxchgptr(tmp, Address(obj, oopDesc::mark_offset_in_bytes()));
1044710446
jcc(Assembler::notEqual, slow);
1044810447

src/hotspot/share/runtime/synchronizer.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,14 @@ static bool _no_progress_skip_increment = false;
315315
// These checks are required for wait, notify and exit to avoid inflating the monitor to
316316
// find out this inline type object cannot be locked.
317317
#define CHECK_THROW_NOSYNC_IMSE(obj) \
318-
if (EnableValhalla && (obj)->mark().is_inline_type()) { \
318+
if ((obj)->mark().is_inline_type()) { \
319319
JavaThread* THREAD = current; \
320320
ResourceMark rm(THREAD); \
321321
THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), obj->klass()->external_name()); \
322322
}
323323

324324
#define CHECK_THROW_NOSYNC_IMSE_0(obj) \
325-
if (EnableValhalla && (obj)->mark().is_inline_type()) { \
325+
if ((obj)->mark().is_inline_type()) { \
326326
JavaThread* THREAD = current; \
327327
ResourceMark rm(THREAD); \
328328
THROW_MSG_0(vmSymbols::java_lang_IllegalMonitorStateException(), obj->klass()->external_name()); \
@@ -354,7 +354,7 @@ bool ObjectSynchronizer::quick_notify(oopDesc* obj, JavaThread* current, bool al
354354
assert(current->thread_state() == _thread_in_Java, "invariant");
355355
NoSafepointVerifier nsv;
356356
if (obj == nullptr) return false; // slow-path for invalid obj
357-
assert(!EnableValhalla || !obj->klass()->is_inline_klass(), "monitor op on inline type");
357+
assert(!obj->klass()->is_inline_klass(), "monitor op on inline type");
358358
const markWord mark = obj->mark();
359359

360360
if (mark.is_fast_locked() && current->lock_stack().contains(cast_to_oop(obj))) {
@@ -446,7 +446,7 @@ void ObjectSynchronizer::enter_for(Handle obj, BasicLock* lock, JavaThread* lock
446446
// the locking_thread with respect to the current thread. Currently only used when
447447
// deoptimizing and re-locking locks. See Deoptimization::relock_objects
448448
assert(locking_thread == Thread::current() || locking_thread->is_obj_deopt_suspend(), "must be");
449-
assert(!EnableValhalla || !obj->klass()->is_inline_klass(), "JITed code should never have locked an instance of a value class");
449+
assert(!obj->klass()->is_inline_klass(), "JITed code should never have locked an instance of a value class");
450450
return LightweightSynchronizer::enter_for(obj, lock, locking_thread);
451451
}
452452

@@ -463,7 +463,7 @@ void ObjectSynchronizer::jni_enter(Handle obj, JavaThread* current) {
463463
handle_sync_on_value_based_class(obj, current);
464464
}
465465

466-
if (EnableValhalla && obj->klass()->is_inline_klass()) {
466+
if (obj->klass()->is_inline_klass()) {
467467
ResourceMark rm(THREAD);
468468
const char* desc = "Cannot synchronize on an instance of value class ";
469469
const char* className = obj->klass()->external_name();
@@ -681,10 +681,9 @@ static intptr_t install_hash_code(Thread* current, oop obj) {
681681
}
682682

683683
intptr_t ObjectSynchronizer::FastHashCode(Thread* current, oop obj) {
684-
if (EnableValhalla && obj->klass()->is_inline_klass()) {
685-
// VM should be calling bootstrap method
686-
ShouldNotReachHere();
687-
}
684+
// VM should be calling bootstrap method.
685+
assert(!obj->klass()->is_inline_klass(), "FastHashCode should not be called for inline classes");
686+
688687
if (UseObjectMonitorTable) {
689688
// Since the monitor isn't in the object header, the hash can simply be
690689
// installed in the object header.
@@ -786,7 +785,7 @@ intptr_t ObjectSynchronizer::FastHashCode(Thread* current, oop obj) {
786785

787786
bool ObjectSynchronizer::current_thread_holds_lock(JavaThread* current,
788787
Handle h_obj) {
789-
if (EnableValhalla && h_obj->mark().is_inline_type()) {
788+
if (h_obj->mark().is_inline_type()) {
790789
return false;
791790
}
792791
assert(current == JavaThread::current(), "Can only be called on current thread");

0 commit comments

Comments
 (0)