RFR: 8320682: [AArch64] C1 compilation fails with "Field too big for insn"

Andrew Haley aph at openjdk.org
Wed Dec 6 10:17:36 UTC 2023


On Mon, 4 Dec 2023 14:19:10 GMT, Daniel Lundén <duke at openjdk.org> wrote:

> This changeset fixes an issue on aarch64 where addresses for float and double constants were sometimes out of range for PC-relative offsets using `adr`.
> 
> Changes:
> - Fix the issue by replacing `adr` with `lea`.
> - Add a regression test.
> 
> Thanks to @fisk  and @xmas92 for the assistance.
> 
> ### Testing
> Tests: tier1, tier2, tier3, tier4, tier5
> Platforms: windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64

This fix generates too much code. Please do this instead in both cases:



@@ -585,8 +585,8 @@ void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_cod
       if (__ operand_valid_for_float_immediate(c->as_jdouble())) {
         __ fmovd(dest->as_double_reg(), (c->as_jdouble()));
       } else {
-        __ adr(rscratch1, InternalAddress(double_constant(c->as_jdouble())));
-        __ ldrd(dest->as_double_reg(), Address(rscratch1));
+        __ mov(rscratch1, jlong_cast(c->as_jdouble()));
+        __ fmovd(dest->as_double_reg(), rscratch1);
       }
       break;
     }

I don't think this is the only place where we assume that a single method will be less than a megabyte when compiled. What triggered it?

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

PR Comment: https://git.openjdk.org/jdk/pull/16951#issuecomment-1842575812
PR Comment: https://git.openjdk.org/jdk/pull/16951#issuecomment-1842578283


More information about the hotspot-compiler-dev mailing list