-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8369238: Allow virtual thread preemption on some common class initialization paths #27802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
60cbca4
88844bf
d035366
79fce80
ac55715
9f4436a
30bdf49
6882db0
6000edb
a943c83
0e483ba
2786b1d
bea5620
1312486
3bf8ebd
4cecd7e
c7d6f5c
ffcd92a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,6 +202,8 @@ inline intptr_t* AnchorMark::anchor_mark_set_pd() { | |
| assert(_last_sp_from_frame != nullptr, ""); | ||
| _top_frame.interpreter_frame_set_last_sp(nullptr); | ||
| if (sp != _last_sp_from_frame) { | ||
| // We need to move up return pc and fp. They will be read next in | ||
| // set_anchor() and set as _last_Java_pc and _last_Java_fp respectively. | ||
| _last_sp_from_frame[-1] = (intptr_t)_top_frame.pc(); | ||
| _last_sp_from_frame[-2] = (intptr_t)_top_frame.fp(); | ||
| } | ||
|
|
@@ -322,15 +324,16 @@ inline intptr_t* ThawBase::push_cleanup_continuation() { | |
| frame enterSpecial = new_entry_frame(); | ||
| intptr_t* sp = enterSpecial.sp(); | ||
|
|
||
| // We only need to set the return pc. rbp will be restored back in gen_continuation_enter(). | ||
| sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc(); | ||
| sp[-2] = (intptr_t)enterSpecial.fp(); | ||
| return sp; | ||
| } | ||
|
|
||
| inline intptr_t* ThawBase::push_preempt_adapter() { | ||
| frame enterSpecial = new_entry_frame(); | ||
| intptr_t* sp = enterSpecial.sp(); | ||
|
|
||
| // We only need to set the return pc. rbp will be restored back in generate_cont_preempt_stub(). | ||
| sp[-1] = (intptr_t)StubRoutines::cont_preempt_stub(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here sp-2 ? |
||
| return sp; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1683,10 +1683,9 @@ static void jvmti_yield_cleanup(JavaThread* thread, ContinuationWrapper& cont) { | |
| static void jvmti_mount_end(JavaThread* current, ContinuationWrapper& cont, frame top, Continuation::preempt_kind pk) { | ||
| assert(current->vthread() != nullptr, "must be"); | ||
|
|
||
| HandleMarkCleaner hm(current); // Cleanup vth and so._conth Handles | ||
| HandleMarkCleaner hm(current); // Cleanup all handles (including so._conth) before returning to Java. | ||
| Handle vth(current, current->vthread()); | ||
| ContinuationWrapper::SafepointOp so(current, cont); | ||
|
|
||
| AnchorMark am(current, top); // Set anchor so that the stack is walkable. | ||
|
|
||
| JRT_BLOCK | ||
|
|
@@ -2352,12 +2351,12 @@ NOINLINE intptr_t* Thaw<ConfigT>::thaw_fast(stackChunkOop chunk) { | |
| #endif | ||
|
|
||
| #ifdef ASSERT | ||
| set_anchor(_thread, rs.sp()); | ||
| log_frames(_thread); | ||
| if (LoomDeoptAfterThaw) { | ||
| frame top(rs.sp()); | ||
| AnchorMark am(_thread, top); | ||
| log_frames(_thread); | ||
| do_deopt_after_thaw(_thread); | ||
| } | ||
| clear_anchor(_thread); | ||
| #endif | ||
|
|
||
| return rs.sp(); | ||
|
|
@@ -2684,7 +2683,7 @@ intptr_t* ThawBase::redo_vmcall(JavaThread* current, frame& top) { | |
| intptr_t* sp = top.sp(); | ||
|
|
||
| { | ||
| HandleMarkCleaner hmc(current); // Cleanup so._conth Handle | ||
| HandleMarkCleaner hmc(current); // Cleanup all handles (including so._conth) before returning to Java. | ||
| ContinuationWrapper::SafepointOp so(current, _cont); | ||
| AnchorMark am(current, top); // Set the anchor so that the stack is walkable. | ||
|
|
||
|
|
@@ -2731,10 +2730,9 @@ intptr_t* ThawBase::redo_vmcall(JavaThread* current, frame& top) { | |
| } | ||
|
|
||
| void ThawBase::throw_interrupted_exception(JavaThread* current, frame& top) { | ||
| HandleMarkCleaner hm(current); // Cleanup so._conth Handle | ||
| HandleMarkCleaner hm(current); // Cleanup all handles (including so._conth) before returning to Java. | ||
| ContinuationWrapper::SafepointOp so(current, _cont); | ||
| // Since we might safepoint set the anchor so that the stack can be walked. | ||
| set_anchor(current, top.sp()); | ||
| AnchorMark am(current, top); // Set the anchor so that the stack is walkable. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't you delete the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good catch. Removed. |
||
| JRT_BLOCK | ||
| THROW(vmSymbols::java_lang_InterruptedException()); | ||
| JRT_BLOCK_END | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push_cleanup_continuation sets sp[-2]. This doesn't have to set that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push_cleanup_continuation()doesn’t need it. I removed it there and added a comment on both methods.