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

Adam Sotona asotona at openjdk.org
Wed Nov 12 21:11:30 UTC 2025


On Wed, 12 Nov 2025 20:54:32 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> 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.

It is an option.
I just don't see much of added value when we manually hard-code proprietary code models and then translate them with proprietary translator to ASTs. BytecodeGenerator here revealed bugs in the models, and on the other side it revealed blind spots in the BytecodeGenerator itself.
It would make more sense to hard-code it in the ASTs then. 
For example the `tableswitch` instruction I would like to look at it in the BytecodeGenerator have the same problem in the CodeModelTranslator.

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

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


More information about the babylon-dev mailing list