[code-reflection] RFR: OpBuilder optimizations - part 1. [v2]

Paul Sandoz psandoz at openjdk.org
Wed Nov 12 20:58:28 UTC 2025


On Wed, 12 Nov 2025 20:25:48 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Good point, too clever perhaps :-) I suspect it is easy to enhance `CodeModelTranslator` to support the generation of multiple AST methods from func ops, and on a case by case basis enhanced to support the translation of additional ops we need to use (e.g., conditional expression op to the ? : operator node).
>
> Unfortunately I found `CodeModelTranslator` only supports very limited set of ops, no nested bodies and no more than a single entry block per method. I expect getting it at least to the shape of `BytecodeGenerator` would require non-trivial amount of work.

If that were the goal then I agree it would certainly be a non-trivial amount of work. We have a more modest goal - ensuring that a code model for a reasonably large reflectable method/lambda can be encoded using our current mechanism without breaking class file limits. We need to be good enough, and this unlikely to be the final solution as to how we store the code model.

Looking at the `OpBuilder` changes in `createSupportFunctions` I suspect that the enhancements required to  `CodeModelTranslator` are manageable e.g., support for multiple methods, and the ? : operator. @mabbay wrote `CodeModelTranslator` and he may have a sense of how easy it would be to enhance with support for additional ops.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/679#discussion_r2519793316


More information about the babylon-dev mailing list