[code-reflection] RFR: Implement shift ops
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Apr 18 17:18:29 UTC 2024
On Thu, 18 Apr 2024 17:10:24 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> As you can see, the compiler assumes we want an int shift, and then narrows the long operand into an int. This is different from what happens for all the other binary ops (e.g. for `+` we would have widened the int operand to long, and then used a long add).
> As you can see, the bytecode contains no
See code in `Gen`:
// The expected type of the right operand is
// the second parameter type of the operator, except for
// shifts with long shiftcount, where we convert the opcode
// to a short shift and the expected type to int.
Type rtype = operator.erasure(types).getParameterTypes().tail.head;
if (opcode >= ishll && opcode <= lushrl) {
opcode = opcode + (ishl - ishll);
rtype = syms.intType;
}
-------------
PR Comment: https://git.openjdk.org/babylon/pull/49#issuecomment-2064618907
More information about the babylon-dev
mailing list