6890984: Comparison of 2 arrays could cause VM crash
authorkvn
Wed, 14 Oct 2009 15:03:32 -0700
changeset 4019 6d6674c9e7d7
parent 4018 a73b8aa8e89d
child 4020 19d5ae561c5f
child 4092 3765f3db43c1
6890984: Comparison of 2 arrays could cause VM crash Summary: Restore original null checks. Reviewed-by: never, cfang
hotspot/src/cpu/sparc/vm/sparc.ad
hotspot/src/cpu/x86/vm/assembler_x86.cpp
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Oct 14 11:42:59 2009 -0700
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Oct 14 15:03:32 2009 -0700
@@ -3016,7 +3016,7 @@
 
     // return true if the same array
     __ cmp(ary1_reg, ary2_reg);
-    __ br(Assembler::equal, true, Assembler::pn, Ldone);
+    __ brx(Assembler::equal, true, Assembler::pn, Ldone);
     __ delayed()->add(G0, 1, result_reg); // equal
 
     __ br_null(ary1_reg, true, Assembler::pn, Ldone);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Oct 14 11:42:59 2009 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Oct 14 15:03:32 2009 -0700
@@ -8634,8 +8634,10 @@
 
   if (is_array_equ) {
     // Need additional checks for arrays_equals.
-    andptr(ary1, ary2);
-    jcc(Assembler::zero, FALSE_LABEL); // One pointer is NULL
+    testptr(ary1, ary1);
+    jcc(Assembler::zero, FALSE_LABEL);
+    testptr(ary2, ary2);
+    jcc(Assembler::zero, FALSE_LABEL);
 
     // Check the lengths
     movl(limit, Address(ary1, length_offset));