8139674: aarch64: guarantee failure in TestOptionsWithRanges.java
authorenevill
Thu, 15 Oct 2015 15:33:54 +0000
changeset 33192 31b8f55e4c08
parent 33191 e155b02f22fc
child 33194 1af73c83efae
8139674: aarch64: guarantee failure in TestOptionsWithRanges.java Summary: Fix negative overflow in instruction field Reviewed-by: kvn, roland, adinn, aph
hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Fri Oct 16 02:05:54 2015 +0300
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Thu Oct 15 15:33:54 2015 +0000
@@ -1547,14 +1547,14 @@
     if (MethodData::profile_arguments()) {
       Label done;
       int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
-      add(mdp, mdp, off_to_args);
 
       for (int i = 0; i < TypeProfileArgsLimit; i++) {
         if (i > 0 || MethodData::profile_return()) {
           // If return value type is profiled we may have no argument to profile
-          ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+          ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
           sub(tmp, tmp, i*TypeStackSlotEntries::per_arg_count());
           cmp(tmp, TypeStackSlotEntries::per_arg_count());
+          add(rscratch1, mdp, off_to_args);
           br(Assembler::LT, done);
         }
         ldr(tmp, Address(callee, Method::const_offset()));
@@ -1562,26 +1562,27 @@
         // stack offset o (zero based) from the start of the argument
         // list, for n arguments translates into offset n - o - 1 from
         // the end of the argument list
-        ldr(rscratch1, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args));
+        ldr(rscratch1, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))));
         sub(tmp, tmp, rscratch1);
         sub(tmp, tmp, 1);
         Address arg_addr = argument_address(tmp);
         ldr(tmp, arg_addr);
 
-        Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args);
+        Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i)));
         profile_obj_type(tmp, mdo_arg_addr);
 
         int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
-        add(mdp, mdp, to_add);
         off_to_args += to_add;
       }
 
       if (MethodData::profile_return()) {
-        ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+        ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
         sub(tmp, tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
       }
 
+      add(rscratch1, mdp, off_to_args);
       bind(done);
+      mov(mdp, rscratch1);
 
       if (MethodData::profile_return()) {
         // We're right after the type profile for the last