[code-reflection] RFR: Remove op name state from Op
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Sep 22 10:01:01 UTC 2025
On Thu, 18 Sep 2025 23:54:49 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> The operation's name should only be used for writing to and parsing from text, or more generally when externalizing the operation. Otherwise, it should not generally be relied upon since the class itself should be sufficient (although there currently are a few areas, namely the interpreter that should be updated in a separate PR to remove its dependence on that).
>
> - `Op` no longer has an instance field holding the operation name
> - `Op.opName` is named to `Op.externalizeOpName`
> - By default the method `Op.externalizeOpName` returns `this.getClass().getName()`, which may be overridden.
>
> Also cleaned up `Op`, making more methods final and grouping methods more appropriately.
The change looks good.
When looking at `Op` now, one sees both `externalizeOpName()` and `externalize()` which are used to obtain externalized name and attrs. At this point I wonder if it wouldn't be more succinct to have a single `externalize` method that returned an `ExternalizedOp` ? (although, admittedly, this might go back to some similar state we had previously)
-------------
Marked as reviewed by mcimadamore (Reviewer).
PR Review: https://git.openjdk.org/babylon/pull/577#pullrequestreview-3251555076
More information about the babylon-dev
mailing list