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

Paul Sandoz psandoz at openjdk.org
Tue Jan 23 21:51:55 UTC 2024


On Tue, 23 Jan 2024 17:10:20 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

> 8324556: Not copy result-type when copying an op

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

> 181:         @Override
> 182:         public TypeDesc resultType() {
> 183:             return body().descriptor().returnType();

Suggestion:

            return body.yieldType();

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

> 1889:         }
> 1890: 
> 1891:         VarOp(String varName, TypeDesc type, Value init) {

Used parameter `type`?

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

> 2521:         }
> 2522: 
> 2523:         protected BinaryOp(String name, TypeDesc resultType, Value lhs, Value rhs) {

Unused parameter `resultType`. Remove this and it will follow on to the sub-types and to the factory methods.

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

> 2751:         public TypeDesc resultType() {
> 2752:             return operands().get(0).type();
> 2753:         }

Move to `UnaryOp`?

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

> 3451:      * @return the cast operation
> 3452:      */
> 3453:     public static CastOp cast(TypeDesc resultType, TypeDesc t, Value v) {

Used parameter `resultType`.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1464016482
PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1464026260
PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1464033683
PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1464030641
PR Review Comment: https://git.openjdk.org/babylon/pull/6#discussion_r1464031820


More information about the babylon-dev mailing list