diff --git a/src/hotspot/share/prims/jvmtiThreadState.cpp b/src/hotspot/share/prims/jvmtiThreadState.cpp index fc965e568f7..d292fe9a645 100644 --- a/src/hotspot/share/prims/jvmtiThreadState.cpp +++ b/src/hotspot/share/prims/jvmtiThreadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,6 +124,10 @@ JvmtiThreadState::JvmtiThreadState(JavaThread* thread, oop thread_oop) } thread->set_interp_only_mode(false); } + if (JvmtiEnvBase::is_thread_carrying_vthread(thread, thread_oop)) { + _thread_saved = thread; + _thread = nullptr; + } }