[code-reflection] RFR: Bytecode round 9 [v32]

Paul Sandoz psandoz at openjdk.org
Fri Aug 9 23:24:46 UTC 2024


On Fri, 9 Aug 2024 08:52:16 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Bytecode round 9 contains following improvements:
>> - `String` (and non-`String`) concats are lifted to `CoreOp.ConcatOp`
>> - `LocalsTypeMapper` is fixed to use instruction index as a key (instead of the instruction identity)
>> - `LocalsTypeMapper` newly calculates types of uninitialized stack map frame entries and provides that info to `BytecodeLift`
>> - `BytecodeLift` is fixed to handle deep stacks correctly while branching + tests added
>> - Oboslete `BytecodeGenerator::conversion` method is replaced by direct call of `CodeBuilder::conversion`
>> - LocalTypeMapper performs iterative correction of int stack map frame entries to support byte, boolean, short and char types
>> 
>> `TestSmallCorpus` is not experiencing any first-lift exceptions after the above changes, however we cannot yet say that all the lifted models are correct.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updated TestSmallCorpus

I don't understand all the details about the exception mapping - i am going on the increase of lifted code and round tripping improvements of the small corpus test, great progress!

src/java.base/share/classes/java/lang/reflect/code/bytecode/BytecodeGenerator.java line 950:

> 948:         return uses.size() > 1
> 949:             || uses.size() == 1 && uses.iterator().next().op().operands().stream().filter(o -> o == res).count() > 1
> 950:             || inBlockArgs(res);

Uses will return a use if the value used as an operand or as a successor argument, but as you found out it will not differentiate between single and multiple uses of the same value for the same operation, which in theory could be across operands or successor arguments.

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

Marked as reviewed by psandoz (Lead).

PR Review: https://git.openjdk.org/babylon/pull/192#pullrequestreview-2231231522
PR Review Comment: https://git.openjdk.org/babylon/pull/192#discussion_r1712360725


More information about the babylon-dev mailing list