RFR: JDK-8315575: Retransform of record class with record component annotation fails with CFE [v3]

Alex Menkov amenkov at openjdk.org
Thu Mar 14 00:15:38 UTC 2024


On Wed, 13 Mar 2024 21:05:22 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> RecordComponent contains information about Record attribute, but it knows nothing about class bytes and attributute_count doesn't make sense for it.
>> So I think this is JvmtiClassFileReconstituter responsibility to calculate a value required to generate class bytes for RecordComponent.
>
> The `attributute_count ` is a property of the `RecordComponent` even though it is not stored but calculated.
> The `JvmtiClassFileReconstituter` should have a minimal knowledge about this property and how it is calculated, the same as any other consumer of the `RecordComponent`. Thre `RedefineClasses` in the future may need this number as well. Would it be also its responsibility to calculate it?

`attributute_count` is a property of `component_info` Record's attribute in the class file (it contains length of the following `attribute_info_attributes` array).
`RecordComponent` is VM representation of Record class attribute and contains data required by VM in a form that is useful for the VM.
`RecordComponent` knows nothing `attribute_info_attributes` array, so it does not need to know its length.

 ClassFileParser parses `attribute_info_attributes` array and convert it to corresponding fields of `RecordComponent`.
`JvmtiClassFileReconstituter` performs the reverse operation.
They may have different `attributute_count` (that's what this bug about).
If `RedefineClasses` needs the value, the code may be updated (it depends on what value it needs - from original class file or from reconstituted class file)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18161#discussion_r1524052651


More information about the hotspot-runtime-dev mailing list