Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create jvmti.h.m4 to generate different versions of jvmti.h #4409

Merged
merged 1 commit into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildenv/travis/build-on-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if test "x$RUN_LINT" = "xyes"; then
mkdir $CMAKE_BUILD_DIR
cd $CMAKE_BUILD_DIR
cmake -C $J9SRC/cmake/caches/linux_x86-64_cmprssptrs.cmake ..
make -j $MAKE_JOBS run_cptool omrgc_hookgen j9vm_hookgen j9jit_tracegen j9vm_nlsgen
make -j $MAKE_JOBS run_cptool omrgc_hookgen j9vm_hookgen j9jit_tracegen j9vm_nlsgen j9vm_m4gen

# Now we can build the linter plugin
cd $OMRCHECKER_DIR
Expand Down
23 changes: 14 additions & 9 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ else()
add_custom_target(j9vm_nlsgen)
endif()

# Generate jvmti header
if(J9VM_IS_NON_STAGING)
set(JVMTI_HEADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
MarkQingGuo marked this conversation as resolved.
Show resolved Hide resolved
file(MAKE_DIRECTORY "${JVMTI_HEADER_DIR}")
else()
set(JVMTI_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
endif()
add_custom_command(OUTPUT "${JVMTI_HEADER_DIR}/jvmti.h"
COMMAND m4 -D "JAVA_SPEC_VERSION=${JAVA_SPEC_VERSION}" "${CMAKE_CURRENT_SOURCE_DIR}/include/jvmti.h.m4" > "jvmti.h"
VERBATIM
WORKING_DIRECTORY "${JVMTI_HEADER_DIR}"
)

# Note we do this here rather than in the redirector directory to work arround
# issues in cmake. If we did it there each target which consumed generated.c has
# its own rule to create it. Which causes a race condition when building in parallel
Expand All @@ -170,20 +183,13 @@ add_custom_target(j9vm_m4gen
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/redirector/generated.c"
"${CMAKE_CURRENT_BINARY_DIR}/j9vm/generated.h"
"${JVMTI_HEADER_DIR}/jvmti.h"
)

if(J9VM_IS_NON_STAGING)
add_custom_target(copy_default_options ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/options.default" "${CMAKE_CURRENT_BINARY_DIR}/options.default"
)

# Copy jvmti.h, later this will actually be generated
add_custom_target(copy_jvmti_h
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/include/jvmti.h" "${CMAKE_CURRENT_BINARY_DIR}/include/jvmti.h"
)
else()
# just create a dummy target that does noting
add_custom_target(copy_jvmti_h)
endif()

###
Expand Down Expand Up @@ -214,7 +220,6 @@ add_dependencies(j9vm_interface
j9vm_hookgen
j9vm_m4gen
j9vm_nlsgen
copy_jvmti_h
)

# j9vm_gc_includes is used to track the include directories that are consumed by the various gc components
Expand Down
7 changes: 6 additions & 1 deletion runtime/buildtools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ ifeq (true,$(OPENJ9_ENABLE_CMAKE))
configure : constantpool nls
mkdir -p build && cd build && $(CMAKE) -C ../cmake/caches/$(SPEC).cmake $(CMAKE_ARGS) $(EXTRA_CMAKE_ARGS) ..
else
configure : uma
.PHONY : j9includegen

j9includegen : uma
$(MAKE) -C include j9include_generate

configure : j9includegen
$(MAKE) -C omr -f run_configure.mk 'SPEC=$(SPEC)' 'OMRGLUE=$(OMRGLUE)' 'CONFIG_INCL_DIR=$(CONFIG_INCL_DIR)' 'OMRGLUE_INCLUDES=$(OMRGLUE_INCLUDES)' 'EXTRA_CONFIGURE_ARGS=$(EXTRA_CONFIGURE_ARGS)'
endif

Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/linter.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2000, 2018 IBM Corp. and others
# Copyright (c) 2000, 2019 IBM Corp. and others
MarkQingGuo marked this conversation as resolved.
Show resolved Hide resolved
#
# 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 @@ -96,7 +96,7 @@ include $(JIT_MAKE_DIR)/toolcfg/common.mk
# is different from an automake build.
#
ifneq ("$(CMAKE_BUILD_DIR)","")
CXX_INCLUDES+=$(CMAKE_BUILD_DIR)/runtime $(CMAKE_BUILD_DIR)/runtime/omr $(CMAKE_BUILD_DIR)/runtime/nls
CXX_INCLUDES+=$(CMAKE_BUILD_DIR)/runtime $(CMAKE_BUILD_DIR)/runtime/omr $(CMAKE_BUILD_DIR)/runtime/nls $(CMAKE_BUILD_DIR)/runtime/include
endif

#
Expand Down
42 changes: 25 additions & 17 deletions runtime/include/jvmti.h → runtime/include/jvmti.h.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
changequote(`[',`]')dnl

#ifndef jvmti_h
#define jvmti_h
Expand Down Expand Up @@ -481,10 +482,10 @@ typedef struct {
unsigned int can_retransform_any_class : 1;
unsigned int can_generate_resource_exhaustion_heap_events : 1;
unsigned int can_generate_resource_exhaustion_threads_events : 1;
unsigned int can_generate_early_vmstart : 1;
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ unsigned int can_generate_early_vmstart : 1;
unsigned int can_generate_early_class_hook_events : 1;
unsigned int can_generate_sampled_object_alloc_events : 1;
unsigned int : 4;
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ unsigned int can_generate_sampled_object_alloc_events : 1;
unsigned int : 4;], [ unsigned int : 5;])], [ unsigned int : 7;])
unsigned int : 16;
unsigned int : 16;
unsigned int : 16;
Expand Down Expand Up @@ -734,7 +735,7 @@ typedef enum jvmtiEvent {
JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
JVMTI_EVENT_OBJECT_FREE = 83,
JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
JVMTI_EVENT_SAMPLED_OBJECT_ALLOC = 86,
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ JVMTI_EVENT_SAMPLED_OBJECT_ALLOC = 86,], [dnl])

JVMTI_MAX_EVENT_TYPE_VAL = 86,
jvmtiEventEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
Expand Down Expand Up @@ -950,13 +951,13 @@ typedef void (JNICALL *jvmtiEventResourceExhausted) (
const void* reserved,
const char* description);

typedef void (JNICALL *jvmtiEventSampledObjectAlloc) (
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [typedef void (JNICALL *jvmtiEventSampledObjectAlloc) (
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object,
jclass object_klass,
jlong size);
jlong size);], [dnl])

typedef void * jvmtiEventReserved;

Expand Down Expand Up @@ -997,7 +998,7 @@ typedef struct {
jvmtiEventObjectFree ObjectFree;
jvmtiEventVMObjectAlloc VMObjectAlloc;
jvmtiEventReserved reserved85;
jvmtiEventSampledObjectAlloc SampledObjectAlloc;
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ jvmtiEventSampledObjectAlloc SampledObjectAlloc;], [ jvmtiEventReserved reserved86;])
} jvmtiEventCallbacks;

/*
Expand All @@ -1009,7 +1010,7 @@ typedef struct {
typedef struct JVMTINativeInterface_ {
void *reserved1;
jvmtiError (JNICALL * SetEventNotificationMode)(jvmtiEnv* env, jvmtiEventMode mode, jvmtiEvent event_type, jthread event_thread, ...);
jvmtiError (JNICALL * GetAllModules)(jvmtiEnv* env, jint* module_count_ptr, jobject** modules_ptr);
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError (JNICALL * GetAllModules)(jvmtiEnv* env, jint* module_count_ptr, jobject** modules_ptr);], [ void *reserved3;])
jvmtiError (JNICALL * GetAllThreads)(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr);
jvmtiError (JNICALL * SuspendThread)(jvmtiEnv* env, jthread thread);
jvmtiError (JNICALL * ResumeThread)(jvmtiEnv* env, jthread thread);
Expand Down Expand Up @@ -1046,7 +1047,7 @@ typedef struct JVMTINativeInterface_ {
jvmtiError (JNICALL * RawMonitorNotifyAll)(jvmtiEnv* env, jrawMonitorID monitor);
jvmtiError (JNICALL * SetBreakpoint)(jvmtiEnv* env, jmethodID method, jlocation location);
jvmtiError (JNICALL * ClearBreakpoint)(jvmtiEnv* env, jmethodID method, jlocation location);
jvmtiError (JNICALL * GetNamedModule)(jvmtiEnv* env, jobject class_loader, const char* package_name, jobject* module_ptr);
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError (JNICALL * GetNamedModule)(jvmtiEnv* env, jobject class_loader, const char* package_name, jobject* module_ptr);], [ void *reserved40;])
jvmtiError (JNICALL * SetFieldAccessWatch)(jvmtiEnv* env, jclass klass, jfieldID field);
jvmtiError (JNICALL * ClearFieldAccessWatch)(jvmtiEnv* env, jclass klass, jfieldID field);
jvmtiError (JNICALL * SetFieldModificationWatch)(jvmtiEnv* env, jclass klass, jfieldID field);
Expand Down Expand Up @@ -1100,12 +1101,18 @@ typedef struct JVMTINativeInterface_ {
jvmtiError (JNICALL * IsMethodObsolete)(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr);
jvmtiError (JNICALL * SuspendThreadList)(jvmtiEnv* env, jint request_count, const jthread* request_list, jvmtiError* results);
jvmtiError (JNICALL * ResumeThreadList)(jvmtiEnv* env, jint request_count, const jthread* request_list, jvmtiError* results);
jvmtiError (JNICALL * AddModuleReads)(jvmtiEnv* env, jobject module, jobject to_module);
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError (JNICALL * AddModuleReads)(jvmtiEnv* env, jobject module, jobject to_module);
jvmtiError (JNICALL * AddModuleExports)(jvmtiEnv* env, jobject module, const char* pkg_name, jobject to_module);
jvmtiError (JNICALL * AddModuleOpens)(jvmtiEnv* env, jobject module, const char* pkg_name, jobject to_module);
jvmtiError (JNICALL * AddModuleUses)(jvmtiEnv* env, jobject module, jclass service);
jvmtiError (JNICALL * AddModuleProvides)(jvmtiEnv* env, jobject module, jclass service, jclass impl_class);
jvmtiError (JNICALL * IsModifiableModule)(jvmtiEnv* env, jobject module, jboolean* is_modifiable_module_ptr);
jvmtiError (JNICALL * IsModifiableModule)(jvmtiEnv* env, jobject module, jboolean* is_modifiable_module_ptr);],
[ void *reserved94;
void *reserved95;
void *reserved96;
void *reserved97;
void *reserved98;
void *reserved99;])
jvmtiError (JNICALL * GetAllStackTraces)(jvmtiEnv* env, jint max_frame_count, jvmtiStackInfo** stack_info_ptr, jint* thread_count_ptr);
jvmtiError (JNICALL * GetThreadListStackTraces)(jvmtiEnv* env, jint thread_count, const jthread* thread_list, jint max_frame_count, jvmtiStackInfo** stack_info_ptr);
jvmtiError (JNICALL * GetThreadLocalStorage)(jvmtiEnv* env, jthread thread, void** data_ptr);
Expand Down Expand Up @@ -1162,15 +1169,16 @@ typedef struct JVMTINativeInterface_ {
jvmtiError (JNICALL * GetOwnedMonitorStackDepthInfo)(jvmtiEnv* env, jthread thread, jint* monitor_info_count_ptr, jvmtiMonitorStackDepthInfo** monitor_info_ptr);
jvmtiError (JNICALL * GetObjectSize)(jvmtiEnv* env, jobject object, jlong* size_ptr);
jvmtiError (JNICALL * GetLocalInstance)(jvmtiEnv* env, jthread thread, jint depth, jobject* value_ptr);
jvmtiError (JNICALL * SetHeapSamplingInterval)(jvmtiEnv* env, jint sampling_interval);
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ jvmtiError (JNICALL * SetHeapSamplingInterval)(jvmtiEnv* env, jint sampling_interval);],
[ void *reserved156;])
} jvmtiNativeInterface;

struct _jvmtiEnv {
const struct JVMTINativeInterface_ * functions;
#ifdef __cplusplus
jvmtiError SetEventNotificationMode (jvmtiEventMode mode, jvmtiEvent event_type, jthread event_thread, ...) { return functions->SetEventNotificationMode(this, mode, event_type, event_thread); }
jvmtiError GetAllThreads (jint* threads_count_ptr, jthread** threads_ptr) { return functions->GetAllThreads(this, threads_count_ptr, threads_ptr); }
jvmtiError GetAllModules (jint* module_count_ptr, jobject** modules_ptr) { return functions->GetAllModules(this, module_count_ptr, modules_ptr); }
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError GetAllModules (jint* module_count_ptr, jobject** modules_ptr) { return functions->GetAllModules(this, module_count_ptr, modules_ptr); }], [dnl])
jvmtiError SuspendThread (jthread thread) { return functions->SuspendThread(this, thread); }
jvmtiError ResumeThread (jthread thread) { return functions->ResumeThread(this, thread); }
jvmtiError StopThread (jthread thread, jobject exception) { return functions->StopThread(this, thread, exception); }
Expand Down Expand Up @@ -1206,7 +1214,7 @@ struct _jvmtiEnv {
jvmtiError RawMonitorNotifyAll (jrawMonitorID monitor) { return functions->RawMonitorNotifyAll(this, monitor); }
jvmtiError SetBreakpoint (jmethodID method, jlocation location) { return functions->SetBreakpoint(this, method, location); }
jvmtiError ClearBreakpoint (jmethodID method, jlocation location) { return functions->ClearBreakpoint(this, method, location); }
jvmtiError GetNamedModule(jvmtiEnv* env, jobject class_loader, const char* package_name, jobject* module_ptr) { return functions->GetNamedModule(this, class_loader, package_name, module_ptr); }
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError GetNamedModule(jvmtiEnv* env, jobject class_loader, const char* package_name, jobject* module_ptr) { return functions->GetNamedModule(this, class_loader, package_name, module_ptr); }], [dnl])
jvmtiError SetFieldAccessWatch (jclass klass, jfieldID field) { return functions->SetFieldAccessWatch(this, klass, field); }
jvmtiError ClearFieldAccessWatch (jclass klass, jfieldID field) { return functions->ClearFieldAccessWatch(this, klass, field); }
jvmtiError SetFieldModificationWatch (jclass klass, jfieldID field) { return functions->SetFieldModificationWatch(this, klass, field); }
Expand Down Expand Up @@ -1259,12 +1267,12 @@ struct _jvmtiEnv {
jvmtiError IsMethodObsolete (jmethodID method, jboolean* is_obsolete_ptr) { return functions->IsMethodObsolete(this, method, is_obsolete_ptr); }
jvmtiError SuspendThreadList (jint request_count, const jthread* request_list, jvmtiError* results) { return functions->SuspendThreadList(this, request_count, request_list, results); }
jvmtiError ResumeThreadList (jint request_count, const jthread* request_list, jvmtiError* results) { return functions->ResumeThreadList(this, request_count, request_list, results); }
jvmtiError AddModuleReads(jvmtiEnv* env, jobject module, jobject to_module) { return functions->AddModuleReads(this, module, to_module); }
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1, [ jvmtiError AddModuleReads(jvmtiEnv* env, jobject module, jobject to_module) { return functions->AddModuleReads(this, module, to_module); }
jvmtiError AddModuleExports(jvmtiEnv* env, jobject module, const char* pkg_name, jobject to_module) { return functions->AddModuleExports(this, module, pkg_name, to_module); }
jvmtiError AddModuleOpens(jvmtiEnv* env, jobject module, const char* pkg_name, jobject to_module) { return functions->AddModuleOpens(this, module, pkg_name, to_module); }
jvmtiError AddModuleUses(jvmtiEnv* env, jobject module, jclass service) { return functions->AddModuleUses(this, module, service); }
jvmtiError AddModuleProvides(jvmtiEnv* env, jobject module, jclass service, jclass impl_class) { return functions->AddModuleProvides(this, module, service, impl_class); }
jvmtiError IsModifiableModule(jvmtiEnv* env, jobject module, jboolean* is_modifiable_module_ptr) { return functions->IsModifiableModule(this, module, is_modifiable_module_ptr); }
jvmtiError IsModifiableModule(jvmtiEnv* env, jobject module, jboolean* is_modifiable_module_ptr) { return functions->IsModifiableModule(this, module, is_modifiable_module_ptr); }], [dnl])
jvmtiError GetAllStackTraces (jint max_frame_count, jvmtiStackInfo** stack_info_ptr, jint* thread_count_ptr) { return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr); }
jvmtiError GetThreadListStackTraces (jint thread_count, const jthread* thread_list, jint max_frame_count, jvmtiStackInfo** stack_info_ptr) { return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr); }
jvmtiError GetThreadLocalStorage (jthread thread, void** data_ptr) { return functions->GetThreadLocalStorage(this, thread, data_ptr); }
Expand Down Expand Up @@ -1315,7 +1323,7 @@ struct _jvmtiEnv {
jvmtiError GetOwnedMonitorStackDepthInfo (jthread thread, jint* monitor_info_count_ptr, jvmtiMonitorStackDepthInfo** monitor_info_ptr) { return functions->GetOwnedMonitorStackDepthInfo(this, thread, monitor_info_count_ptr, monitor_info_ptr); }
jvmtiError GetObjectSize (jobject object, jlong* size_ptr) { return functions->GetObjectSize(this, object, size_ptr); }
jvmtiError GetLocalInstance (jthread thread, jint depth, jobject* value_ptr) { return functions->GetLocalInstance(this, thread, depth, value_ptr); }
jvmtiError SetHeapSamplingInterval (jint sampling_interval) { return functions->SetHeapSamplingInterval(this, sampling_interval); }
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1,[ jvmtiError SetHeapSamplingInterval (jint sampling_interval) { return functions->SetHeapSamplingInterval(this, sampling_interval); }], [dnl])
#endif
};

Expand Down
18 changes: 16 additions & 2 deletions runtime/include/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>

<!--
Copyright (c) 2016, 2017 IBM Corp. and others
Copyright (c) 2016, 2019 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 All @@ -25,4 +25,18 @@
<module>
<artifact type="reference" name="j9include">
</artifact>
</module>

<artifact type="target" name="generate_jvmti" all="false">
<commands>
<command type="all" line="m4 -D JAVA_SPEC_VERSION=$(VERSION_MAJOR) jvmti.h.m4 > jvmti.h"/>
<command type="clean" line="$(RM) jvmti.h"/>
</commands>
</artifact>

<artifact type="target" name="j9include_generate" all="false">
<dependencies>
<dependency name="generate_jvmti"/>
</dependencies>
</artifact>

</module>
12 changes: 11 additions & 1 deletion runtime/jvmti/jvmtiCapability.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ dumpCapabilities(J9JavaVM * vm, const jvmtiCapabilities *capabilities, const cha
PRINT_CAPABILITY(can_generate_resource_exhaustion_threads_events);

/* JVMTI 9.0 */
#if JAVA_SPEC_VERSION >= 9
PRINT_CAPABILITY(can_generate_early_vmstart);
PRINT_CAPABILITY(can_generate_early_class_hook_events);
#endif /* JAVA_SPEC_VERSION >= 9 */

/* JVMTI 11 */
#if JAVA_SPEC_VERSION >= 11
PRINT_CAPABILITY(can_generate_sampled_object_alloc_events);
#endif /* JAVA_SPEC_VERSION >= 11 */
#undef PRINT_CAPABILITY
}

Expand Down Expand Up @@ -168,11 +172,13 @@ jvmtiGetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr
if (isEventHookable(j9env, JVMTI_EVENT_VM_OBJECT_ALLOC)) {
rv_capabilities.can_generate_vm_object_alloc_events = 1;
}


#if JAVA_SPEC_VERSION >= 11
if (isEventHookable(j9env, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC)) {
/* hardcode to 0 (not enabled) for empty JEP331 implementation */
rv_capabilities.can_generate_sampled_object_alloc_events = 0;
}
#endif /* JAVA_SPEC_VERSION >= 11 */

if (isEventHookable(j9env, JVMTI_EVENT_NATIVE_METHOD_BIND)) {
rv_capabilities.can_generate_native_method_bind_events = 1;
Expand Down Expand Up @@ -282,10 +288,12 @@ jvmtiGetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr
rv_capabilities.can_generate_resource_exhaustion_heap_events = 1;
}

#if JAVA_SPEC_VERSION >= 9
if (JVMTI_PHASE_ONLOAD == jvmtiData->phase) {
rv_capabilities.can_generate_early_vmstart = 1;
rv_capabilities.can_generate_early_class_hook_events = 1;
}
#endif /* JAVA_SPEC_VERSION >= 9 */

rc = JVMTI_ERROR_NONE;
omrthread_monitor_exit(jvmtiData->mutex);
Expand Down Expand Up @@ -548,9 +556,11 @@ mapCapabilitiesToEvents(J9JVMTIEnv * j9env, jvmtiCapabilities * capabilities, J9
rc |= eventHookFunction(j9env, JVMTI_EVENT_VM_OBJECT_ALLOC);
}

#if JAVA_SPEC_VERSION >= 11
if (capabilities->can_generate_sampled_object_alloc_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC);
}
#endif /* JAVA_SPEC_VERSION >= 11 */

if (capabilities->can_generate_object_free_events) {
rc |= eventHookFunction(j9env, JVMTI_EVENT_OBJECT_FREE);
Expand Down
2 changes: 2 additions & 0 deletions runtime/jvmti/jvmtiEventManagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ jvmtiSetEventNotificationMode(jvmtiEnv* env,
ENSURE_CAPABILITY(env, can_generate_vm_object_alloc_events);
break;

#if JAVA_SPEC_VERSION >= 11
case JVMTI_EVENT_SAMPLED_OBJECT_ALLOC:
ENSURE_CAPABILITY(env, can_generate_sampled_object_alloc_events);
break;
#endif /* JAVA_SPEC_VERSION >= 11 */

case JVMTI_EVENT_NATIVE_METHOD_BIND:
ENSURE_CAPABILITY(env, can_generate_native_method_bind_events);
Expand Down
Loading