RFR: 8279301: c1 getObjectSize intrinsic should guard round mask constant

Aleksey Shipilev shade at openjdk.java.net
Fri Jan 14 10:37:32 UTC 2022


On Fri, 14 Jan 2022 09:41:38 GMT, Sergey Nazarkin <snazarki at openjdk.org> wrote:

> This is the fix for the issue that was found during the test of arm32 (see JDK-8279300).  Constant verification was added to the arm32 specific code but root cause was not fixed: the constant for logical AND op  can't be encoded directly and should be loaded to a register. **load_immediate** function is sophisticated enough and able to generate LIR_Const on the platforms where it is possible, and load op for arm32.

I think all uses of `logical_and` should be reconsidered too. I see that `LIRGenerator::load_immediate` does additional checks for `T_LONG` on AArch64 and PPC64. But doing it right now would probably fail due to `LIRGenerator::load_immediate` accepting `int`, truncating the long mask! 

I submitted the more generic bug here: https://bugs.openjdk.java.net/browse/JDK-8280003. Current ARM32 point fix looks fine, but you can also choose to close this one as duplicate, and help on more generic thing.

src/hotspot/share/c1/c1_LIRGenerator.cpp line 1423:

> 1421:   __ add(length_int, header_size, length_int);
> 1422:   if (round_mask != 0) {
> 1423:     // generates LIR_Const if mask fits instruction requirement

I think the comment here is excessive, especially given other uses of `logical_and` that would probably get fixed too.

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

Marked as reviewed by shade (Reviewer).

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


More information about the hotspot-compiler-dev mailing list