[code-reflection] RFR: 8324556: Not copy result-type when copying an op [v3]
Paul Sandoz
psandoz at openjdk.org
Tue Jan 30 19:05:53 UTC 2024
On Tue, 30 Jan 2024 18:54:17 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> 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.
>
> For now, should I validate during construction ?
I suggest to remove checks from these checks, don't add them to the constructor, and add a @@@ note in the constructor. We need to revisit this area for construction/validation of all ops, where there are two entry points, from its definition and from its factory method (the latter is potentially more controlled than the former)
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1471800519
More information about the babylon-dev
mailing list