[lworld] RFR: 8320437: [lworld] Adding internal null-restricted storage API points [v5]

Frederic Parain fparain at openjdk.org
Thu Nov 30 14:07:41 UTC 2023


On Wed, 29 Nov 2023 18:49:49 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> Adding internal null-restricted storage API points
>
> Frederic Parain has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix EnableValhalla/EnablePrimitiveClasses flags on aarch64

Right now, the substitution of the null reference with the default value is performed in Unsafe:

```    public Object getReference(Object o, long offset, Class<?> type) {
        Object ref = getReference(o, offset);
        if (ref == null && PrimitiveClass.isPrimitiveValueType(type)) {
            // If the type of the returned reference is a primitive value type,
            // return an uninitialized default value if null
            ref = uninitializedDefaultValue(type);
        }
        return ref;
    }

The problem in this method is that there's no information about the field except the offset, so it would be expensive to retrieve the field information to check the presence of the @NullRestricted annotation.
Moving the logic to VarHandle would make sense to me.

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

PR Comment: https://git.openjdk.org/valhalla/pull/947#issuecomment-1833845365



More information about the valhalla-dev mailing list