[code-reflection] RFR: Bytecode round 12 [v3]

Adam Sotona asotona at openjdk.org
Mon Sep 2 06:10:40 UTC 2024


On Mon, 2 Sep 2024 06:04:31 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/reflect/code/bytecode/BytecodeGenerator.java line 399:
>> 
>>> 397:         }
>>> 398: 
>>> 399:         Set<Block> stopBlocks = new HashSet<>();
>> 
>> If i got this right, we are dealing with an equivalent of an uninitialized variable, of a primitive type, in source that will be assigned in divergent code paths, and the compiler will check it's DA. In the model we currently require the modelling var op be initialized with a default constant value for the primitive type. We don't currently have a concept of an uninitialized value (which might help?), so we have to detect that all loads are dominated by stores, some of which are initializing stores (which detects the uninitialized case or a redundant initialization).
>> 
>> This specific bit of code after the dominated by checks determines if there is a path from `n`'s declaring block to the entry block that does not pass through any of `dom`'s declaring blocks? Why is that is important?
>
> Yes, this is about uninitialized variables (of any type), where there are two or more assignments in divergent paths. Concept of uninitialized variable will definitely help to avoid obsolete default constants declaration. This is a detection of such situation, so the default initialization is skipped and the roundtrip is stable.

This code detect there is no path from a VarLoadOp to the entry block that does not pass any of the VarStoreOps. The default initialization is necessary if there is such path. I've just made it more abstract to a dominance test of dominant set.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/219#discussion_r1740367865


More information about the babylon-dev mailing list