[code-reflection] RFR: 8324556: Not copy result-type when copying an op [v3]

Paul Sandoz psandoz at openjdk.org
Tue Jan 30 01:38:50 UTC 2024


On Mon, 29 Jan 2024 17:34:59 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> 8324556: Not copy result-type when copying an op
>
> Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Review
>  - Add test

src/java.base/share/classes/java/lang/reflect/code/op/CoreOps.java line 1665:

> 1663:             @Override
> 1664:             public TypeDesc resultType() {
> 1665:                 // resultType is void, but we still call resultType method because it has validations in it

I think we should avoid specific validations in the call to `resultType()`, since it defers errors until the method is called.

In general i think we should separate out op specific validation into a separate method that ops can optionally implement (future work). The op constructors can perform some basic structural checks e.g., correct number of operands etc.

I have found checks on types when constructing ops (and by extension on a call to resultType) to sometimes be problematic, they can be fragile or too opinionated depending on how one consumes the model, and it seems they should reside in explicit validation functionality that can be optionally called.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1470471337


More information about the babylon-dev mailing list