[code-reflection] RFR: Replace the use of Interpreter to create Quoted instance with specialized code [v13]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jun 3 11:07:02 UTC 2025


On Sat, 31 May 2025 03:13:12 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Creating Quoted instance was done by invoking the Interpreter. The Interpreter is too general and if someone could somehow inject any code model we will interpret that as well. This PR replace the use of the interpreter with specialized code.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add error messages

src/jdk.incubator.code/share/classes/jdk/incubator/code/op/CoreOp.java line 4478:

> 4476:     }
> 4477: 
> 4478:     public static OpAndValues quotedOp(FuncOp funcOp) {

I'm a bit confused here as to what is the rationale for splitting this operation into two - e.g. this returns `OpAndValues` -- which contains the quoted op returned by `funcOp`, plus the values captured by the `funcOp` body, which are the parameters of `funcOp`, plus any captured value. Then we need to adapt this `OpAndValues` so that when we know what the array of actual captured values is, we create new operands that point to these values -- we do this in `QuotedHelper`. Why can't the two steps be merged (e.g. have `quotedOp` also take an `Object[]` array and return a `Quoted`) ? Do we have use cases where we expect to do one step w/o the other?

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

PR Review Comment: https://git.openjdk.org/babylon/pull/424#discussion_r2123470324


More information about the babylon-dev mailing list