[code-reflection] RFR: Dialect factory
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Jun 17 11:32:42 UTC 2025
On Fri, 13 Jun 2025 23:51:15 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> Group op factory and type element factory into dialect factory record.
>
> The synthetic method added by javac to build a code model now has no parameters. The dialect factory, namely that for Java ops and type elements, is accessed from within the generated method body. This simplifies the connections between compiler/runtime and code reflection (see the reduction in `CodeReflectionSymbols.java` and `InnerClassLambdaMetafactory.java`).
>
> The synthetic method's accessibility is now private, as is the synthetic method to access the quoted instance from a quotable lambda's functional interface implementation.
>
> Further alignment of the factories and their use will occur in one or more subsequent PRs.
Marked as reviewed by mcimadamore (Reviewer).
src/jdk.incubator.code/share/classes/jdk/incubator/code/dialect/DialectFactory.java line 10:
> 8: * @param typeElementFactory the type element factory.
> 9: */
> 10: public record DialectFactory(OpFactory opFactory, TypeElementFactory typeElementFactory) {
I wonder -- would it make sense for this to implement `Function<Block.Builder, Value>` ? E.g. should a dialect factory have the ability to "load itself" ? That would simplify the signature of `OpBuilder` as well as its use -- but might also be a stretch too far.
-------------
PR Review: https://git.openjdk.org/babylon/pull/441#pullrequestreview-2935268862
PR Review Comment: https://git.openjdk.org/babylon/pull/441#discussion_r2152026813
More information about the babylon-dev
mailing list