[code-reflection] RFR: Rearrange ops/types into dialects

Paul Sandoz psandoz at openjdk.org
Fri Jun 13 16:18:46 UTC 2025


Group the operations and types into dialects.

We currently have three distinct areas:

1) The core, comprising type elements such as Var, Tuple and operations such as constant, branch, closure, var, and var.load/store. Some of these have correspondence to Java expressions or statements, and some are used to model Java program behavior, but they are also general purpose.

2) The core, comprising the java type elements, and operations such as return, invoke, and instanceof that more specifically model some Java expression or statement, or more specific Java program behavior. Some Java operations can be repurposed e.g. arithmetic operations.

3) The extended, comprising operations such as for and if, using types from 1 and 2, that can lower into operations from 1 and 2. These model Java expressions, statements or more specific Java program behavior that have nested structure, often with control flow.

At the moment we lump 1 and 2 together under `CoreOp`, and separate 3 under `ExtendedOp`. This PR separates out 1 and 2, and lumps together 2 and 3:

- separating 1 into a dialect named "core" under `CoreOp`; and

- lumping 2 and 3 into a dialect named “java” under `JavaOp`.

The following packages are created to place relevant types/ops:

    java.lang.reflect.code.dialect.core
    java.lang.reflect.code.dialect.java

The packages `java.lang.reflect.code.op` and `java.lang.reflect.code.type` are removed.

This PR will retain the type element factory and op factory design. We can revisit that in another PR.

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

Commit messages:
 - HAT updates
 - SPIRV example.
 - Update Triton example
 - Update ONNX example.
 - Rearrange ops/types into dialects.

Changes: https://git.openjdk.org/babylon/pull/440/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=440&range=00
  Stats: 17859 lines in 263 files changed: 8304 ins; 8209 del; 1346 mod
  Patch: https://git.openjdk.org/babylon/pull/440.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/440/head:pull/440

PR: https://git.openjdk.org/babylon/pull/440


More information about the babylon-dev mailing list