RFR: 8273454: C2: Transform (-a)*(-b) into a*b [v4]

Tobias Hartmann thartmann at openjdk.java.net
Thu Sep 16 07:26:51 UTC 2021


On Thu, 16 Sep 2021 07:23:30 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> The inner loop ensures that all tests hit JIT-ed version. If the transformation is broken, I would prefer the test fails for the very first iteration, instead of somewhere in the middle.
>> 
>> I refactored the code to remove inner loop.
>> 
>> Also, fixed command option.
>
> You can't control the iteration in which the test would fail if there's a bug in C2 (it could only fail for **some** random values). Therefore, you could as well use random values for the warmup and simply increase `TEST_COUNT` to ensure that C2 compilation is triggered and we run a reasonable amount of iterations with C2 compiled code. 
> 
> Your newest version of the test now has the problem that OSR compilation might C2 compile the computation of the expected value and then you are comparing the output of a C2 compiled method to a C2 compiled method instead of the interpreter. You have the following options:
> - Compute the expected value as `a * b`. In that case it's fine if the computation is C2 compiled as well.
> - Prevent compilation of the `run*` methods (either by disabling OSR compilation or by completely disabling compilation of these methods)

And sorry for being picky here but I would like to keep tests as simple as possible :)

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

PR: https://git.openjdk.java.net/jdk/pull/5403


More information about the hotspot-compiler-dev mailing list