[aarch64-port-dev ] RFR: suppress implicit null check when offsets too large for immediate

Edward Nevill edward.nevill at linaro.org
Wed Mar 19 17:41:47 UTC 2014


Hi,

The following patch suppresses the null pointer check if the offset is too large to fit in a single load/store.

This is necessary because in this case MacroAssembler::form_address can insert extra instructions before the load/store and the null pointer check can end up pointing to the wrong instruction.

For simplicity in this patch I suppress the implicit null pointer check with any offset >= 1024 (ie I just pass 0 as the shift value to offset_ok_for_immed). The actual shift value does not seem to be readily available and I do not believe it will make any significant difference.

This is not a pretty solution and I think it needs to be revised in the future with a better structured approach to handle this. However for now this will solve the problem.

Regards,
Ed.

--- CUT HERE ---
exporting patch:
# HG changeset patch
# User Edward Nevill edward.nevill at linaro.org
# Date 1395250240 0
#      Wed Mar 19 17:30:40 2014 +0000
# Node ID 43a2aad9e18b9f6b304e68bede9ce46c86659774
# Parent  9393c177ac9b9407f1f4e58bd662b719b40ded54
Suppress implicit null pointer check if offset too large for immediate

diff -r 9393c177ac9b -r 43a2aad9e18b src/share/vm/opto/lcm.cpp
--- a/src/share/vm/opto/lcm.cpp	Wed Mar 19 16:15:50 2014 +0000
+++ b/src/share/vm/opto/lcm.cpp	Wed Mar 19 17:30:40 2014 +0000
@@ -219,6 +219,11 @@
         if( val->bottom_type()->isa_narrowoop() &&
             MacroAssembler::needs_explicit_null_check(offset) )
           continue;             // Give up if offset is beyond page size
+#ifdef AARCH64
+        if( val->bottom_type()->isa_narrowoop() &&
+            !Address::offset_ok_for_immed(offset, 0) )
+          continue;
+#endif
         // cannot reason about it; is probably not implicit null exception
       } else {
         const TypePtr* tptr;
@@ -236,6 +241,10 @@
         offset += tptr->_offset; // correct if base is offseted
         if( MacroAssembler::needs_explicit_null_check(offset) )
           continue;             // Give up is reference is beyond 4K page size
+#ifdef AARCH64
+	if( !Address::offset_ok_for_immed(offset, 0) )
+	  continue;
+#endif
       }
     }
 
--- CUT HERE ---




More information about the aarch64-port-dev mailing list