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

Paul Sandoz psandoz at openjdk.org
Fri Feb 2 16:20:19 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).

This pull request has now been integrated.

Changeset: 16406cd8
Author:    Paul Sandoz <psandoz at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/16406cd82bc8c3f4f679e568fcc07681ea5ecf23
Stats:     117 lines in 3 files changed: 115 ins; 0 del; 2 mod

Correct computation of block indexes

Reviewed-by: asotona

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

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


More information about the babylon-dev mailing list