8344935: [ubsan]: javaThread.hpp:1241:52: runtime error: load of value 9831830, which is not a valid value for type 'freeze_result'

Co-authored-by: Richard Reingruber <rrich@openjdk.org>
Reviewed-by: rrich, pchilanomate
This commit is contained in:
Matthias Baesken 2024-12-04 08:11:33 +00:00
parent 943aa033ae
commit cf1eb58d67
2 changed files with 11 additions and 2 deletions

View File

@ -256,7 +256,9 @@ public:
using OopT = std::conditional_t<oops == oop_kind::NARROW, narrowOop, oop>;
static freeze_result freeze(JavaThread* thread, intptr_t* const sp) {
return freeze_internal<SelfT, false>(thread, sp);
freeze_result res = freeze_internal<SelfT, false>(thread, sp);
JFR_ONLY(assert((res == freeze_ok) || (res == thread->last_freeze_fail_result()), "freeze failure not set"));
return res;
}
static freeze_result freeze_preempt(JavaThread* thread, intptr_t* const sp) {
@ -1722,6 +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;
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) {

View File

@ -518,6 +518,10 @@ JavaThread::JavaThread(MemTag mem_tag) :
_SleepEvent(ParkEvent::Allocate(this)),
#if INCLUDE_JFR
_last_freeze_fail_result(freeze_ok),
#endif
_lock_stack(this),
_om_cache(this) {
set_jni_functions(jni_functions());
@ -2361,4 +2365,4 @@ void JavaThread::post_vthread_pinned_event(EventVirtualThreadPinned* event, cons
event->commit();
}
}
#endif
#endif