[code-reflection] RFR: Optimize type construction in OpBuilder

Adam Sotona asotona at openjdk.org
Wed Nov 19 19:18:46 UTC 2025


On Wed, 19 Nov 2025 17:34:30 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

> Further optimize OpBuilder by reducing the overhead of type construction.

Initial construction of the typeElementFactory seems to me obsolete. 

var dialectFactory = dialectFactoryF.apply(builder);
this.typeElementFactory = builder.op(invoke(DIALECT_FACTORY_TYPE_ELEMENT_FACTORY, dialectFactory));

src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/OpBuilder.java line 345:

> 343:                     var i = b.parameter(INT);
> 344: 
> 345:                     var dialectFactory = b.op(fieldLoad(FieldRef.field(JavaOp.class, "JAVA_DIALECT_FACTORY", DialectFactory.class)));

Here we may need to pass the actual type factory, instead of the hard-coded `JavaOp.JAVA_DIALECT_FACTORY`.

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

PR Comment: https://git.openjdk.org/babylon/pull/687#issuecomment-3554244591
PR Review Comment: https://git.openjdk.org/babylon/pull/687#discussion_r2543253941


More information about the babylon-dev mailing list