Skip to content

Commit

Permalink
Merge pull request #19754 from JasonFengJ9/jdwpoptionfile
Browse files Browse the repository at this point in the history
CRIU supports Java debugger via the restore option file
  • Loading branch information
tajila authored Sep 18, 2024
2 parents 5bf2f17 + f812cad commit ebe8718
Show file tree
Hide file tree
Showing 15 changed files with 614 additions and 221 deletions.
15 changes: 15 additions & 0 deletions runtime/jvmti/j9jvmti.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -683,3 +683,18 @@ TraceEntry=Trc_JVMTI_jvmtiHookVMCheckpoint_Entry Overhead=1 Level=2 Noenv Templa
TraceExit=Trc_JVMTI_jvmtiHookVMCheckpoint_Exit Overhead=1 Level=2 Noenv Template="HookVMCheckpoint"
TraceEntry=Trc_JVMTI_jvmtiHookVMRestore_Entry Overhead=1 Level=2 Noenv Template="HookVMRestore"
TraceExit=Trc_JVMTI_jvmtiHookVMRestore_Exit Overhead=1 Level=2 Noenv Template="HookVMRestore"

TraceEvent=Trc_JVMTI_jvmtiAddCapabilities_no_capability Overhead=1 Level=1 Template="jvmtiAddCapabilities() failed: ~(((U_8 *) &potentialCapabilities)[%zu] = %x, result (%x)"
TraceEvent=Trc_JVMTI_jvmtiAddCapabilities_not_onload Overhead=1 Level=1 Template="jvmtiAddCapabilities() failed: not JVMTI_PHASE_ONLOAD"
TraceEvent=Trc_JVMTI_jvmtiAddCapabilities_object_alloc_set_already Overhead=1 Level=1 Template="jvmtiAddCapabilities() failed: J9JVMTI_FLAG_SAMPLED_OBJECT_ALLOC_ENABLED was set"
TraceEvent=Trc_JVMTI_jvmtiAddCapabilities_mapCapabilitiesToEvents_failed Overhead=1 Level=1 Template="jvmtiAddCapabilities() failed: mapCapabilitiesToEvents()"
TraceEvent=Trc_JVMTI_jvmtiAddCapabilities_hookNonEventCapabilities_failed Overhead=1 Level=1 Template="jvmtiAddCapabilities() failed: hookNonEventCapabilities()"

TraceEvent=Trc_JVMTI_criuAddCapabilities_invoked Noenv Overhead=1 Level=3 Template="CRIU adds capabilities before checkpoint"
TraceEvent=Trc_JVMTI_createAgentLibraryWithOption_OOM Noenv Overhead=1 Level=3 Template="createAgentLibraryWithOption j9mem_allocate_memory OOM"
TraceEvent=Trc_JVMTI_createAgentLibraryWithOption_Xrunjdwp_result Noenv Overhead=1 Level=3 Template="createAgentLibraryWithOption Xrunjdwp optionsPtr (%s) optionsLengthTmp (%zu) agentLibrary (%p) result (%d)"
TraceEvent=Trc_JVMTI_createAgentLibraryWithOption_agentlib_result Noenv Overhead=1 Level=3 Template="createAgentLibraryWithOption optionsPtr (%s) libraryLength (%zu) options (%s) optionsLength (%zu) agentLibrary (%p) result (%d)"
TraceEntry=Trc_JVMTI_jvmtiHookVMRestoreCRIUInit_Entry Overhead=1 Level=3 Noenv Template="jvmtiHookVMRestoreCRIUInit"
TraceExit=Trc_JVMTI_jvmtiHookVMRestoreCRIUInit_Exit Overhead=1 Level=3 Noenv Template="jvmtiHookVMRestoreCRIUInit"
TraceEntry=Trc_JVMTI_jvmtiHookVMRestoreStartAgent_Entry Overhead=1 Level=3 Noenv Template="jvmtiHookVMRestoreStartAgent"
TraceExit=Trc_JVMTI_jvmtiHookVMRestoreStartAgent_Exit Overhead=1 Level=3 Noenv Template="jvmtiHookVMRestoreStartAgent"
119 changes: 69 additions & 50 deletions runtime/jvmti/jvmtiCapability.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ jvmtiAddCapabilities(jvmtiEnv* env,

/* Make sure all of the requested capabilities are available */

if ((byte & ~(((U_8 *) &potentialCapabilities)[i])) != 0) {
if (0 != (byte & ~(((U_8 *) &potentialCapabilities)[i]))) {
Trc_JVMTI_jvmtiAddCapabilities_no_capability(currentThread,
i, ((U_8 *) &potentialCapabilities)[i], (byte & ~(((U_8 *) &potentialCapabilities)[i])));
goto fail;
}

Expand All @@ -382,6 +384,7 @@ jvmtiAddCapabilities(jvmtiEnv* env,
vm->requiredDebugAttributes |= J9VM_DEBUG_ATTRIBUTE_MAINTAIN_ORIGINAL_METHOD_ORDER;
} else {
rc = JVMTI_ERROR_NOT_AVAILABLE;
Trc_JVMTI_jvmtiAddCapabilities_not_onload(currentThread);
goto fail;
}
}
Expand All @@ -391,6 +394,7 @@ jvmtiAddCapabilities(jvmtiEnv* env,
if (newCapabilities.can_generate_sampled_object_alloc_events) {
if (J9_ARE_ANY_BITS_SET(jvmtiData->flags, J9JVMTI_FLAG_SAMPLED_OBJECT_ALLOC_ENABLED)) {
rc = JVMTI_ERROR_NOT_AVAILABLE;
Trc_JVMTI_jvmtiAddCapabilities_object_alloc_set_already(currentThread);
goto fail;
}

Expand All @@ -411,13 +415,15 @@ jvmtiAddCapabilities(jvmtiEnv* env,

/* Reserve hooks for any events now allowed by the new capabilities */

if (mapCapabilitiesToEvents(j9env, &newCapabilities, reserveEvent) != 0) {
if (0 != mapCapabilitiesToEvents(j9env, &newCapabilities, reserveEvent)) {
Trc_JVMTI_jvmtiAddCapabilities_mapCapabilitiesToEvents_failed(currentThread);
goto fail;
}

/* Handle non-event hooks */

if (hookNonEventCapabilities(j9env, &newCapabilities) != 0) {
if (0 != hookNonEventCapabilities(j9env, &newCapabilities)) {
Trc_JVMTI_jvmtiAddCapabilities_hookNonEventCapabilities_failed(currentThread);
goto fail;
}

Expand Down Expand Up @@ -540,55 +546,82 @@ mapCapabilitiesToEvents(J9JVMTIEnv * j9env, jvmtiCapabilities * capabilities, J9
{
IDATA rc = 0;

if (capabilities->can_generate_single_step_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_SINGLE_STEP);
}

if (capabilities->can_generate_breakpoint_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_BREAKPOINT);
}

if (capabilities->can_generate_field_access_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FIELD_ACCESS);
}

if (capabilities->can_generate_field_modification_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FIELD_MODIFICATION);
#if defined(J9VM_OPT_CRIU_SUPPORT)
J9JavaVM * vm = j9env->vm;
J9VMThread *mainThread = vm->mainThread;
J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions;
BOOLEAN skipHookReserve = vmFuncs->isCheckpointAllowed(mainThread)
&& vmFuncs->isDebugOnRestoreEnabled(mainThread);
/* Skip J9HookReserve for the events required by JDWP agent pre-checkpoint when DebugOnRestore is enabled,
* these events will be registered post-restore if a JDWP agent is specified in the restore option file,
* otherwise they are going to be unregistered by J9HookUnregister() which only clears J9HOOK_FLAG_HOOKED,
* but not J9HOOK_FLAG_RESERVED.
* J9HookUnreserve() might clear the flag set by other callers.
*/
if (!skipHookReserve)
#endif /* defined(J9VM_OPT_CRIU_SUPPORT)*/
{
if (capabilities->can_generate_single_step_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_SINGLE_STEP);
}
if (capabilities->can_generate_breakpoint_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_BREAKPOINT);
}
if (capabilities->can_generate_field_access_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FIELD_ACCESS);
}
if (capabilities->can_generate_field_modification_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FIELD_MODIFICATION);
}
if (capabilities->can_generate_frame_pop_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FRAME_POP);
}
if (capabilities->can_generate_monitor_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_CONTENDED_ENTER);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_WAIT);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_WAITED);
}
#if JAVA_SPEC_VERSION >= 19
if (capabilities->can_support_virtual_threads) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_VIRTUAL_THREAD_START);
rc |= eventHookFunction(j9env, JVMTI_EVENT_VIRTUAL_THREAD_END);
}
#endif /* JAVA_SPEC_VERSION >= 19 */
if (capabilities->can_generate_garbage_collection_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_GARBAGE_COLLECTION_START);
rc |= eventHookFunction(j9env, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH);
}
}

if (capabilities->can_generate_frame_pop_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_FRAME_POP);
/* CRIU can't skip J9HookReserve for the following events when they are requested via
* jvmtiAddCapabilities(), otherwise, the corresponding hooks will be disabled by JIT.
* For example, can_generate_method_exit_events/JVMTI_EVENT_METHOD_EXIT related hooks
* are J9HOOK_VM_METHOD_RETURN/J9HOOK_VM_NATIVE_METHOD_RETURN, the hook
* J9HOOK_VM_METHOD_RETURN is to be disabled if not reserved in advance.
* Similarly for the other events, if they are not reserved and a jdwp agent is
* specified at the restore option file, the capability can't be added,
* and the debugger won't be able to run.
*/
if (capabilities->can_generate_method_exit_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_METHOD_EXIT);
}

if (capabilities->can_generate_method_entry_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_METHOD_ENTRY);
}

if (capabilities->can_generate_method_exit_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_METHOD_EXIT);
if (capabilities->can_generate_exception_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_EXCEPTION);
rc |= eventHookFunction(j9env, JVMTI_EVENT_EXCEPTION_CATCH);
}

if (capabilities->can_generate_native_method_bind_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_NATIVE_METHOD_BIND);
}

if (capabilities->can_generate_exception_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_EXCEPTION);
rc |= eventHookFunction(j9env, JVMTI_EVENT_EXCEPTION_CATCH);
}

if (capabilities->can_generate_compiled_method_load_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_COMPILED_METHOD_LOAD);
rc |= eventHookFunction(j9env, JVMTI_EVENT_COMPILED_METHOD_UNLOAD);
}

if (capabilities->can_generate_monitor_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_CONTENDED_ENTER);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_WAIT);
rc |= eventHookFunction(j9env, JVMTI_EVENT_MONITOR_WAITED);
}

if (capabilities->can_generate_vm_object_alloc_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_VM_OBJECT_ALLOC);
}
Expand All @@ -599,28 +632,14 @@ mapCapabilitiesToEvents(J9JVMTIEnv * j9env, jvmtiCapabilities * capabilities, J9
}
#endif /* JAVA_SPEC_VERSION >= 11 */

#if JAVA_SPEC_VERSION >= 19
if (capabilities->can_support_virtual_threads) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_VIRTUAL_THREAD_START);
rc |= eventHookFunction(j9env, JVMTI_EVENT_VIRTUAL_THREAD_END);
}
#endif /* JAVA_SPEC_VERSION >= 19 */

if (capabilities->can_generate_object_free_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_OBJECT_FREE);
}

if (capabilities->can_generate_garbage_collection_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_GARBAGE_COLLECTION_START);
rc |= eventHookFunction(j9env, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH);
}

if (capabilities->can_generate_resource_exhaustion_heap_events ||
capabilities->can_generate_resource_exhaustion_threads_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_RESOURCE_EXHAUSTED);
}

return rc;
}


144 changes: 143 additions & 1 deletion runtime/jvmti/jvmtiHook.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@ static BOOLEAN shouldPostEvent(J9VMThread *currentThread, J9Method *method);
#if defined(J9VM_OPT_CRIU_SUPPORT)
static void jvmtiHookVMCheckpoint(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
static void jvmtiHookVMRestore(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
static void jvmtiHookVMRestoreCRIUInit(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
static void jvmtiHookVMRestoreStartAgent(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
static void hookDisableHelper(J9JavaVM *vm, J9HookInterface **vmHook, UDATA eventNum, J9HookFunction function, BOOLEAN unreserve, void *userData);

static void
hookDisableHelper(J9JavaVM *vm, J9HookInterface **vmHook, UDATA eventNum, J9HookFunction function, BOOLEAN unreserve, void *userData)
{
if (NULL == userData) {
(*vmHook)->J9HookUnregister(vmHook, eventNum, function, vm->checkpointState.jvmtienv);
} else {
(*vmHook)->J9HookUnregister(vmHook, eventNum, function, userData);
}
if (unreserve) {
/* for actual hookRegister calls */
(*vmHook)->J9HookUnreserve(vmHook, eventNum);
}
(*vmHook)->J9HookDisable(vmHook, eventNum);
}
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */

static void
Expand Down Expand Up @@ -539,6 +557,37 @@ jvmtiHookVMCheckpoint(J9HookInterface **hook, UDATA eventNum, void *eventData, v
TRACE_JVMTI_EVENT_RETURN(jvmtiHookVMCheckpoint);
}

static void
jvmtiHookVMRestoreCRIUInit(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData)
{
Trc_JVMTI_jvmtiHookVMRestoreCRIUInit_Entry();
criuRestoreInitializeLib(((J9RestoreEvent *)eventData)->currentThread->javaVM, (J9JVMTIEnv *)userData);
TRACE_JVMTI_EVENT_RETURN(jvmtiHookVMRestoreCRIUInit);
}

static void
jvmtiHookVMRestoreStartAgent(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData)
{
J9VMThread *currentThread = ((J9RestoreEvent *)eventData)->currentThread;
J9JavaVM *vm = currentThread->javaVM;
Trc_JVMTI_jvmtiHookVMRestoreStartAgent_Entry();
if (J9_ARE_ANY_BITS_SET(vm->checkpointState.flags, J9VM_CRIU_IS_JDWP_ENABLED)) {
J9InternalVMFunctions const * const vmFuncs = vm->internalVMFunctions;

vmFuncs->internalExitVMToJNI(currentThread);
criuRestoreStartAgent(vm);
vmFuncs->internalEnterVMFromJNI(currentThread);
} else {
/* Last part of cleanup if there was no JDWP agent specified.
* This releases VM access hence can't be invoked within criuDisableHooks() from
* J9HOOK_VM_PREPARING_FOR_RESTORE.
*/
jvmtiEnv *jvmti_env = vm->checkpointState.jvmtienv;
(*jvmti_env)->DisposeEnvironment(jvmti_env);
}
TRACE_JVMTI_EVENT_RETURN(jvmtiHookVMRestoreStartAgent);
}

static void
jvmtiHookVMRestore(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData)
{
Expand All @@ -562,6 +611,89 @@ jvmtiHookVMRestore(J9HookInterface **hook, UDATA eventNum, void *eventData, void

TRACE_JVMTI_EVENT_RETURN(jvmtiHookVMRestore);
}

void
criuDisableHooks(J9JVMTIData *jvmtiData, J9JVMTIEnv *j9env)
{
J9JavaVM *vm = jvmtiData->vm;
jvmtiEnv *jvmti_env = vm->checkpointState.jvmtienv;
J9HookInterface **vmHook = vm->internalVMFunctions->getVMHookInterface(vm);

Assert_JVMTI_true(J9_ARE_NO_BITS_SET(vm->checkpointState.flags, J9VM_CRIU_IS_JDWP_ENABLED));

/* can_access_local_variables, can_get_source_file_name, can_get_line_numbers, can_get_source_debug_extension
* can_maintain_original_method_order, can_generate_single_step_events
*/
hookDisableHelper(vm, vmHook, J9HOOK_VM_REQUIRED_DEBUG_ATTRIBUTES, jvmtiHookRequiredDebugAttributes, FALSE, NULL);
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_CAN_ACCESS_LOCALS;
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_MAINTAIN_ORIGINAL_METHOD_ORDER;
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_SOURCE_DEBUG_EXTENSION;
if (NULL != vm->jitConfig) {
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_LINE_NUMBER_TABLE;
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_LOCAL_VARIABLE_TABLE;
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_SOURCE_FILE;
}

if (NULL != vm->jitConfig) {
J9VMHookInterface vmhookInterface = vm->hookInterface;

/* can_tag_objects */
hookDisableHelper(vm, vmHook, J9HOOK_MM_OMR_GLOBAL_GC_END, jvmtiHookGCEnd, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_MM_OMR_LOCAL_GC_END, jvmtiHookGCEnd, FALSE, NULL);

/* can_generate_single_step_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_SINGLE_STEP, jvmtiHookSingleStep, FALSE, NULL);

/* can_generate_exception_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_EXCEPTION_THROW, jvmtiHookExceptionThrow, TRUE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_EXCEPTION_CATCH, jvmtiHookExceptionCatch, TRUE, NULL);

/* can_generate_frame_pop_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_FRAME_POP, jvmtiHookFramePop, FALSE, NULL);

/* can_generate_breakpoint_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_BREAKPOINT, jvmtiHookBreakpoint, TRUE, NULL);

/* can_generate_method_entry_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_METHOD_ENTER, jvmtiHookMethodEnter, TRUE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_NATIVE_METHOD_ENTER, jvmtiHookMethodEnter, TRUE, NULL);

/* can_generate_method_exit_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_METHOD_RETURN, jvmtiHookMethodExit, TRUE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_NATIVE_METHOD_RETURN, jvmtiHookMethodExit, TRUE, NULL);

/* can_generate_monitor_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_MONITOR_CONTENDED_ENTER, jvmtiHookMonitorContendedEnter, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_MONITOR_CONTENDED_ENTERED, jvmtiHookMonitorContendedEntered, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_MONITOR_WAIT, jvmtiHookMonitorWait, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_MONITOR_WAITED, jvmtiHookMonitorWaited, FALSE, NULL);

/* can_generate_garbage_collection_events */
hookDisableHelper(vm, vmHook, J9HOOK_MM_OMR_GLOBAL_GC_START, jvmtiHookGCStart, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_MM_OMR_LOCAL_GC_START, jvmtiHookGCStart, FALSE, NULL);

#if JAVA_SPEC_VERSION >= 21
/* can_support_virtual_threads */
hookDisableHelper(vm, vmHook, J9HOOK_VM_VIRTUAL_THREAD_STARTED, jvmtiHookVirtualThreadStarted, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_VIRTUAL_THREAD_END, jvmtiHookVirtualThreadEnd, FALSE, NULL);
#endif /* JAVA_SPEC_VERSION >= 21 */

/* can_generate_field_modification_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_PUT_FIELD, jvmtiHookFieldModification, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_PUT_STATIC_FIELD, jvmtiHookFieldModification, FALSE, NULL);

/* can_generate_field_access_events */
hookDisableHelper(vm, vmHook, J9HOOK_VM_GET_FIELD, jvmtiHookFieldAccess, FALSE, NULL);
hookDisableHelper(vm, vmHook, J9HOOK_VM_GET_STATIC_FIELD, jvmtiHookFieldAccess, FALSE, NULL);

/* can_pop_frame & can_force_early_return */
if (J9_EVENT_IS_HOOKED_OR_RESERVED(vmhookInterface, J9HOOK_VM_POP_FRAMES_INTERRUPT)) {
hookDisableHelper(vm, vmHook, J9HOOK_VM_POP_FRAMES_INTERRUPT, jvmtiHookPopFramesInterrupt, TRUE, J9JVMTI_DATA_FROM_VM(vm));
}
}

(*jvmti_env)->RelinquishCapabilities(jvmti_env, &vm->checkpointState.requiredCapabilities);
}
#endif /* defined(J9VM_OPT_CRIU_SUPPORT)*/

static IDATA
Expand Down Expand Up @@ -1914,6 +2046,17 @@ hookGlobalEvents(J9JVMTIData * jvmtiData)
return 1;
}

#if defined(J9VM_OPT_CRIU_SUPPORT)
if (vm->internalVMFunctions->isDebugOnRestoreEnabled(vm->mainThread)) {
if ((*vmHook)->J9HookRegisterWithCallSite(vmHook, J9HOOK_TAG_AGENT_ID | J9HOOK_VM_PREPARING_FOR_RESTORE, jvmtiHookVMRestoreCRIUInit, OMR_GET_CALLSITE(), jvmtiData, J9HOOK_AGENTID_FIRST)) {
return 1;
}
if ((*vmHook)->J9HookRegisterWithCallSite(vmHook, J9HOOK_TAG_AGENT_ID | J9HOOK_VM_CRIU_RESTORE, jvmtiHookVMRestoreStartAgent, OMR_GET_CALLSITE(), jvmtiData, J9HOOK_AGENTID_FIRST)) {
return 1;
}
}
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */

if ((*vmHook)->J9HookRegisterWithCallSite(vmHook, J9HOOK_TAG_AGENT_ID | J9HOOK_VM_SHUTTING_DOWN, jvmtiHookVMShutdownLast, OMR_GET_CALLSITE(), jvmtiData, J9HOOK_AGENTID_LAST)) {
return 1;
}
Expand Down Expand Up @@ -1952,7 +2095,6 @@ unhookGlobalEvents(J9JVMTIData * jvmtiData)
(*vmHook)->J9HookUnregister(vmHook, J9HOOK_VM_SHUTTING_DOWN, jvmtiHookVMShutdownLast, NULL);
}


static void
jvmtiHookMonitorContendedEnter(J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData)
{
Expand Down
Loading

0 comments on commit ebe8718

Please sign in to comment.