Strict field verification
Brian Goetz
brian.goetz at oracle.com
Mon Nov 4 18:47:25 UTC 2024
This line:
> *Each method of a value class that has its|ACC_SYNCHRONIZED|flag set
must also have its|ACC_STATIC|flag set.*
makes me think we might want to take this further. The ACC_SYNCHRONIZED
bit was a design mistake; it makes for two ways to do the same thing in
the bytecode. We might consider simply not allowing ACC_SYNC in value
classes at all, and either (a) have the compiler simulate the effect of
a static sync method by wrapping the body with a suitable sync block, or
simply (b) disallowing sync methods in value classes entirely.
On 10/29/2024 11:59 PM, Dan Smith wrote:
> Here's a draft spec for JEP 401 that adds verification rules to ensure that strict instance fields are assigned to before a constructor calls 'super()':
>
> https://cr.openjdk.org/~dlsmith/jep401/jep401-20241030/specs/value-objects-jvms.html
>
> Briefly, this change includes:
> - Enhancing the treatment of verification flags to support new kinds of flags
> - Defining 'flagFieldUnset' flags for unset strict instance fields
> - Enhancing StackMapTable to be able to express these flags
> - Removing the flags in 'putfield'
> - Ensuring the fields are removed in 'invokespecial'
>
> I'd like to go over it at tomorrow's EG meeting. It's fresh, so I wouldn't be surprised if there are a few bugs! Hopefully it covers all the key new concepts.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-experts/attachments/20241104/86ddd96d/attachment.htm>
More information about the valhalla-spec-experts
mailing list