[code-reflection] RFR: Array view and PtrOp changes [v7]
Gary Frost
gfrost at openjdk.org
Wed Jan 14 12:02:33 UTC 2026
On Tue, 13 Jan 2026 20:30:53 GMT, Ruby Chen <duke at openjdk.org> wrote:
>> Implementing suggested array view and ptrOp changes, cleaning up code.
>
> Ruby Chen has updated the pull request incrementally with one additional commit since the last revision:
>
> Fixes
hat/core/src/main/java/hat/dialect/HATPtrOp.java line 54:
> 52: .map(fieldNode -> fieldNode.name)
> 53: .toList();
> 54: // remove the "array" field from the fields
So remove the last "array" field from fields then remove my "is this .... " comment?
hat/core/src/main/java/hat/phases/HATArrayViewPhase.java line 61:
> 59: switch (op) {
> 60: case JavaOp.InvokeOp $ when invoke(lookup(), $) instanceof Invoke invoke -> {
> 61: if (invoke.namedIgnoreCase("add","sub","mul","div")) {
Oh good catch. Sorry about that.
hat/core/src/main/java/hat/phases/HATArrayViewPhase.java line 66:
> 64: lookup(),
> 65: invoke.name(),
> 66: invoke.varOpFromFirstUseOrThrow().varName(), // varNameFromInvokeFirstUseOrThrow(invoke)
remove the comment?
hat/core/src/main/java/hat/phases/HATArrayViewPhase.java line 130:
> 128: Op.Result buffer = replaced.getOrDefault(r, r);
> 129: if (HATPhaseUtils.isVectorOp(lookup(),arrayLoadOp)) {
> 130: Op vop = opFromFirstOperandOrThrow(buffer.op()); // resultFromFirstOperandOrNull(buffer.op())).op();
same remove all these comments where I suggested using helpers.
hat/core/src/main/java/hat/phases/HATArrayViewPhase.java line 250:
> 248: (res.op() instanceof JavaOp.ArrayAccessOp || res.op() instanceof JavaOp.ArrayLengthOp)) {
> 249: buffer = res;
> 250: indices.addFirst(res.op() instanceof JavaOp.ArrayAccessOp ? res.op().operands().get(1).result() : res.op().operands().get(0).result());
You might comment this. I guess this is differentiated whether this is a store/load and then selecting operand?
take a look at OpHelper.resultOfOperandNOrThrow...
hat/core/src/main/java/hat/phases/HATArrayViewPhase.java line 253:
> 251:
> 252: }
> 253: // I think we need to comment this. Not so obvious.
You can remove my request for comment, if you feel the comment suffices ;)
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690140029
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690142515
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690143727
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690145091
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690152859
PR Review Comment: https://git.openjdk.org/babylon/pull/814#discussion_r2690154400
More information about the babylon-dev
mailing list