[aarch64-port-dev ] RFR: 8170188: jtreg compiler/types/TestMeetIncompatibleInterfaceArrays.java causes JVM crash

Andrew Haley aph at redhat.com
Wed Nov 23 17:16:22 UTC 2016


On 23/11/16 15:57, Sergey Nazarkin wrote:
> OK, I see we're speaking about different JDK, I’ referencing to JDK8 from ARRCH64-port project

Got it.  I doesn't affect current source at all, and it's a weird
corner case.  Please try this; it doesn't affect normal code at all,
just when we're using some very odd runtime options.

Thanks,

Andrew.



diff --git a/src/cpu/aarch64/vm/interp_masm_aarch64.cpp b/src/cpu/aarch64/vm/interp_masm_aarch64.cpp
--- a/src/cpu/aarch64/vm/interp_masm_aarch64.cpp
+++ b/src/cpu/aarch64/vm/interp_masm_aarch64.cpp
@@ -1451,14 +1451,20 @@
 // Jump if ((*counter_addr += increment) & mask) satisfies the condition.
 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
                                                         int increment, int mask,
-                                                        Register scratch, bool preloaded,
+                                                        Register scratch, Register scratch2,
+                                                        bool preloaded,
                                                         Condition cond, Label* where) {
   if (!preloaded) {
     ldrw(scratch, counter_addr);
   }
   add(scratch, scratch, increment);
   strw(scratch, counter_addr);
-  ands(scratch, scratch, mask);
+  if (operand_valid_for_logical_immediate(/*is32*/true, mask))
+    andsw(scratch, scratch, mask);
+  else {
+    movw(scratch2, (unsigned)mask);
+    andsw(scratch, scratch, scratch2);
+  }
   br(cond, *where);
 }

diff --git a/src/cpu/aarch64/vm/interp_masm_aarch64.hpp b/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
--- a/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
+++ b/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
@@ -234,7 +234,8 @@
                              bool decrement = false);
   void increment_mask_and_jump(Address counter_addr,
                                int increment, int mask,
-                               Register scratch, bool preloaded,
+                               Register scratch, Register scratch2,
+                               bool preloaded,
                                Condition cond, Label* where);
   void set_mdp_flag_at(Register mdp_in, int flag_constant);
   void test_mdp_data_at(Register mdp_in, int offset, Register value,
diff --git a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
@@ -345,7 +345,7 @@
       // Increment counter in the MDO
       const Address mdo_invocation_counter(r0, in_bytes(MethodData::invocation_counter_offset()) +
                                                 in_bytes(InvocationCounter::counter_offset()));
-      __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rscratch1, false, Assembler::EQ, overflow);
+      __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rscratch1, rscratch2, false, Assembler::EQ, overflow);
       __ b(done);
     }
     __ bind(no_mdo);
@@ -354,7 +354,7 @@
                   MethodCounters::invocation_counter_offset() +
                   InvocationCounter::counter_offset());
     __ get_method_counters(rmethod, rscratch2, done);
-    __ increment_mask_and_jump(invocation_counter, increment, mask, rscratch1, false, Assembler::EQ, overflow);
+    __ increment_mask_and_jump(invocation_counter, increment, mask, rscratch1, rscratch2, false, Assembler::EQ, overflow);
     __ bind(done);
   } else {
     const Address backedge_counter(rscratch2,
diff --git a/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/src/cpu/aarch64/vm/templateTable_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateTable_aarch64.cpp
+++ b/src/cpu/aarch64/vm/templateTable_aarch64.cpp
@@ -1762,14 +1762,14 @@
         const Address mdo_backedge_counter(r1, in_bytes(MethodData::backedge_counter_offset()) +
                                            in_bytes(InvocationCounter::counter_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
-                                   r0, false, Assembler::EQ, &backedge_counter_overflow);
+                                   r0, rscratch2, false, Assembler::EQ, &backedge_counter_overflow);
         __ b(dispatch);
       }
       __ bind(no_mdo);
       // Increment backedge counter in MethodCounters*
       __ ldr(rscratch1, Address(rmethod, Method::method_counters_offset()));
       __ increment_mask_and_jump(Address(rscratch1, be_offset), increment, mask,
-                                 r0, false, Assembler::EQ, &backedge_counter_overflow);
+                                 r0, rscratch2, false, Assembler::EQ, &backedge_counter_overflow);
     } else {
       // increment counter
       __ ldr(rscratch2, Address(rmethod, Method::method_counters_offset()));


More information about the aarch64-port-dev mailing list