RFR: 8228604: StackMapFrames are missing from redefined class bytes of retransformed classes
Alex Menkov
amenkov at openjdk.org
Fri Jan 27 23:14:17 UTC 2023
On Tue, 24 Jan 2023 00:16:10 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
> classFileParser drops stack map frames for JDK classes (when verification is not required).
> As a result JvmtiClassFileReconstituter cannot restore the attribute for class redefinition.
> Note that if the class is in CDS archive, the frames are restored from CDS, so this issue affects only JDK classes which are not in CDS.
> This code is old (from "initial load") and I don't understand the reason it was implemented this way.
>
> Testing: tier1-tier6
Now it becomes clearer why it was implemented this way. I suppose there is a reason why CDS does not elide the attributes when verification is not required.
Looking at the code history I see that in former times the method allocated memory for the returned attribute (now it returns pointer in the source stream), so this code reduced the footprint.
I agree that this inconsistency is not a bug itself - RetransformClasses spec says "Some attributes may not be present" (in the class bytes passed to CFLH), and JDK-8228604 may be closed as "not an issue".
But I still think it make sense to simplify the logic and just keep stackmap table for all classes is class bytes contain them.
@dholmes-ora what do you think?
-------------
PR: https://git.openjdk.org/jdk/pull/12155
More information about the serviceability-dev
mailing list