[code-reflection] RFR: OpWriter block naming align with block indexes [v3]
Paul Sandoz
psandoz at openjdk.org
Mon May 27 15:29:21 UTC 2024
On Mon, 27 May 2024 06:02:47 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/reflect/code/writer/OpWriter.java line 58:
>>
>>> 56:
>>> 57: private String blockId(Block b) {
>>> 58: if (b.index() < 0) return "__" + blockOrdinal++;
>>
>> This should always be true `b.parentBody().blocks().indexOf(this) == b.index()` - a block's index should never be negative. Are you observing such a case?
>
> I assumed such case is possible based on the implementation comment:
>
> // Block is inoperable when < 0 i.e., when partially built
> int index = -1;
>
> However it can simplify if OpWriter could never be called on a partially built block.
It's not possible to traverse a partially built code model via the builders, since access is limited, and a builder can never produce partial or structurally incorrect models, since it would fail otherwise.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/91#discussion_r1616187876
More information about the babylon-dev
mailing list