[code-reflection] Integrated: Implement shift ops
Hannes Greule
hgreule at openjdk.org
Mon Apr 15 18:29:00 UTC 2024
On Wed, 10 Apr 2024 15:31:15 GMT, Hannes Greule <hgreule at openjdk.org> wrote:
> This PR implements the three shift operations. There are a few points to discuss:
> - naming: I chose the names as the operators are called in the JLS, but e.g. for comparisons we currently have short names. The Compiler also uses a different naming scheme here. Which way do we want to go here?
> - shift operations are different from other binary ops as their operands undergo unary numeric promotion rather than binary numeric promotion. However, on bytecode level the rhs will always be an int anyway. I'm currently handling that in the bytecode generator, and the model is close to the JLS otherwise. Any objections here?
> - I reworked the testing to allow for combinations of different types, as that's important for the current design of shifts (especially `int shift long` should result in an int again)
>
> I also noticed that I missed assignment operators when I did and, or, xor before. I left it out here as well, as this needs additional care, at least for the interpreter. Code like
>
> void m(byte b) {
> b *= 2;
> }
>
> doesn't run when using the interpreter currently. Should I add assignment operator handling here anyway?
This pull request has now been integrated.
Changeset: a0e0953b
Author: Hannes Greule <hgreule at openjdk.org>
Committer: Paul Sandoz <psandoz at openjdk.org>
URL: https://git.openjdk.org/babylon/commit/a0e0953b736c2ae0eaa0f859e90801f3954c326b
Stats: 315 lines in 5 files changed: 280 ins; 3 del; 32 mod
Implement shift ops
Reviewed-by: psandoz
-------------
PR: https://git.openjdk.org/babylon/pull/49
More information about the babylon-dev
mailing list