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

Daniel Lundén duke at openjdk.org
Wed Dec 6 13:36:34 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

Given the +/-1MB range for `adr`, would it instead be a good idea to limit `-XX:NMethodSizeLimit` to 1MB? Then we would not need the fix at all and could still use `adr`.

Something similar to:

diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp
index 1c22cf16cfe..e2057d20e59 100644
--- a/src/hotspot/share/c1/c1_globals.hpp
+++ b/src/hotspot/share/c1/c1_globals.hpp
@@ -277,7 +277,7 @@
                                                                             \
   develop(intx, NMethodSizeLimit, (64*K)*wordSize,                          \
           "Maximum size of a compiled method.")                             \
-          range(0, max_jint)                                                \
+          range(0, 1*M)                                                     \
                                                                             \
   develop(bool, TraceFPUStack, false,                                       \
           "Trace emulation of the FPU stack (intel only)")                  \

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

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


More information about the hotspot-compiler-dev mailing list