Skip to content

Commit

Permalink
Don't assume lockword of class is at index 0
Browse files Browse the repository at this point in the history
With valuetypes it's possible for the lockword not
to be the first field.

Signed-off-by: Theresa Mammarella <[email protected]>
  • Loading branch information
theresa-m committed Nov 21, 2024
1 parent abfb92f commit c9599cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/jcl/common/java_lang_invoke_MethodHandleNatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,8 +1368,12 @@ Java_java_lang_invoke_MethodHandleNatives_resolve(
target = (jlong)offset;
}
}

#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
/* In project Valhalla fields may start at offset 0. */
if ((NULL != new_clazz) && ((0 != vmindex) || J9_ARE_ANY_BITS_SET(flags, MN_IS_METHOD | MN_IS_CONSTRUCTOR))) {
#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
if ((0 != target) && ((0 != vmindex) || J9_ARE_ANY_BITS_SET(flags, MN_IS_METHOD | MN_IS_CONSTRUCTOR))) {
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
/* Refetch reference after GC point */
membernameObject = J9_JNI_UNWRAP_REFERENCE(self);
if (addMemberNameToClass(currentThread, membernameObject, new_clazz)) {
Expand Down

0 comments on commit c9599cd

Please sign in to comment.