[lworld] RFR: 8331006: [lworld] Support of null markers for nullable flat fields [v2]

Frederic Parain fparain at openjdk.org
Wed May 1 13:44:10 UTC 2024


On Fri, 26 Apr 2024 17:25:03 GMT, Dan Heidinga <heidinga at openjdk.org> wrote:

>> Frederic Parain has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixing issues spotted during reviews
>
> src/hotspot/cpu/aarch64/templateTable_aarch64.cpp line 3359:
> 
>> 3357:       Label is_flat, has_null_marker, done;
>> 3358:       __ test_field_has_null_marker(r3, noreg /* temp */, has_null_marker);
>> 3359:       __ null_check(r0);
> 
> Does `__ null_check(r0);` need to occur first to make sure we consistently null check the receiver object?  Or is the null receiver check handled in the InterpreterRuntime::write_nullale_flat_field helper?

The receiver object is in r2, which is checked when retrieved with pop_and_check_object(). r0 is the new field value. If the flat field has a null marker, it means it is nullable, so null is a valid value for r0, and the null check must not be performed. If the field doesn't have a null marker, this is a null-free field, and the null check is performed. So I think the null_check(r0) is at the right place.

> src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 354:
> 
>> 352:       has_instance_fields = true;
>> 353:       LayoutRawBlock* block;
>> 354:       // if (fs.field_flags().is_null_free_inline_type()) {
> 
> Left over commented code or breadcrumb for future update?

Old code, will be removed in next commit.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1078#discussion_r1586309369
PR Review Comment: https://git.openjdk.org/valhalla/pull/1078#discussion_r1586309985



More information about the valhalla-dev mailing list