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

Maurizio Cimadamore mcimadamore at openjdk.org
Thu May 22 10:52:17 UTC 2025


On Thu, 22 May 2025 02:50:07 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:
> 
>   Implement quotedOp method

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

> 4493:     public static Quoted quotedOp(FuncOp funcOp, Object[] args) {
> 4494: 
> 4495:         assert funcOp.body().blocks().size() == 1;

I believe the checks you enforce are correct -- but leaving these checks as plain `assert` feel odd -- e.g. this is the contract of an API method, so the contract of such method should be fully specified, and real exceptions must be thrown. With `assert`, the issues will only be reported if the user enables assertion when running their code (actually worse, since these assertions are inside JDK, they would need to enable "system assertions" -- which is to say that they will never see this code fail in the way you intended).

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

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


More information about the babylon-dev mailing list