Skip to content

Use value-based hashing and equality for JVMTI object tags#24354

Draft
harship04 wants to merge 1 commit into
eclipse-openj9:masterfrom
harship04:fix-jvmti-tag-hash
Draft

Use value-based hashing and equality for JVMTI object tags#24354
harship04 wants to merge 1 commit into
eclipse-openj9:masterfrom
harship04:fix-jvmti-tag-hash

Conversation

@harship04

@harship04 harship04 commented Jul 13, 2026

Copy link
Copy Markdown

Fix related to issue:#24134

In hashObjectTag, use convertObjectToHash to hash value types by
their contents. In hashEqualObjectTag, use valueTypeCapableAcmp
to compare value types by value, allowing equivalent value objects to resolve
to the same object tag.

In hashObjectTag, use convertObjectToHash to hash value types by their
contents. In hashEqualObjectTag, use valueTypeCapableAcmp to compare
value types by value, allowing equivalent value objects to resolve to
the same object tag.
j9object_t ref = ((J9JVMTIObjectTag *)entry)->ref;

#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
if ((NULL != userData) && (NULL != ref)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can userData be NULL ?

goto fail;
}
j9env->objectTagTable = hashTableNew(OMRPORT_FROM_J9PORT(vm->portLibrary), J9_GET_CALLSITE(), 0, sizeof(J9JVMTIObjectTag), sizeof(jlong), 0, J9MEM_CATEGORY_JVMTI, hashObjectTag, hashEqualObjectTag, NULL, NULL);
j9env->objectTagTable = hashTableNew(OMRPORT_FROM_J9PORT(vm->portLibrary), J9_GET_CALLSITE(), 0, sizeof(J9JVMTIObjectTag), sizeof(jlong), 0, J9MEM_CATEGORY_JVMTI, hashObjectTag, hashEqualObjectTag, NULL, vm);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vm is only needed if J9VM_OPT_VALHALLA_VALUE_TYPES is defined.

}

#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
if ((NULL != userData) && (NULL != lhsRef) && (NULL != rhsRef)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can userData be NULL ?

@hangshao0 hangshao0 added comp:jvmti project:valhalla Used to track Project Valhalla related work labels Jul 13, 2026
@harship04 harship04 marked this pull request as draft July 14, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:jvmti project:valhalla Used to track Project Valhalla related work

Projects

Status: TODO: VM

Development

Successfully merging this pull request may close these issues.

2 participants