[code-reflection] RFR: Implement shift ops [v3]
Hannes Greule
hgreule at openjdk.org
Mon Apr 15 18:00:16 UTC 2024
> 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?
Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
add comment to ReflectMethods, fix missed renamings
-------------
Changes:
- all: https://git.openjdk.org/babylon/pull/49/files
- new: https://git.openjdk.org/babylon/pull/49/files/d00fd09f..f3d38ee2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=babylon&pr=49&range=02
- incr: https://webrevs.openjdk.org/?repo=babylon&pr=49&range=01-02
Stats: 17 lines in 2 files changed: 2 ins; 0 del; 15 mod
Patch: https://git.openjdk.org/babylon/pull/49.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/49/head:pull/49
PR: https://git.openjdk.org/babylon/pull/49
More information about the babylon-dev
mailing list