RFR: 8228604: StackMapFrames are missing from redefined class bytes of retransformed classes

Serguei Spitsyn sspitsyn at openjdk.org
Wed Feb 1 04:53:52 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

The fix looks good in general.
I've posted a couple of suggestions.
Will make another pass through it tomorrow.
Thanks,
Serguei

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/MissedStackMapFrames.java line 62:

> 60:     private static int getStackMapFrameCount(byte[] classfileBuffer) {
> 61:         ClassReader reader = new ClassReader(classfileBuffer);
> 62:         final int[] frameCount = {0};

I guess, we can use just int instead of an array element.

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp line 34:

> 32:     vprintf(format, args);
> 33:     va_end(args);
> 34:     fflush(0);

We normally use indent 2 for native code in JVMTI tests.

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

PR: https://git.openjdk.org/jdk/pull/12155


More information about the serviceability-dev mailing list