[lworld] RFR: 8354694: [lworld] Refactor AssertUnsetFields to Early Larval Frame
Chen Liang
liach at openjdk.org
Thu Apr 17 20:25:19 UTC 2025
On Wed, 16 Apr 2025 21:48:19 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
> This patch adds refactors so the runtime aligns with the new strict field initialization spec (https://cr.openjdk.org/~dlsmith/jep401/jep401-20250409/specs/strict-fields-jvms.html). The stackmap table entry `AssertUnsetFields` is now referred to as `Early_Larval` and it follows a new format where it is a frame that encompasses a base frame.
We might need a switch condition based on the preview status.
src/hotspot/share/classfile/stackMapTable.cpp line 298:
> 296: _parsed_frame_count++;
> 297: }
> 298:
If we have no early_larval wrapping, and there is no more `uninitializedThis` in locals, we implicitly set unset fields to empty. See last sentence in section 4.7.4.
So for control flow like:
if (check) {} else {}
this.strictField = xxx;
super();
if (check1) {} else {}
The frame at first then-else merge has `strictField` unset, but the frame at 2nd else branch off must not be wrapped in early_larval, and verifier must accordingly clear the unset fields.
src/hotspot/share/classfile/stackMapTable.cpp line 358:
> 356: u2 offset_delta = _stream->get_u2(CHECK_NULL);
> 357:
> 358: if (frame_type < EARLY_LARVAL) {
Here this can just be
Suggestion:
if (frame_type < SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
the case where it is `== EARLY_LARVAL` is already handled earlier, and you don't want this to accidentally handle newer frame types that nest other frames.
src/hotspot/share/classfile/verifier.cpp line 494:
> 492: break;
> 493: case STRICT_FIELDS_MISMATCH:
> 494: ss->print("Current frame's strict instance fields not compatible with stackmap.");
Suggestion:
ss->print("Current frame's strict instance fields not compatible with stackmap.");
-------------
PR Review: https://git.openjdk.org/valhalla/pull/1435#pullrequestreview-2774630303
PR Review Comment: https://git.openjdk.org/valhalla/pull/1435#discussion_r2048270388
PR Review Comment: https://git.openjdk.org/valhalla/pull/1435#discussion_r2048268059
PR Review Comment: https://git.openjdk.org/valhalla/pull/1435#discussion_r2048275741
More information about the valhalla-dev
mailing list