RFR: 8341612: [BACKOUT] 8338442: AArch64: Clean up IndOffXX type and let legitimize_address() fix out-of-range operands

Fei Gao fgao at openjdk.org
Mon Oct 7 13:35:38 UTC 2024


On Mon, 7 Oct 2024 09:03:14 GMT, Andrew Haley <aph at openjdk.org> wrote:

> The right thing to do, I think, is to make the segfault handler code a bit smarter. We'll need to go through the process again, with the original fix.

Hi @theRealAph , with the original fix, what do you think of the idea that we just skip implicit null check if we need extra lea to handle some special memory access on `aarch64`?  Suppose these special memory accesses are uncommon.


diff --git a/src/hotspot/share/opto/lcm.cpp b/src/hotspot/share/opto/lcm.cpp
index 3c6de96074a..aaa50ca15b7 100644
--- a/src/hotspot/share/opto/lcm.cpp
+++ b/src/hotspot/share/opto/lcm.cpp
@@ -261,6 +261,14 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo
       continue;
     }
 
+    // Check if the offset is addressable. On aarch64 platforms, if the offset is
+    // not addressable, C2 will emit an extra lea before the address can be used.
+    // But ImplicitNullChecks assumes that the first emitted instruction is the
+    // implicit null check pc.
+    if (!Matcher::offset_is_addressable(mach)) {
+      continue;
+    }
+
     // check if the offset is not too high for implicit exception
     {
       intptr_t offset = 0;

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

PR Comment: https://git.openjdk.org/jdk/pull/21381#issuecomment-2396950342


More information about the hotspot-dev mailing list