[code-reflection] RFR: Implement shift ops [v2]
Hannes Greule
hgreule at openjdk.org
Mon Apr 15 18:00:17 UTC 2024
On Mon, 15 Apr 2024 17:43:10 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?
>
> Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
>
> use Vector API names
I renamed the ops and added a comment to ReflectMethods. Let me know if you want me to change anything else.
-------------
PR Comment: https://git.openjdk.org/babylon/pull/49#issuecomment-2057499728
More information about the babylon-dev
mailing list