From 10291b2fd154c031978e0aba20460d46a404fe9e Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Thu, 22 Aug 2024 16:41:44 -0400 Subject: [PATCH] Return early from isFSDNeeded under -XX:+DebugOnRestore Under -XX:+DebugOnRestore, the VM will enable some capabilities that will be reset on restore (if the user does not want debug on restore). However, if the JIT detects these capabilities via the J9HookDisable call, there is no way for the JIT to know whether the capability was set by the VM or a user pre-checkpoint. With the recent change to the isDebugOnRestoreEnabled to check if a uesr specified an JDWP agent pre-checkpoint, the JIT can simply return early from isFSDNeeded. Under -XX:+DebugOnRestore, the JIT already generates FSD code so there is on need to check the caps that were set by the VM pre-checkpoint. isFSDNeeded is called on restore, so at that point it is appropriate for the JIT to execute the rest of the method at that point. Signed-off-by: Irwin D'Souza --- runtime/compiler/control/J9Options.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/compiler/control/J9Options.cpp b/runtime/compiler/control/J9Options.cpp index fcff06001e0..25c1fdc5cee 100644 --- a/runtime/compiler/control/J9Options.cpp +++ b/runtime/compiler/control/J9Options.cpp @@ -3020,6 +3020,17 @@ J9::Options::fePostProcessAOT(void * base) bool J9::Options::isFSDNeeded(J9JavaVM *javaVM, J9HookInterface **vmHooks) { +#if defined(J9VM_OPT_CRIU_SUPPORT) + J9VMThread * vmThread = javaVM->internalVMFunctions->currentVMThread(javaVM); + if (javaVM->internalVMFunctions->isCheckpointAllowed(vmThread)) + { + if (javaVM->internalVMFunctions->isDebugOnRestoreEnabled(vmThread)) + { + return false; + } + } +#endif + return #if defined(J9VM_JIT_FULL_SPEED_DEBUG) (javaVM->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_CAN_ACCESS_LOCALS) ||