Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
ccdd279
Allow virtual threads to unmount while holding monitors
pchilano Oct 15, 2024
54813cd
Allow virtual threads to unmount when blocked on synchronized
pchilano Oct 16, 2024
21c3353
Allow virtual threads to unmount when blocked on Object.wait()
pchilano Oct 16, 2024
9baaff9
Test changes + JFR Updates + Library code changes
pchilano Oct 16, 2024
6a81ccd
Add PPC64 support
pchilano Oct 18, 2024
32840de
RISC-V: Avoid return misprediction
pchilano Oct 21, 2024
5c76442
Adjust comment in JavaThread.hpp
pchilano Oct 21, 2024
8c196ac
Adjust spacing in test JfrEvents.java
pchilano Oct 21, 2024
2ddbb3c
Revert and simplify changes to c1_Runtime1 on aarch64 and riscv
pchilano Oct 21, 2024
06f3732
Fix comments in c2 locking paths
pchilano Oct 21, 2024
f8616a5
remove usage of frame::metadata_words in possibly_adjust_frame()
pchilano Oct 21, 2024
fbd0cad
Fix typo in jvmtiExport.cpp
pchilano Oct 21, 2024
4cec62a
Move frame::saved_thread_address() to platform dependent files
pchilano Oct 21, 2024
23d1a2b
Fix comments in objectMonitor.hpp
pchilano Oct 21, 2024
81e5c6d
Make lea with RIP-relative addressing more general
pchilano Oct 22, 2024
b6bc98e
Address David's comments to ObjectMonitor.hpp
pchilano Oct 23, 2024
d43c084
Clear oops when thawing lockstack + add thaw_lockstack()
pchilano Oct 23, 2024
ab087a5
Fix comment in Thread.java
pchilano Oct 23, 2024
e232b7f
Rename timedWaitNonce to timedWaitSeqNo
pchilano Oct 23, 2024
baf7ffa
Minor fixes in inc/dec_held_monitor_count on aarch64 and riscv
pchilano Oct 23, 2024
0ebc3e9
Skip printing tid when not available
pchilano Oct 24, 2024
03ba6df
Fix comment in objectMonitor.hpp and javaThread.hpp
pchilano Oct 24, 2024
13353fd
Remove ObjectMonitor::set_owner_from_BasicLock()
pchilano Oct 24, 2024
d40d382
Rename nonce/nounce to seqNo in VirtualThread class
pchilano Oct 24, 2024
34362b9
Fix comments in javaThread.hpp and Thread.java
pchilano Oct 24, 2024
c7a82c4
Rename set/has_owner_anonymous to set/has_anonymous_owner
pchilano Oct 24, 2024
1785501
Fix JvmtiUnmountBeginMark
pchilano Oct 25, 2024
0308ee4
Add comments for Coleen
pchilano Oct 25, 2024
3479dba
Move condition to new line in nmethod::preserve_callee_argument_oops
pchilano Oct 25, 2024
d6313cf
Add/fix comments for David
pchilano Oct 25, 2024
4a9c030
remove interruptible check from conditional in Object::wait
pchilano Oct 25, 2024
66d5385
Restore use of atPointA in test StopThreadTest.java
pchilano Oct 25, 2024
7df17a3
Rename inflating_thread to locking_thread
pchilano Oct 28, 2024
1ff336b
Make member functions in ObjectWaiter const
pchilano Oct 28, 2024
c513ae3
add authenticate_return_address() in StubAssembler::epilogue
pchilano Oct 28, 2024
7cb4cff
Simplify set last_sp in prepare_freeze_interpreted_top_frame
pchilano Oct 28, 2024
bd918fa
extra suggestion to prepare_freeze_interpreted_top_frame
pchilano Oct 28, 2024
33cf05f
Remove generate_cont_resume_monitor_operation() + comment in ObjectSy…
pchilano Oct 28, 2024
fc9aa07
Fix vmStructs definitions
pchilano Oct 28, 2024
056d21e
Fix comment in VThreadWaitReenter
pchilano Oct 28, 2024
3e8b4fe
Improve comment in SharedRuntime::generate_native_wrapper
pchilano Oct 29, 2024
e4b0020
add assert in ThawBase::recurse_thaw_interpreted_frame
pchilano Oct 29, 2024
0f3b902
Add comments for Dean + move reload result_handler in generate_native…
pchilano Oct 29, 2024
1b695e5
Fix comment in continuation.hpp
pchilano Oct 30, 2024
9fd4c03
Add klass_name check for is_object_wait0
pchilano Oct 30, 2024
63003d3
Rename oopCont + fix in JvmtiUnmountBeginMark
pchilano Oct 30, 2024
749e30e
Add comment in call_VM_preemptable
pchilano Oct 30, 2024
aa682de
SmallRegisterMap::instance() fix + comment typo
pchilano Oct 30, 2024
0951dfe
Fix typos in comments
pchilano Oct 30, 2024
e342980
Comments for Dean
pchilano Oct 31, 2024
9f086c5
Add ObjectMonitor::successor() method + use ThreadIdentifier::initial()
pchilano Oct 31, 2024
12213a7
Use frame::sender_sp_offset in continuationFreezeThaw_riscv.inline.hpp
pchilano Oct 31, 2024
d09575f
Explicitly pass tmp register to inc/dec_held_monitor_count + use stat…
pchilano Oct 31, 2024
c92cb6b
Comment in FreezeBase::recurse_freeze + renames in continuation.hpp
pchilano Oct 31, 2024
aa263f5
Remove redundant assert in ObjectMonitor::VThreadEpilog
pchilano Oct 31, 2024
7354f60
Remove assignments in preempt_kind enum
pchilano Oct 31, 2024
e5a9ce2
add comment to ThreadService::find_deadlocks_at_safepoint
pchilano Oct 31, 2024
60e4325
Merge branch 'master' into JDK-8338383
pchilano Nov 1, 2024
0f0f71a
Remove oop clearing in transfer_lockstack + pass _barriers as argument
pchilano Nov 1, 2024
dac94da
Add comment in X509TrustManagerImpl.java
pchilano Nov 1, 2024
113fb3d
Fix comments for David
pchilano Nov 1, 2024
33eb638
Revert fixes after 8343132
pchilano Nov 1, 2024
52c2664
Use lazySubmitRunContinuation when blocking
pchilano Nov 1, 2024
9752ece
Remove ThawBase::possibly_adjust_frame()
pchilano Nov 2, 2024
1f3cfce
Fix issue with unmounted virtual thread when dumping heap
pchilano Nov 3, 2024
1139631
Update comment block in objectMonitor.cpp
pchilano Nov 3, 2024
b3de8f6
Use freeze_result consistently
pchilano Nov 4, 2024
fbd43e5
Improve JFR pinned reason in event
pchilano Nov 4, 2024
e18b2be
Revert suggestion to ThawBase::new_stack_frame
pchilano Nov 5, 2024
b6ed182
Rename waitTimeout/set_waitTimeout accessors
pchilano Nov 5, 2024
79189f9
Add oopDesc::has_klass_gap() check
pchilano Nov 5, 2024
81434a2
Fix s390x failures
pchilano Nov 5, 2024
e5c18ba
Fix return miss prediction in generate_native_entry for riscv
pchilano Nov 5, 2024
124efa0
Fixes to JFR metadata.xml
pchilano Nov 5, 2024
c0c7e6c
Use ThreadIdentifier::initial() in ObjectMonitor::owner_from()
pchilano Nov 5, 2024
6a3f5f3
Add ReflectionCallerCacheTest.java to test/jdk/ProblemList-Xcomp.txt
pchilano Nov 6, 2024
2001fba
Update comment for _cont_fastpath
pchilano Nov 6, 2024
89d6dc7
Add --enable-native-access=ALL-UNNAMED to SynchronizedNative.java
pchilano Nov 6, 2024
678676a
Move load of _lock_id in C2_MacroAssembler::fast_lock
pchilano Nov 6, 2024
211c6c8
Use is_top_frame boolean in FreezeBase::check_valid_fast_path()
pchilano Nov 6, 2024
37e3017
Use JvmtiVTMSTransitionDisabler::VTMS_vthread_mount/unmount
pchilano Nov 5, 2024
f27c59c
Add @requires vm.continuations to CancelTimerWithContention.java
pchilano Nov 7, 2024
5210f0c
Merge branch 'master' into JDK-8338383
pchilano Nov 7, 2024
62b16c6
Use get_method_name + copyright revert in jvmtiThreadState.cpp
pchilano Nov 7, 2024
1814e33
Add ObjectWaiter::at_monitorenter
pchilano Nov 8, 2024
3cdb8f8
Fix in JvmtiEnvBase::get_locked_objects_in_frame()
pchilano Nov 8, 2024
3ce6663
Merge branch 'master' into JDK-8338383
pchilano Nov 8, 2024
97a8a82
Pass -XX:-UseCompactObjectHeaders in test JNIMonitor.java
pchilano Nov 11, 2024
5878759
Test StopThreadTest.java: fix operator in condition + improve names
pchilano Nov 11, 2024
0fe6046
Merge branch 'master' into JDK-8338383
pchilano Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1648,8 +1648,8 @@ int MachCallRuntimeNode::ret_addr_offset() {
// for real runtime callouts it will be six instructions
// see aarch64_enc_java_to_runtime
// adr(rscratch2, retaddr)
// str(rscratch2, Address(rthread, JavaThread::last_Java_pc_offset()));
// lea(rscratch1, RuntimeAddress(addr)
// stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize)))
// blr(rscratch1)
CodeBlob *cb = CodeCache::find_blob(_entry_point);
if (cb) {
Expand Down Expand Up @@ -3692,14 +3692,13 @@ encode %{
__ post_call_nop();
} else {
Label retaddr;
// Make the anchor frame walkable
__ adr(rscratch2, retaddr);
__ str(rscratch2, Address(rthread, JavaThread::last_Java_pc_offset()));
__ lea(rscratch1, RuntimeAddress(entry));
// Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc()
__ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize)));
__ blr(rscratch1);
__ bind(retaddr);
__ post_call_nop();
__ add(sp, sp, 2 * wordSize);
}
if (Compile::current()->max_vector_size() > 0) {
__ reinitialize_ptrue();
Expand Down
22 changes: 0 additions & 22 deletions src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,28 +292,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
patch_callee_link(f, fp);
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
intptr_t* sp = top.sp();
CodeBlob* cb = top.cb();

if (cb->frame_size() == 2) {
// C2 runtime stub case. For aarch64 the real size of the c2 runtime stub is 2 words bigger
// than what we think, i.e. size is 4. This is because the _last_Java_sp is not set to the
// sp right before making the call to the VM, but rather it is artificially set 2 words above
// this real sp so that we can store the return address at last_Java_sp[-1], and keep this
// property where we can retrieve the last_Java_pc from the last_Java_sp. But that means that
// once we return to the runtime stub, the code will adjust sp according to this real size.
// So we must adjust the frame size back here and we copy lr/rfp again.
sp -= 2;
sp[-2] = sp[0];
sp[-1] = sp[1];

log_develop_trace(continuations, preempt)("adjusted sp for c2 runtime stub, initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT
" fp: " INTPTR_FORMAT, p2i(sp + 2), p2i(sp), sp[-2]);
}
return sp;
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
frame enterSpecial = new_entry_frame();
intptr_t* sp = enterSpecial.sp();
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/arm/continuationFreezeThaw_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
Unimplemented();
return nullptr;
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
Unimplemented();
return nullptr;
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,6 @@ inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, c
// Keep top_frame_sp relativized.
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
// Nothing to do
return top.sp();
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
frame enterSpecial = new_entry_frame();
frame::common_abi* enterSpecial_abi = (frame::common_abi*)enterSpecial.sp();
Expand Down
22 changes: 0 additions & 22 deletions src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
patch_callee_link(f, fp);
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
intptr_t* sp = top.sp();
CodeBlob* cb = top.cb();

if (cb->frame_size() == 2) {
// C2 runtime stub case. For riscv64 the real size of the c2 runtime stub is 2 words bigger
// than what we think, i.e. size is 4. This is because the _last_Java_sp is not set to the
// sp right before making the call to the VM, but rather it is artificially set 2 words above
// this real sp so that we can store the return address at last_Java_sp[-1], and keep this
// property where we can retrieve the last_Java_pc from the last_Java_sp. But that means that
// once we return to the runtime stub, the code will adjust sp according to this real size.
// So we must adjust the frame size back here and we copy ra/fp again.
sp -= 2;
sp[-2] = sp[0];
sp[-1] = sp[1];

log_develop_trace(continuations, preempt)("adjusted sp for c2 runtime stub, initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT
" fp: " INTPTR_FORMAT, p2i(sp + 2), p2i(sp), sp[-2]);
}
return sp;
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
frame enterSpecial = new_entry_frame();
intptr_t* sp = enterSpecial.sp();
Expand Down
19 changes: 8 additions & 11 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1259,21 +1259,20 @@ int MachCallRuntimeNode::ret_addr_offset() {
// jal(addr)
// or with far branches
// jal(trampoline_stub)
// for real runtime callouts it will be 9 instructions
// for real runtime callouts it will be 8 instructions
// see riscv_enc_java_to_runtime
// la(t0, retaddr) -> auipc + addi
// addi(sp, sp, -2 * wordSize) -> addi
// sd(t0, Address(sp, wordSize)) -> sd
// movptr(t1, addr, offset, t0) -> lui + lui + slli + add
// jalr(t1, offset) -> jalr
// la(t0, retaddr) -> auipc + addi
// sd(t0, Address(xthread, JavaThread::last_Java_pc_offset())) -> sd
// movptr(t1, addr, offset, t0) -> lui + lui + slli + add
// jalr(t1, offset) -> jalr
CodeBlob *cb = CodeCache::find_blob(_entry_point);
if (cb != nullptr) {
if (UseTrampolines) {
return 1 * NativeInstruction::instruction_size;
}
return 3 * NativeInstruction::instruction_size;
} else {
return 9 * NativeInstruction::instruction_size;
return 8 * NativeInstruction::instruction_size;
}
}

Expand Down Expand Up @@ -2504,17 +2503,15 @@ encode %{
__ post_call_nop();
} else {
Label retaddr;
// Make the anchor frame walkable
__ la(t0, retaddr);
// Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc()
__ addi(sp, sp, -2 * wordSize);
__ sd(t0, Address(sp, wordSize));
__ sd(t0, Address(xthread, JavaThread::last_Java_pc_offset()));
int32_t offset = 0;
// No relocation needed
__ movptr(t1, entry, offset, t0); // lui + lui + slli + add
__ jalr(t1, offset);
__ bind(retaddr);
__ post_call_nop();
__ addi(sp, sp, 2 * wordSize);
}
%}

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/s390/continuationFreezeThaw_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
Unimplemented();
return nullptr;
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
Unimplemented();
return nullptr;
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
patch_callee_link(f, fp);
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
// Nothing to do
return top.sp();
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
frame enterSpecial = new_entry_frame();
intptr_t* sp = enterSpecial.sp();
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/zero/continuationFreezeThaw_zero.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::possibly_adjust_frame(frame& top) {
Unimplemented();
return nullptr;
}

inline intptr_t* ThawBase::push_cleanup_continuation() {
Unimplemented();
return nullptr;
Expand Down
44 changes: 14 additions & 30 deletions src/hotspot/share/runtime/continuationFreezeThaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ inline void clear_anchor(JavaThread* thread) {
thread->frame_anchor()->clear();
}

static void set_anchor(JavaThread* thread, intptr_t* sp, address pc = nullptr) {
if (pc == nullptr) {
pc = ContinuationHelper::return_address_at(
sp - frame::sender_sp_ret_address_offset());
}
static void set_anchor(JavaThread* thread, intptr_t* sp, address pc) {
assert(pc != nullptr, "");

JavaFrameAnchor* anchor = thread->frame_anchor();
Expand All @@ -325,6 +321,12 @@ static void set_anchor(JavaThread* thread, intptr_t* sp, address pc = nullptr) {
assert(thread->last_frame().cb() != nullptr, "");
}

static void set_anchor(JavaThread* thread, intptr_t* sp) {
address pc = ContinuationHelper::return_address_at(
sp - frame::sender_sp_ret_address_offset());
set_anchor(thread, sp, pc);
}

static void set_anchor_to_entry(JavaThread* thread, ContinuationEntry* entry) {
JavaFrameAnchor* anchor = thread->frame_anchor();
anchor->set_last_Java_sp(entry->entry_sp());
Expand Down Expand Up @@ -1839,7 +1841,6 @@ static int thaw_size(stackChunkOop chunk) {
int size = chunk->max_thawing_size();
size += frame::metadata_words; // For the top pc+fp in push_return_frame or top = stack_sp - frame::metadata_words in thaw_fast
size += 2*frame::align_wiggle; // in case of alignments at the top and bottom
size += frame::metadata_words; // for preemption case (see possibly_adjust_frame)
return size;
}

Expand Down Expand Up @@ -1925,7 +1926,6 @@ class ThawBase : public StackObj {
void patch_return(intptr_t* sp, bool is_last);

intptr_t* handle_preempted_continuation(intptr_t* sp, Continuation::preempt_kind preempt_kind, bool fast_case);
inline intptr_t* possibly_adjust_frame(frame& top);
inline intptr_t* push_cleanup_continuation();
void throw_interrupted_exception(JavaThread* current, frame& top);

Expand Down Expand Up @@ -2481,8 +2481,6 @@ intptr_t* ThawBase::handle_preempted_continuation(intptr_t* sp, Continuation::pr
// we need to adjust the current thread saved in the stub frame before restoring registers.
JavaThread** thread_addr = frame::saved_thread_address(top);
if (thread_addr != nullptr) *thread_addr = _thread;
// Some platforms require the size of the runtime frame to be adjusted.
sp = possibly_adjust_frame(top);
}
return sp;
}
Expand Down Expand Up @@ -2963,29 +2961,15 @@ static void log_frames(JavaThread* thread) {
static void log_frames_after_thaw(JavaThread* thread, ContinuationWrapper& cont, intptr_t* sp, bool preempted) {
intptr_t* sp0 = sp;
address pc0 = *(address*)(sp - frame::sender_sp_ret_address_offset());
bool use_cont_entry = false;

// Some preemption cases need to use and adjusted version of sp.
if (preempted) {
if (sp0 == cont.entrySP()) {
// Still preempted (monitor not acquired) so no frames were thawed.
assert(cont.tail()->preempted(), "");
use_cont_entry = true;
}
#if defined (AARCH64) || defined (RISCV64)
else {
CodeBlob* cb = CodeCache::find_blob(pc0);
if (cb->frame_size() == 2) {
assert(cb->is_runtime_stub(), "");
// Returning to c2 runtime stub requires extra adjustment on aarch64
// and riscv64 (see possibly_adjust_frame()).
sp0 += frame::metadata_words;
}
}
#endif

if (preempted && sp0 == cont.entrySP()) {
// Still preempted (monitor not acquired) so no frames were thawed.
assert(cont.tail()->preempted(), "");
set_anchor(thread, cont.entrySP(), cont.entryPC());
} else {
set_anchor(thread, sp0);
}

set_anchor(thread, use_cont_entry ? cont.entrySP() : sp0, use_cont_entry ? cont.entryPC() : nullptr);
log_frames(thread);
if (LoomVerifyAfterThaw) {
assert(do_verify_after_thaw(thread, cont.tail(), tty), "");
Expand Down
35 changes: 22 additions & 13 deletions src/hotspot/share/runtime/objectMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,34 @@ static void post_virtual_thread_pinned_event(JavaThread* current, const char* re
// Theory of operations -- Monitors lists, thread residency, etc:
//
// * A thread acquires ownership of a monitor by successfully
// CAS()ing the _owner field from null to non-null.
// CAS()ing the _owner field from NO_OWNER/DEFLATER_MARKER to
// its tid (return value from owner_from()).
//
// * Invariant: A thread appears on at most one monitor list --
// cxq, EntryList or WaitSet -- at any one time.
//
// * Contending threads "push" themselves onto the cxq with CAS
// and then spin/park.
// If the thread is a virtual thread it will first attempt to
// unmount itself. The virtual thread will first try to freeze
// all frames in the heap. If the operation fails it will just
// follow the regular path for platform threads. If the operation
// succeeds, it will push itself onto the cxq with CAS and then
// return back to Java to continue the unmount logic.
//
// * After a contending thread eventually acquires the lock it must
// dequeue itself from either the EntryList or the cxq.
//
// * The exiting thread identifies and unparks an "heir presumptive"
// tentative successor thread on the EntryList. Critically, the
// exiting thread doesn't unlink the successor thread from the EntryList.
// After having been unparked, the wakee will recontend for ownership of
// the monitor. The successor (wakee) will either acquire the lock or
// re-park itself.
// tentative successor thread on the EntryList. In case the successor
// is an unmounted virtual thread, the exiting thread will first try
// to add it to the list of vthreads waiting to be unblocked, and on
// success it will unpark the special unblocker thread instead, which
// will be in charge of submitting the vthread back to the scheduler
// queue. Critically, the exiting thread doesn't unlink the successor
// thread from the EntryList. After having been unparked/re-scheduled,
// the wakee will recontend for ownership of the monitor. The successor
// (wakee) will either acquire the lock or re-park/unmount itself.
//
// Succession is provided for by a policy of competitive handoff.
// The exiting thread does _not_ grant or pass ownership to the
Expand Down Expand Up @@ -210,20 +221,18 @@ static void post_virtual_thread_pinned_event(JavaThread* current, const char* re
//
// * The monitor synchronization subsystem avoids the use of native
// synchronization primitives except for the narrow platform-specific
// park-unpark abstraction. See the comments in os_solaris.cpp regarding
// park-unpark abstraction. See the comments in os_posix.cpp regarding
// the semantics of park-unpark. Put another way, this monitor implementation
// depends only on atomic operations and park-unpark. The monitor subsystem
// manages all RUNNING->BLOCKED and BLOCKED->READY transitions while the
// underlying OS manages the READY<->RUN transitions.
// depends only on atomic operations and park-unpark.
//
// * Waiting threads reside on the WaitSet list -- wait() puts
// the caller onto the WaitSet.
//
// * notify() or notifyAll() simply transfers threads from the WaitSet to
// either the EntryList or cxq. Subsequent exit() operations will
// unpark the notifyee. Unparking a notifee in notify() is inefficient -
// it's likely the notifyee would simply impale itself on the lock held
// by the notifier.
// unpark/re-schedule the notifyee. Unparking/re-scheduling a notifyee in
// notify() is inefficient - it's likely the notifyee would simply impale
// itself on the lock held by the notifier.

// Check that object() and set_object() are called from the right context:
static void check_object_context() {
Expand Down
9 changes: 6 additions & 3 deletions src/hotspot/share/services/heapDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1875,9 +1875,12 @@ void ThreadDumper::dump_stack_refs(AbstractDumpWriter * writer) {
// native frame
blk.set_frame_number(depth);
if (is_top_frame) {
// JNI locals for the top frame.
assert(_java_thread != nullptr, "impossible for unmounted vthread");
_java_thread->active_handles()->oops_do(&blk);
// JNI locals for the top frame if mounted
assert(_java_thread != nullptr || jvf->method()->is_synchronized()
|| jvf->method()->is_object_wait0(), "impossible for unmounted vthread");
if (_java_thread != nullptr) {
_java_thread->active_handles()->oops_do(&blk);
}
} else {
if (last_entry_frame != nullptr) {
// JNI locals for the entry frame
Expand Down
Loading