[lworld] RFR: 8359377: [lworld] Fix cp indexes in larval stackmaps in redefinition

Dan Heidinga heidinga at openjdk.org
Fri Jun 13 20:34:35 UTC 2025


On Thu, 12 Jun 2025 17:19:25 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Need to write a test.

src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 3295:

> 3293:    if (frame_type == 246) {  // EARLY_LARVAL
> 3294:      // rewrite_cp_refs in  unset fields and fall through.
> 3295:      rewrite_cp_refs_in_unset_fields(stackmap_p, stackmap_end, calc_number_of_entries, frame_type);

larval_frames contain an embedded frame - one of the other frames listed in the `stack_map_frame` union.  This fixes the field NameAndTypes but doesn't update the embedded frame.

The `stackmap_p` ptr is updated in the `rewrite_cp_refs_in_unset_fields` but haven't yet updated the `frame_type`.  I think we need to redo this code before exiting this block:

    frame_type = *stackmap_p;
    stackmap_p++;

test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/RedefineStrictFieldsTest.java line 92:

> 90:         // Rename class "StrictFieldsNew" to "StrictFieldsOld" so we can redefine it.
> 91:         byte [] buf = replaceAllStrings("StrictFieldsNew", "StrictFieldsOld");
> 92:         // Now redine the original version.

Suggestion:

        // Now redefine the original version.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1487#discussion_r2143310452
PR Review Comment: https://git.openjdk.org/valhalla/pull/1487#discussion_r2146034907


More information about the valhalla-dev mailing list