[code-reflection] RFR: Correct computation of block indexes

Paul Sandoz psandoz at openjdk.org
Thu Feb 1 21:03:37 UTC 2024


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).

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

Commit messages:
 - Correct computation of block indexes

Changes: https://git.openjdk.org/babylon/pull/14/files
 Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=14&range=00
  Stats: 117 lines in 3 files changed: 115 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/babylon/pull/14.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/14/head:pull/14

PR: https://git.openjdk.org/babylon/pull/14


More information about the babylon-dev mailing list