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

Don't assume lockword of class is at index 0 #20642

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

theresa-m
Copy link
Contributor

With valuetypes it's possible for the lockword not to be the first field.

Unblocks #20386

@theresa-m theresa-m requested a review from hangshao0 November 19, 2024 20:15
@theresa-m theresa-m added comp:vm project:valhalla Used to track Project Valhalla related work labels Nov 19, 2024
@@ -1369,7 +1369,7 @@ Java_java_lang_invoke_MethodHandleNatives_resolve(
}
}

if ((0 != target) && ((0 != vmindex) || J9_ARE_ANY_BITS_SET(flags, MN_IS_METHOD | MN_IS_CONSTRUCTOR))) {
if ((NULL != new_clazz) && ((0 != vmindex) || J9_ARE_ANY_BITS_SET(flags, MN_IS_METHOD | MN_IS_CONSTRUCTOR))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we limit this change only to affect instance field in project Valhalla.

@hangshao0
Copy link
Contributor

hangshao0 commented Nov 20, 2024

Adding @TobiAjila as reviewer. This change is removing the assumption that visible instance field starts at offset != 0. Value type and example class in #20386 (comment) could have its visible instance field start at offset 0.

@tajila
Copy link
Contributor

tajila commented Nov 21, 2024

Jenkins test sanity,extended xlinuxval jdknext

@tajila
Copy link
Contributor

tajila commented Nov 21, 2024

jenkins test sanity.functional win jdk8

Copy link
Contributor

@hangshao0 hangshao0 left a comment

Choose a reason for hiding this comment

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

You can add a comment in the code that field could start from offset 0 in Valhalla.

Comment on lines 1371 to 1372
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
/* In project Valhalla fields may start at offset 0. */
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be restructured so there's only one if statement, not an extra { that would be unmatched, and eliminate duplication of the common subexpression:

			if (
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
				/* In project Valhalla fields may start at offset 0. */
				(NULL != new_clazz)
#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
				(0 != target)
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
				&& ((0 != vmindex) || J9_ARE_ANY_BITS_SET(flags, MN_IS_METHOD | MN_IS_CONSTRUCTOR))
			) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the change to match this.

With valuetypes it's possible for the lockword not
to be the first field.

Signed-off-by: Theresa Mammarella <[email protected]>
@theresa-m
Copy link
Contributor Author

Any more comments on this change?

@hangshao0
Copy link
Contributor

Any more comments on this change?

@keithc-ca ^^

@hangshao0 hangshao0 merged commit c44f0de into eclipse-openj9:master Nov 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm project:valhalla Used to track Project Valhalla related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants