Skip to content

Commit

Permalink
Add JVMTI VirtualThread Mount and Unmount Events
Browse files Browse the repository at this point in the history
TODO: Add more details.

Related: eclipse-openj9#16167

Signed-off-by: Dipak Bagadiya <[email protected]>
  • Loading branch information
dipak-bagadiya authored and babsingh committed Jan 17, 2023
1 parent d1a4423 commit ed7ecf6
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 26 deletions.
4 changes: 4 additions & 0 deletions debugtools/DDR_VM/data/superset-constants.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,8 @@ C|J9_JNI_OFFLOAD_SWITCH_RELEASE_ARRAY_ELEMENTS
C|J9_JNI_OFFLOAD_SWITCH_SET_ARRAY_REGION
C|J9_JNI_OFFLOAD_SWITCH_THRESHOLD
C|J9_JNI_OFFLOAD_SWITCH_TRACE_SUBSCRIBER_THREAD
C|J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_MOUNT
C|J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_UNMOUNT
C|J9_JVMTI_METHOD_SELECTIVE_ENTRY_EXIT
C|J9_LOOK_ALLOW_FWD
C|J9_LOOK_CLCONSTRAINTS
Expand Down Expand Up @@ -2263,6 +2265,8 @@ C|J9JVMTI_EVENT_COM_IBM_VM_DUMP_START
S|J9JVMTIStackTraceType|J9JVMTIStackTraceTypePointer|
C|J9JVMTI_STACK_TRACE_ENTRY_LOCAL_STORAGE
C|J9JVMTI_STACK_TRACE_EXTRA_FRAME_INFO
C|J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT
C|J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT
C|J9JVMTI_STACK_TRACE_PRUNE_UNREPORTED_METHODS
S|J9JavaAccessFlags|J9JavaAccessFlagsPointer|
C|J9AccAbstract
Expand Down
5 changes: 4 additions & 1 deletion runtime/include/ibmjvmti.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2021 IBM Corp. and others
* Copyright (c) 1991, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -100,6 +100,9 @@
#define COM_IBM_REGISTER_TRACEPOINT_SUBSCRIBER "com.ibm.RegisterTracePointSubscriber"
#define COM_IBM_DEREGISTER_TRACEPOINT_SUBSCRIBER "com.ibm.DeregisterTracePointSubscriber"

#define COM_IBM_VIRTUAL_THREAD_MOUNT "com.ibm.VirtualThreadMount"
#define COM_IBM_VIRTUAL_THREAD_UNMOUNT "com.ibm.VirtualThreadUnmount"

#define COM_IBM_SHARED_CACHE_MODLEVEL_JAVA5 1
#define COM_IBM_SHARED_CACHE_MODLEVEL_JAVA6 2
#define COM_IBM_SHARED_CACHE_MODLEVEL_JAVA7 3
Expand Down
4 changes: 3 additions & 1 deletion runtime/j9vm/javanextvmi.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2022 IBM Corp. and others
* Copyright (c) 2018, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -390,6 +390,7 @@ JVM_VirtualThreadMountEnd(JNIEnv *env, jobject thread, jboolean firstMount)

TRIGGER_J9HOOK_VM_VIRTUAL_THREAD_STARTED(vm->hookInterface, currentThread);
}
TRIGGER_J9HOOK_VIRTUAL_THREAD_MOUNT(vm->hookInterface, currentThread);

/* Allow thread to be inspected again. */
Assert_SC_true(-1 == J9OBJECT_I64_LOAD(currentThread, threadObj, vm->virtualThreadInspectorCountOffset));
Expand Down Expand Up @@ -460,6 +461,7 @@ JVM_VirtualThreadUnmountBegin(JNIEnv *env, jobject thread, jboolean lastUnmount)
*/
J9OBJECT_I64_STORE(currentThread, threadObj, vm->virtualThreadInspectorCountOffset, -1);

TRIGGER_J9HOOK_VIRTUAL_THREAD_UNMOUNT(vm->hookInterface, currentThread);
if (lastUnmount) {
if (NULL != vm->liveVirtualThreadList) {
j9object_t threadPrev = J9OBJECT_OBJECT_LOAD(currentThread, threadObj, vm->virtualThreadLinkPreviousOffset);
Expand Down
7 changes: 6 additions & 1 deletion runtime/jvmti/j9jvmti.tdf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Copyright (c) 2006, 2022 IBM Corp. and others
//Copyright (c) 2006, 2023 IBM Corp. and others
//
//This program and the accompanying materials are made available under
//the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -646,3 +646,8 @@ TraceExit=Trc_JVMTI_jvmtiResumeAllVirtualThreads_Exit Overhead=1 Level=5 Noenv T

TraceEntry=Trc_JVMTI_jvmtiSuspendAllVirtualThreads_Entry Overhead=1 Level=5 Noenv Template="SuspendAllVirtualThreads env=%p"
TraceExit=Trc_JVMTI_jvmtiSuspendAllVirtualThreads_Exit Overhead=1 Level=5 Noenv Template="SuspendAllVirtualThreads returning %d"

TraceEntry=Trc_JVMTI_jvmtiHookVirtualThreadUnmount_Entry Overhead=1 Level=5 Noenv Template="HookVirtualThreadUnmount"
TraceExit=Trc_JVMTI_jvmtiHookVirtualThreadUnmount_Exit Overhead=1 Level=5 Noenv Template="HookVirtualThreadUnmount"
TraceEntry=Trc_JVMTI_jvmtiHookVirtualThreadMount_Entry Overhead=1 Level=5 Noenv Template="HookVirtualThreadMount"
TraceExit=Trc_JVMTI_jvmtiHookVirtualThreadMount_Exit Overhead=1 Level=5 Noenv Template="HookVirtualThreadMount"
4 changes: 3 additions & 1 deletion runtime/jvmti/jvmtiEventManagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jvmtiSetEventNotificationMode(jvmtiEnv* env,
/* Ensure the required capabilities are enabled for the event if the event is being enabled */

if (mode == JVMTI_ENABLE) {
switch(event_type) {
switch((int)event_type) {
case JVMTI_EVENT_FIELD_MODIFICATION:
ENSURE_CAPABILITY(env, can_generate_field_modification_events);
break;
Expand Down Expand Up @@ -159,6 +159,8 @@ jvmtiSetEventNotificationMode(jvmtiEnv* env,
#if JAVA_SPEC_VERSION >= 19
case JVMTI_EVENT_VIRTUAL_THREAD_START:
case JVMTI_EVENT_VIRTUAL_THREAD_END:
case J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT:
case J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT:
ENSURE_CAPABILITY(env, can_support_virtual_threads);
break;
#endif /* JAVA_SPEC_VERSION >= 19 */
Expand Down
25 changes: 24 additions & 1 deletion runtime/jvmti/jvmtiExtensionMechanism.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2022 IBM Corp. and others
* Copyright (c) 1991, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -346,6 +346,17 @@ static const jvmtiParamInfo jvmtiDeregisterTracepointSubscriber_params[] = {
{ "subscriptionID", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE }
};

/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiVirtualThreadMount_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE }
};

static const jvmtiParamInfo jvmtiVirtualThreadUnmount_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE }
};

/*
* Error lists for extended functions
*/
Expand Down Expand Up @@ -777,6 +788,18 @@ static const J9JVMTIExtensionEventInfo J9JVMTIExtensionEventInfoTable[] = {
J9NLS_JVMTI_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH_DESCRIPTION,
EMPTY_SIZE_AND_TABLE,
},
{
J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT,
COM_IBM_VIRTUAL_THREAD_MOUNT,
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_MOUNT,
SIZE_AND_TABLE(jvmtiVirtualThreadMount_params),
},
{
J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT,
COM_IBM_VIRTUAL_THREAD_UNMOUNT,
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_UNMOUNT,
SIZE_AND_TABLE(jvmtiVirtualThreadUnmount_params),
},
};

#define NUM_EXTENSION_EVENTS (sizeof(J9JVMTIExtensionEventInfoTable) / sizeof(J9JVMTIExtensionEventInfoTable[0]))
Expand Down
4 changes: 3 additions & 1 deletion runtime/jvmti/jvmtiHelpers.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2022 IBM Corp. and others
* Copyright (c) 1991, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -75,6 +75,8 @@ static const UDATA reasonCodeFromJVMTIEvent[] = {
J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VM_DUMP_END, /* J9JVMTI_EVENT_COM_IBM_VM_DUMP_END */
J9_JNI_OFFLOAD_SWITCH_J9JVMTI_GC_CYCLE_START, /* J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_START */
J9_JNI_OFFLOAD_SWITCH_J9JVMTI_GC_CYCLE_FINISH, /* J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH */
J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_MOUNT, /* J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT */
J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_UNMOUNT, /* J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT */
};
#endif /* J9VM_OPT_JAVA_OFFLOAD_SUPPORT */

Expand Down
75 changes: 74 additions & 1 deletion runtime/jvmti/jvmtiHook.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2022 IBM Corp. and others
* Copyright (c) 1991, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -148,6 +148,8 @@ static UDATA methodExists(J9Class * methodClass, U_8 * nameData, UDATA nameLengt
static void jvmtiHookVirtualThreadStarted (J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData);
static void jvmtiHookVirtualThreadEnd (J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData);
static void jvmtiHookVirtualThreadDestroy (J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
static void jvmtiHookVirtualThreadMount (J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData);
static void jvmtiHookVirtualThreadUnmount (J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData);
#endif /* JAVA_SPEC_VERSION >= 19 */

static void
Expand Down Expand Up @@ -421,6 +423,70 @@ jvmtiHookVirtualThreadDestroy(J9HookInterface **hook, UDATA eventNum, void *even

TRACE_JVMTI_EVENT_RETURN(jvmtiHookVirtualThreadDestroy);
}

static void
jvmtiHookVirtualThreadMount(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData)
{
J9VMVirtualThreadMountEvent *data = eventData;
J9JVMTIEnv *j9env = userData;
J9VMThread *currentThread = data->currentThread;
//jvmtiEventThreadStart callback = j9env->callbacks.VirtualThreadStart;
jvmtiExtensionEvent callback = *J9JVMTI_EXTENSION_CALLBACK(j9env, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT);

Trc_JVMTI_jvmtiHookVirtualThreadMount_Entry();

ENSURE_EVENT_PHASE_LIVE(jvmtiHookVirtualThreadMount, j9env);

/* Call the event callback */

if (NULL != callback) {
jthread threadRef = NULL;
UDATA hadVMAccess = 0;
UDATA javaOffloadOldState = 0;
if (prepareForEvent(
j9env, currentThread, currentThread, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT,
&threadRef, &hadVMAccess, FALSE, 0, &javaOffloadOldState)
) {
callback((jvmtiEnv *)j9env, (JNIEnv *)currentThread, threadRef);
finishedEvent(currentThread, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT, hadVMAccess, javaOffloadOldState);
}
}

TRACE_JVMTI_EVENT_RETURN(jvmtiHookVirtualThreadMount);
}

static void
jvmtiHookVirtualThreadUnmount(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData)
{
J9VMVirtualThreadUnmountEvent *data = eventData;
J9JVMTIEnv *j9env = userData;
//jvmtiEventThreadEnd callback = j9env->callbacks.VirtualThreadEnd;
jvmtiExtensionEvent callback = *J9JVMTI_EXTENSION_CALLBACK(j9env, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT);
J9VMThread *currentThread = data->currentThread;

Trc_JVMTI_jvmtiHookVirtualThreadUnmount_Entry();

ENSURE_EVENT_PHASE_LIVE(jvmtiHookVirtualThreadUnmount, j9env);

/* Call the event callback */

if (NULL != callback) {
jthread threadRef = NULL;
UDATA hadVMAccess = 0;
UDATA javaOffloadOldState = 0;

if (prepareForEvent(
j9env, currentThread, currentThread, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT,
&threadRef, &hadVMAccess, FALSE, 0, &javaOffloadOldState)
) {
callback((jvmtiEnv *)j9env, (JNIEnv *)currentThread, threadRef);
finishedEvent(data->currentThread, J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT, hadVMAccess, javaOffloadOldState);
}
}

TRACE_JVMTI_EVENT_RETURN(jvmtiHookVirtualThreadUnmount);
}

#endif /* JAVA_SPEC_VERSION >= 19 */

static IDATA
Expand Down Expand Up @@ -618,6 +684,13 @@ processEvent(J9JVMTIEnv* j9env, jint event, J9HookRedirectorFunction redirectorF
} else {
return 0;
}

case J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT:
return redirectorFunction(vmHook, J9HOOK_VIRTUAL_THREAD_MOUNT, jvmtiHookVirtualThreadMount, OMR_GET_CALLSITE(), j9env);

case J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT:
return redirectorFunction(vmHook, J9HOOK_VIRTUAL_THREAD_UNMOUNT, jvmtiHookVirtualThreadUnmount, OMR_GET_CALLSITE(), j9env);

}

return 0;
Expand Down
18 changes: 17 additions & 1 deletion runtime/nls/j9ti/jvmti.nls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2000, 2021 IBM Corp. and others
# Copyright (c) 2000, 2023 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -610,3 +610,19 @@ J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_TRACEPOINT_SUBSCRIBER_DESCRIPTION.explanation
J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_TRACEPOINT_SUBSCRIBER_DESCRIPTION.system_action=None
J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_TRACEPOINT_SUBSCRIBER_DESCRIPTION.user_response=None
# END NON-TRANSLATABLE

J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_MOUNT=Report the start of a virtual thread mount.
# START NON-TRANSLATABLE
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_MOUNT.explanation=Internationalized description of a JVMTI extension
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_MOUNT.system_action=None
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_MOUNT.user_response=None

# END NON-TRANSLATABLE

J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_UNMOUNT=Report the end of a virtual thread unmount.
# START NON-TRANSLATABLE
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_UNMOUNT.explanation=Internationalized description of a JVMTI extension
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_UNMOUNT.system_action=None
J9NLS_JVMTI_COM_IBM_VIRTUAL_THREAD_UNMOUNT.user_response=None

# END NON-TRANSLATABLE
4 changes: 2 additions & 2 deletions runtime/oti/j9consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,8 @@ extern "C" {
#define J9_JNI_OFFLOAD_SWITCH_JVMTI_MONITOR_WAITED 0x2E
#define J9_JNI_OFFLOAD_SWITCH_JVMTI_MONITOR_CONTENDED_ENTER 0x2F
#define J9_JNI_OFFLOAD_SWITCH_JVMTI_MONITOR_CONTENDED_ENTERED 0x30
/* 0x31 Reserved for JVMTI event */
/* 0x32 Reserved for JVMTI event */
#define J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_MOUNT 0x31
#define J9_JNI_OFFLOAD_SWITCH_J9JVMTI_VIRTUAL_THREAD_UNMOUNT 0x32
/* 0x33 Reserved for JVMTI event */
#define J9_JNI_OFFLOAD_SWITCH_JVMTI_RESOURCE_EXHAUSTED 0x34
#define J9_JNI_OFFLOAD_SWITCH_JVMTI_GC_START 0x35
Expand Down
16 changes: 15 additions & 1 deletion runtime/oti/j9vm.hdf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, 2022 IBM Corp. and others
Copyright (c) 2006, 2023 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -1351,4 +1351,18 @@ typedef UDATA (* lookupNativeAddressCallback)(struct J9VMThread *currentThread,
<struct>J9VirtualThreadEndEvent</struct>
<data type="struct J9VMThread*" name="currentThread" description="current thread" />
</event>

<event>
<name>J9HOOK_VIRTUAL_THREAD_MOUNT</name>
<description>Triggered whenever a virtual thread mount</description>
<struct>J9VMVirtualThreadMountEvent</struct>
<data type="struct J9VMThread*" name="currentThread" description="current thread" />
</event>

<event>
<name>J9HOOK_VIRTUAL_THREAD_UNMOUNT</name>
<description>Triggered whenever a virtual thread unmount</description>
<struct>J9VMVirtualThreadUnmountEvent</struct>
<data type="struct J9VMThread*" name="currentThread" description="current thread" />
</event>
</interface>
32 changes: 17 additions & 15 deletions runtime/oti/jvmtiInternal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2022 IBM Corp. and others
* Copyright (c) 1991, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -32,19 +32,20 @@
#define J9_JVMTI_PERFORM_CHECKS
#endif

#define J9JVMTI_LOWEST_EVENT JVMTI_MIN_EVENT_TYPE_VAL
#define J9JVMTI_HIGHEST_EVENT JVMTI_MAX_EVENT_TYPE_VAL

typedef enum {
J9JVMTI_BEFORE_FIRST_EXTENSION_EVENT = J9JVMTI_HIGHEST_EVENT,
J9JVMTI_EVENT_COM_IBM_COMPILING_START,
J9JVMTI_EVENT_COM_IBM_COMPILING_END,
J9JVMTI_EVENT_COM_IBM_INSTRUMENTABLE_OBJECT_ALLOC,
J9JVMTI_EVENT_COM_IBM_VM_DUMP_START,
J9JVMTI_EVENT_COM_IBM_VM_DUMP_END,
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_START,
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH,
J9JVMTI_AFTER_LAST_EXTENSION_EVENT
typedef enum {
J9JVMTI_BEFORE_FIRST_EXTENSION_EVENT = JVMTI_MIN_EVENT_TYPE_VAL - 11 ,
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_START = JVMTI_MIN_EVENT_TYPE_VAL - 10,
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH = JVMTI_MIN_EVENT_TYPE_VAL - 9,
J9JVMTI_EVENT_COM_IBM_VM_DUMP_START = JVMTI_MIN_EVENT_TYPE_VAL - 8,
J9JVMTI_EVENT_COM_IBM_VM_DUMP_END = JVMTI_MIN_EVENT_TYPE_VAL - 7,
J9JVMTI_EVENT_COM_IBM_INSTRUMENTABLE_OBJECT_ALLOC = JVMTI_MIN_EVENT_TYPE_VAL - 6,
J9JVMTI_EVENT_COM_IBM_COMPILING_START = JVMTI_MIN_EVENT_TYPE_VAL - 5,
J9JVMTI_EVENT_COM_IBM_COMPILING_END = JVMTI_MIN_EVENT_TYPE_VAL - 4,
J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_UNMOUNT = JVMTI_MIN_EVENT_TYPE_VAL - 3,
J9JVMTI_EVENT_COM_IBM_VIRTUAL_THREAD_MOUNT = JVMTI_MIN_EVENT_TYPE_VAL - 2,
J9JVMTI_AFTER_LAST_EXTENSION_EVENT = JVMTI_MIN_EVENT_TYPE_VAL
} J9JVMTIExtensionEvent;

typedef enum {
Expand All @@ -54,10 +55,11 @@ typedef enum {
J9JVMTI_STACK_TRACE_MARK_INLINED_FRAMES = COM_IBM_GET_STACK_TRACE_MARK_INLINED_FRAMES
} J9JVMTIStackTraceType;

#define J9JVMTI_LOWEST_EVENT (J9JVMTI_BEFORE_FIRST_EXTENSION_EVENT + 1)
#define J9JVMTI_LOWEST_EXTENSION_EVENT (J9JVMTI_BEFORE_FIRST_EXTENSION_EVENT + 1)
#define J9JVMTI_HIGHEST_EXTENSION_EVENT (J9JVMTI_AFTER_LAST_EXTENSION_EVENT - 1)
#define J9JVMTI_HIGHEST_EXTENSION_EVENT J9JVMTI_AFTER_LAST_EXTENSION_EVENT

#define J9JVMTI_EVENT_COUNT (J9JVMTI_HIGHEST_EXTENSION_EVENT - J9JVMTI_LOWEST_EVENT + 1)
#define J9JVMTI_EVENT_COUNT (J9JVMTI_HIGHEST_EVENT - J9JVMTI_LOWEST_EXTENSION_EVENT + 1)

#define J9JVMTI_UDATA_BITS (sizeof(UDATA) * 8)

Expand Down Expand Up @@ -528,7 +530,7 @@ typedef struct jvmtiGcp_translation {
#endif

#define NORMALIZED_EVENT_NUMBER(eventNumber) \
((eventNumber) - J9JVMTI_LOWEST_EVENT)
((eventNumber) - J9JVMTI_LOWEST_EXTENSION_EVENT)

#define EVENT_WORD(eventNumber, eventMap) \
((eventMap)->eventEnable[NORMALIZED_EVENT_NUMBER(eventNumber) / J9JVMTI_UDATA_BITS])
Expand Down

0 comments on commit ed7ecf6

Please sign in to comment.