Skip to content

Commit

Permalink
No need to set _last_freeze_fail_result if preempted
Browse files Browse the repository at this point in the history
  • Loading branch information
reinrich committed Dec 2, 2024
1 parent a0f9b70 commit ce3ddf6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/hotspot/share/runtime/continuationFreezeThaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ class Config {
}

static freeze_result freeze_preempt(JavaThread* thread, intptr_t* const sp) {
freeze_result res = freeze_internal<SelfT, true>(thread, sp);
JFR_ONLY(assert((res == freeze_ok) || (res == thread->last_freeze_fail_result()), "freeze failure not set"));
return res;
return freeze_internal<SelfT, true>(thread, sp);
}

static intptr_t* thaw(JavaThread* thread, Continuation::thaw_kind kind) {
Expand Down Expand Up @@ -1669,21 +1667,20 @@ static inline freeze_result freeze_epilog(ContinuationWrapper& cont) {
return freeze_ok;
}

static freeze_result freeze_epilog(JavaThread* current, ContinuationWrapper& cont, freeze_result res) {
static freeze_result freeze_epilog(JavaThread* thread, ContinuationWrapper& cont, freeze_result res) {
if (UNLIKELY(res != freeze_ok)) {
JFR_ONLY(current->set_last_freeze_fail_result(res);)
JFR_ONLY(thread->set_last_freeze_fail_result(res);)
verify_continuation(cont.continuation());
log_develop_trace(continuations)("=== end of freeze (fail %d)", res);
return res;
}

JVMTI_ONLY(jvmti_yield_cleanup(current, cont)); // can safepoint
JVMTI_ONLY(jvmti_yield_cleanup(thread, cont)); // can safepoint
return freeze_epilog(cont);
}

static freeze_result preempt_epilog(JavaThread* current, ContinuationWrapper& cont, freeze_result res, frame& old_last_frame) {
static freeze_result preempt_epilog(ContinuationWrapper& cont, freeze_result res, frame& old_last_frame) {
if (UNLIKELY(res != freeze_ok)) {
JFR_ONLY(current->set_last_freeze_fail_result(res);)
verify_continuation(cont.continuation());
log_develop_trace(continuations)("=== end of freeze (fail %d)", res);
return res;
Expand Down Expand Up @@ -1727,7 +1724,9 @@ static inline freeze_result freeze_internal(JavaThread* current, intptr_t* const
log_develop_debug(continuations)("PINNED due to critical section/hold monitor");
verify_continuation(cont.continuation());
freeze_result res = entry->is_pinned() ? freeze_pinned_cs : freeze_pinned_monitor;
JFR_ONLY(current->set_last_freeze_fail_result(res);)
if (!preempt) {
JFR_ONLY(current->set_last_freeze_fail_result(res);)
}
log_develop_trace(continuations)("=== end of freeze (fail %d)", res);
// Avoid Thread.yield() loops without safepoint polls.
if (SafepointMechanism::should_process(current) && !preempt) {
Expand All @@ -1744,7 +1743,7 @@ static inline freeze_result freeze_internal(JavaThread* current, intptr_t* const
if (fast && freeze.size_if_fast_freeze_available() > 0) {
freeze.freeze_fast_existing_chunk();
CONT_JFR_ONLY(freeze.jfr_info().post_jfr_event(&event, oopCont, current);)
return !preempt ? freeze_epilog(cont) : preempt_epilog(current, cont, freeze_ok, freeze.last_frame());
return !preempt ? freeze_epilog(cont) : preempt_epilog(cont, freeze_ok, freeze.last_frame());
}

if (preempt) {
Expand All @@ -1754,7 +1753,7 @@ static inline freeze_result freeze_internal(JavaThread* current, intptr_t* const
freeze_result res = fast ? freeze.try_freeze_fast() : freeze.freeze_slow();

CONT_JFR_ONLY(freeze.jfr_info().post_jfr_event(&event, oopCont, current);)
preempt_epilog(current, cont, res, freeze.last_frame());
preempt_epilog(cont, res, freeze.last_frame());
return res;
}

Expand Down

0 comments on commit ce3ddf6

Please sign in to comment.