[code-reflection] RFR: Replace the use of Interpreter to create Quoted instance with specialized code [v13]
Paul Sandoz
psandoz at openjdk.org
Wed Jun 4 20:38:15 UTC 2025
On Wed, 4 Jun 2025 00:20:34 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> src/jdk.incubator.code/share/classes/jdk/incubator/code/op/CoreOp.java line 4531:
>>
>>> 4529: throw new IllegalArgumentException("Block parameter not an operand nor a captured value");
>>> 4530: }
>>> 4531: }
>>
>> I think it would be clearer to check up front that all block parameters are used only once to initialize a var op declared in the function's entry block, and further the var op's result is used. This should simplify the checking of all operations but the last two, since the main focus is then on var op initialized by constant op, and you don't need to track unvisited parameters.
>>
>> I think we should have a generic error message that includes a print out of the model. Being too detailed on the error message requires some careful finessing to make it understandable. Later we could refine to highlight the location in the model that is problematic.
>
> In general, a block param can be an operand, therefore not used to initialize a var op.
Yes, good point. IIRC javac would do this for the block parameter modeling `this` variable. We can still check all the block parameter cases upfront, i think that would make it clearer. e.g.,
for (var p : parameters) {
if (p is not used) error
else if (p is used once)
// used by var op, or member of captured set (operands + captured values)
else if (p is used more than once)
// member of captured set (operands + captured values)
}
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/424#discussion_r2127395860
More information about the babylon-dev
mailing list