[code-reflection] RFR: Correct computation of block indexes
Adam Sotona
asotona at openjdk.org
Fri Feb 2 09:50:11 UTC 2024
On Thu, 1 Feb 2024 20:59:19 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> If there are blocks present in a body that have no predecessors then all the blocks in the body will report incorrect indexes.
>
> The following should hold for any block:
>
> b.parentBody().blocks().indexOf(b) == b.index();
>
>
> Thereby it is possible to use a block's index efficiently with bit sets or boolean arrays.
>
> Note, blocks without predecessors are currently retained since they may have been intentionally added. Sometimes they can also be added by a transformation, which expects subsequent transformations to ignore or remove such blocks (such as a the bytecode generator, which ignores such blocks).
👍
-------------
Marked as reviewed by asotona (Reviewer).
PR Review: https://git.openjdk.org/babylon/pull/14#pullrequestreview-1858808505
More information about the babylon-dev
mailing list