[lworld] RFR: 8349945: Implement strict static fields (proposed JVM feature) [v3]

Dan Heidinga heidinga at openjdk.org
Mon May 26 13:30:05 UTC 2025


On Fri, 23 May 2025 20:26:57 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> This patch enables and implements verification for fields with the ACC_STATIC and ACC_STRICT modifiers. To enforce strictness on static fields, the reads and writes on the field are tracked dynamically to ensure that the field is written before being read and written to before.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Chen and Dan comments and cleanup

src/hotspot/share/prims/jni.cpp line 2060:

> 2058:   if (!k->is_instance_klass() ||
> 2059:       !InstanceKlass::cast(k)->find_field(fieldname, signame, true, &fd)) {
> 2060:     assert(InstanceKlass::cast(k)->is_initialized(), "must be");

The assert is right before throwing a NoSuchFieldError.  If we're going to assert, we want to do it on the path that can return the jfieldID so it needs to be moved out of the `if` block

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1465#discussion_r2107360282


More information about the valhalla-dev mailing list