Skip to content

Use VM helper for unresolved fields with value type flattening - #24624

Draft
hzongaro wants to merge 1 commit into
eclipse-openj9:masterfrom
hzongaro:unresolved-reference-fields-with-value-types
Draft

Use VM helper for unresolved fields with value type flattening#24624
hzongaro wants to merge 1 commit into
eclipse-openj9:masterfrom
hzongaro:unresolved-reference-fields-with-value-types

Conversation

@hzongaro

Copy link
Copy Markdown
Member

If null-restricted value type support is enabled, the JIT compiler currently fails to compile or inline methods that contain unresolved references to reference type fields.

Define the jitResolveFlattenableField VM helper, and a SymbolReferenceTable method for creating symbol references for it, and modify IL Generation to generate calls to that helper as well as the jit{Get|Put}FlattenableField helpers to load from or store to unresolved reference fields. Note that despite the names, those helpers will be used even if the field turns out to be an identity field, as the JIT will not have enough information at compile time.

The jitGetFlattenableField helper is only needed if flattening of null- restricted value types is enabled. The jitPutFlattenableField helper is needed if null-restricted values types are enabled, even if flattening is not enabled, as a check for assigning a null reference to a null-restricted field might be needed.

As special cases, when generating IL to load a field that is known to be null-restricted, mark the node as isNonNull. Also, if null-restricted field flattening is not enabled, and the value that's being stored to an unresolved field is known to be non-null, there's no need to use VM helpers to perform the store.

Also remove the jitWithFlattenableField helper, as it's no longer needed.

Marking this as a draft pull request as it depends on pull requests #24623 and eclipse-omr/omr#8413.

If null-restricted value type support is enabled, the JIT compiler
currently fails to compile or inline methods that contain unresolved
references to reference type fields.

Define the jitResolveFlattenableField VM helper, and a
SymbolReferenceTable method for creating symbol references for it, and
modify IL Generation to generate calls to that helper as well as the
jit{Get|Put}FlattenableField helpers to load from or store to unresolved
reference fields.  Note that despite the names, those helpers will be
used even if the field turns out to be an identity field, as the JIT
will not have enough information at compile time.

The jitGetFlattenableField helper is only needed if flattening of null-
restricted value types is enabled.  The jitPutFlattenableField helper
is needed if null-restricted values types are enabled, even if
flattening is not enabled, as a check for assigning a null reference to
a null-restricted field might be needed.

As special cases, when generating IL to load a field that is known to be
null-restricted, mark the node as isNonNull.  Also, if null-restricted
field flattening is not enabled, and the value that's being stored to an
unresolved field is known to be non-null, there's no need to use VM
helpers to perform the store.

Also remove jitWithFlattenableField helper, as it's no longer needed.

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
@hzongaro hzongaro added comp:jit project:valhalla Used to track Project Valhalla related work labels Aug 25, 2026
@hzongaro

Copy link
Copy Markdown
Member Author

Marking this as a draft pull request as it depends on pull requests #24623 and eclipse-omr/omr#8413.

It also exposes issues #24505 and #24596, so it can't be merged before those issues have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant