Skip to content

Commit 15f9fbf

Browse files
authored
Merge pull request #22191 from tajila/vt3
Handle decompile paths when mounting a vthread
2 parents 1ed6b9d + fde9917 commit 15f9fbf

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

runtime/vm/BytecodeInterpreter.hpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5809,8 +5809,9 @@ class INTERPRETER_CLASS
58095809
}
58105810
#if JAVA_SPEC_VERSION >= 24
58115811
j9object_t syncObject = J9VMJDKINTERNALVMCONTINUATION_BLOCKER(_currentThread, continuationObject);
5812-
5813-
switch (_currentThread->currentContinuation->returnState) {
5812+
UDATA returnState = _currentThread->currentContinuation->returnState;
5813+
_currentThread->currentContinuation->returnState = 0;
5814+
switch (returnState) {
58145815
case J9VM_CONTINUATION_RETURN_FROM_YIELD:
58155816
returnSingleFromINL(REGISTER_ARGS, JNI_TRUE, 1);
58165817
break;
@@ -5878,8 +5879,21 @@ class INTERPRETER_CLASS
58785879
case J9VM_CONTINUATION_RETURN_FROM_JIT_MONITOR_ENTER: {
58795880
rc = tryEnterBlockingMonitor(REGISTER_ARGS, syncObject, J9VM_CONTINUATION_RETURN_FROM_JIT_MONITOR_ENTER);
58805881
if ((NULL != _currentThread->currentContinuation) && (EXECUTE_BYTECODE == rc)) {
5881-
void *returnAddress = restoreJITResolveFrame(REGISTER_ARGS);
5882-
VMStructHasBeenUpdated(REGISTER_ARGS);
5882+
J9SFJITResolveFrame *resolveFrame = (J9SFJITResolveFrame*)_currentThread->sp;
5883+
void *returnAddress = NULL;
5884+
J9JITDecompilationInfo *decompilationStack = _currentThread->decompilationStack;
5885+
if ((NULL != decompilationStack) && ((void **)&resolveFrame->returnAddress == (void **)decompilationStack->pcAddress)) {
5886+
/*
5887+
* The return address has been patched to point to the decompile helper. This helper assumes the
5888+
* JIT resolve frame is still on the stack. Instead of popping the resolve frame just jump to the return
5889+
* address and leave the frame in place. The decompile helper will pop the frame.
5890+
*/
5891+
returnAddress = resolveFrame->returnAddress;
5892+
} else {
5893+
returnAddress = restoreJITResolveFrame(REGISTER_ARGS);
5894+
VMStructHasBeenUpdated(REGISTER_ARGS);
5895+
}
5896+
58835897
rc = promotedMethodOnTransitionFromJIT(REGISTER_ARGS, returnAddress, _vm->jitConfig->jitExitInterpreter0RestoreAll, true);
58845898
}
58855899
break;

0 commit comments

Comments
 (0)