RFR: 8305990: Stripping debug info of ASM 9.5 fails [v2]
Adam Sotona
asotona at openjdk.org
Wed Apr 19 13:35:50 UTC 2023
On Wed, 19 Apr 2023 13:06:20 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Classfile API didn't handle transformations of class files version 50 and below correctly.
>>
>> Proposed fix have two parts:
>> 1. Inflation of branch targets does not depend on StackMapTable attribute presence for class file version 50 and below. Alternative fallback implementation is provided.
>> 2. StackMapTable attribute is not generated for class file versions below 50.
>>
>> StackMapsTest is also extended to test this patch.
>>
>> Please review.
>>
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>
> DiscontinuedInstruction implementation + test
I’m proposing following changes to Classfile API:
- Drop Opcode.Kind.UNSUPPORTED and add Opcode.Kind.DISCONTINUED_JSR and DISCONTINUED_RET
- Add DiscontinuedInstruction interface with inner JsrInstruction and RetInstruction with standard factory methods
- CodeImpl will parse and stream these instructions when present in the Code attribute
- Do not add any new conveniency methods to CodeBuilder, the only way to build a code with these instructions will be cob.with(DiscontinuedInstruction. JsrInstruction.of(…)) and similar for RetInstruction
- Fix DirectCodeBuilder so it invokes StackMapGenerator only for class file version >= 51.0 (BufWriterImpl must hold class version for that purpose)
- Fix StackMapGenerator error message when these instruction appear in during generation
- Implement fallback to jump target inflation in CodeImpl when the StackMapTable attribute is missing and class file version is < 51.0
- Extend tests to verify JSR and RET instructions are correctly generated, transformed and reported as error (based on class file version).
Next step is to implement simple maxStack and maxLocals counter into DirectCodeBuilder for the cases where StackMapGenerator is not involved. Actual default to maxStack = maxLocals = 255 is not correct.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13478#issuecomment-1514739739
More information about the core-libs-dev
mailing list