RFR: 8282365: Optimize divideUnsigned and remainderUnsigned for constants [v15]

Emanuel Peter epeter at openjdk.org
Mon Jul 3 14:01:09 UTC 2023


On Sat, 10 Jun 2023 01:25:55 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   whitespace
>
> May I have a second review for this patch, please?

@merykitty I just discussed the testing with @TobiHartmann . He just came across this test:
`test/hotspot/jtreg/compiler/c2/TestUnsignedByteCompare1.java`.
The cool thing is that you can "simulate" constants with `MethodHandles.constant`. At runtime apparently the invocation specualte-and-traps it to a constant value. That means you can just set a new value, it depopts, and hopefully eventually re-compiles with the next constants.

You could easily set up one of these tests per node. Any maybe throw in some interesting ranges for the `dividend`.

An interesting experiment would be to have a IR test that works with a random constant, and then have an IR rule that fails if we find a`div` node. At least for those cases where that should work. And then you can easily compare the div results with a non-compiled method that computes the same value.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/9947#issuecomment-1618337778


More information about the hotspot-compiler-dev mailing list