Consistency in exception throws.

Make the messages that consist of a series of values consistently use
semicolons between the values, and make the call order for exception
throws that take both "info about a thing" as well as "info about a
use of that thing" take the "info about a thing" argument first.

Practical upshot: Adding a second semicolon in the message for
StringIndexOutOfBoundsException being thrown for a region, and
switching the order of arguments of
dvmThrowArrayIndexOutOfBoundsException().

Bug: 3500987
Change-Id: I97eb0046ab8997a68e2d6dfde5dbf3d02290c1f7
diff --git a/vm/Exception.c b/vm/Exception.c
index c26af02..aaf97a4 100644
--- a/vm/Exception.c
+++ b/vm/Exception.c
@@ -1210,7 +1210,7 @@
     dvmThrowException(gDvm.exArithmeticException, msg);
 }
 
-void dvmThrowArrayIndexOutOfBoundsException(int index, int length)
+void dvmThrowArrayIndexOutOfBoundsException(int length, int index)
 {
     dvmThrowExceptionFmt(gDvm.exArrayIndexOutOfBoundsException,
         "length=%d; index=%d", length, index);
@@ -1416,7 +1416,7 @@
 void dvmThrowStringIndexOutOfBoundsExceptionWithRegion(jsize stringLength,
         jsize requestStart, jsize requestLength) {
     dvmThrowExceptionFmt(gDvm.exStringIndexOutOfBoundsException,
-            "length=%d; regionStart=%d regionLength=%d",
+            "length=%d; regionStart=%d; regionLength=%d",
             stringLength, requestStart, requestLength);
 }
 
diff --git a/vm/Exception.h b/vm/Exception.h
index 2653e76..3022e04 100644
--- a/vm/Exception.h
+++ b/vm/Exception.h
@@ -215,9 +215,9 @@
 
 /*
  * Throw an ArrayIndexOutOfBoundsException in the current thread,
- * using the given index and array length in the detail message.
+ * using the given array length and index in the detail message.
  */
-void dvmThrowArrayIndexOutOfBoundsException(int index, int length);
+void dvmThrowArrayIndexOutOfBoundsException(int length, int index);
 
 /*
  * Throw an ArrayStoreException in the current thread, using the given classes'
diff --git a/vm/Jni.c b/vm/Jni.c
index 2b9522f..c09803c 100644
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -3024,7 +3024,7 @@
 static bool checkArrayElementBounds(ArrayObject* arrayObj, jsize index) {
     assert(arrayObj != NULL);
     if (index < 0 || index >= (int) arrayObj->length) {
-        dvmThrowArrayIndexOutOfBoundsException(index, arrayObj->length);
+        dvmThrowArrayIndexOutOfBoundsException(arrayObj->length, index);
         return false;
     }
     return true;
diff --git a/vm/interp/Interp.c b/vm/interp/Interp.c
index 71eeecb..c671624 100644
--- a/vm/interp/Interp.c
+++ b/vm/interp/Interp.c
@@ -940,7 +940,7 @@
     size = arrayData[2] | (((u4)arrayData[3]) << 16);
 
     if (size > arrayObj->length) {
-        dvmThrowArrayIndexOutOfBoundsException(size, arrayObj->length);
+        dvmThrowArrayIndexOutOfBoundsException(arrayObj->length, size);
         return false;
     }
     copySwappedArrayData(arrayObj->contents, &arrayData[4], size, width);
diff --git a/vm/mterp/armv5te/footer.S b/vm/mterp/armv5te/footer.S
index 0c6b0f4..73e8efa 100644
--- a/vm/mterp/armv5te/footer.S
+++ b/vm/mterp/armv5te/footer.S
@@ -990,14 +990,13 @@
 /*
  * Invalid array index. Note that our calling convention is strange; we use r1
  * and r3 because those just happen to be the registers all our callers are
- * using. We shuffle them here before calling the C function.
+ * using. We move r3 before calling the C function, but r1 happens to match.
  * r1: index
  * r3: size
  */
 common_errArrayIndex:
     EXPORT_PC()
-    mov     r0, r1
-    mov     r1, r3
+    mov     r0, r3
     bl      dvmThrowArrayIndexOutOfBoundsException
     b       common_exceptionThrown
 
diff --git a/vm/mterp/c/OP_APUT_OBJECT.c b/vm/mterp/c/OP_APUT_OBJECT.c
index f4c3326..950f18c 100644
--- a/vm/mterp/c/OP_APUT_OBJECT.c
+++ b/vm/mterp/c/OP_APUT_OBJECT.c
@@ -14,7 +14,7 @@
             GOTO_exceptionThrown();
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {
             dvmThrowArrayIndexOutOfBoundsException(
-                GET_REGISTER(vsrc2), arrayObj->length);
+                arrayObj->length, GET_REGISTER(vsrc2));
             GOTO_exceptionThrown();
         }
         obj = (Object*) GET_REGISTER(vdst);
diff --git a/vm/mterp/c/opcommon.c b/vm/mterp/c/opcommon.c
index 7ee07b3..fc7d9a2 100644
--- a/vm/mterp/c/opcommon.c
+++ b/vm/mterp/c/opcommon.c
@@ -453,7 +453,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -478,7 +478,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpAsm-armv5te-vfp.S b/vm/mterp/out/InterpAsm-armv5te-vfp.S
index c42ca9d..19c152f 100644
--- a/vm/mterp/out/InterpAsm-armv5te-vfp.S
+++ b/vm/mterp/out/InterpAsm-armv5te-vfp.S
@@ -21316,14 +21316,13 @@
 /*
  * Invalid array index. Note that our calling convention is strange; we use r1
  * and r3 because those just happen to be the registers all our callers are
- * using. We shuffle them here before calling the C function.
+ * using. We move r3 before calling the C function, but r1 happens to match.
  * r1: index
  * r3: size
  */
 common_errArrayIndex:
     EXPORT_PC()
-    mov     r0, r1
-    mov     r1, r3
+    mov     r0, r3
     bl      dvmThrowArrayIndexOutOfBoundsException
     b       common_exceptionThrown
 
diff --git a/vm/mterp/out/InterpAsm-armv5te.S b/vm/mterp/out/InterpAsm-armv5te.S
index 627f1a4..a1977ee 100644
--- a/vm/mterp/out/InterpAsm-armv5te.S
+++ b/vm/mterp/out/InterpAsm-armv5te.S
@@ -21774,14 +21774,13 @@
 /*
  * Invalid array index. Note that our calling convention is strange; we use r1
  * and r3 because those just happen to be the registers all our callers are
- * using. We shuffle them here before calling the C function.
+ * using. We move r3 before calling the C function, but r1 happens to match.
  * r1: index
  * r3: size
  */
 common_errArrayIndex:
     EXPORT_PC()
-    mov     r0, r1
-    mov     r1, r3
+    mov     r0, r3
     bl      dvmThrowArrayIndexOutOfBoundsException
     b       common_exceptionThrown
 
diff --git a/vm/mterp/out/InterpAsm-armv7-a-neon.S b/vm/mterp/out/InterpAsm-armv7-a-neon.S
index bbecc54..c7d3707 100644
--- a/vm/mterp/out/InterpAsm-armv7-a-neon.S
+++ b/vm/mterp/out/InterpAsm-armv7-a-neon.S
@@ -21254,14 +21254,13 @@
 /*
  * Invalid array index. Note that our calling convention is strange; we use r1
  * and r3 because those just happen to be the registers all our callers are
- * using. We shuffle them here before calling the C function.
+ * using. We move r3 before calling the C function, but r1 happens to match.
  * r1: index
  * r3: size
  */
 common_errArrayIndex:
     EXPORT_PC()
-    mov     r0, r1
-    mov     r1, r3
+    mov     r0, r3
     bl      dvmThrowArrayIndexOutOfBoundsException
     b       common_exceptionThrown
 
diff --git a/vm/mterp/out/InterpAsm-armv7-a.S b/vm/mterp/out/InterpAsm-armv7-a.S
index ab58120..4756775 100644
--- a/vm/mterp/out/InterpAsm-armv7-a.S
+++ b/vm/mterp/out/InterpAsm-armv7-a.S
@@ -21254,14 +21254,13 @@
 /*
  * Invalid array index. Note that our calling convention is strange; we use r1
  * and r3 because those just happen to be the registers all our callers are
- * using. We shuffle them here before calling the C function.
+ * using. We move r3 before calling the C function, but r1 happens to match.
  * r1: index
  * r3: size
  */
 common_errArrayIndex:
     EXPORT_PC()
-    mov     r0, r1
-    mov     r1, r3
+    mov     r0, r3
     bl      dvmThrowArrayIndexOutOfBoundsException
     b       common_exceptionThrown
 
diff --git a/vm/mterp/out/InterpAsm-x86.S b/vm/mterp/out/InterpAsm-x86.S
index 1c86f46..e401224 100644
--- a/vm/mterp/out/InterpAsm-x86.S
+++ b/vm/mterp/out/InterpAsm-x86.S
@@ -21928,9 +21928,9 @@
 common_errArrayIndex:
     EXPORT_PC
     movl    offArrayObject_length(%eax), %eax
-    movl    %ecx,OUT_ARG0(%esp)
-    movl    %eax,OUT_ARG1(%esp)
-    call    dvmThrowArrayIndexOutOfBoundsException   # args (index, length)
+    movl    %eax,OUT_ARG0(%esp)
+    movl    %ecx,OUT_ARG1(%esp)
+    call    dvmThrowArrayIndexOutOfBoundsException   # args (length, index)
     jmp     common_exceptionThrown
 
 /*
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index a8a663e..2d08590 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
@@ -2169,7 +2169,7 @@
             GOTO_exceptionThrown();
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {
             dvmThrowArrayIndexOutOfBoundsException(
-                GET_REGISTER(vsrc2), arrayObj->length);
+                arrayObj->length, GET_REGISTER(vsrc2));
             GOTO_exceptionThrown();
         }
         obj = (Object*) GET_REGISTER(vdst);
diff --git a/vm/mterp/out/InterpC-armv5te-vfp.c b/vm/mterp/out/InterpC-armv5te-vfp.c
index 0e13835..e40583f 100644
--- a/vm/mterp/out/InterpC-armv5te-vfp.c
+++ b/vm/mterp/out/InterpC-armv5te-vfp.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpC-armv5te.c b/vm/mterp/out/InterpC-armv5te.c
index 5847600..9cd0580 100644
--- a/vm/mterp/out/InterpC-armv5te.c
+++ b/vm/mterp/out/InterpC-armv5te.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpC-armv7-a-neon.c b/vm/mterp/out/InterpC-armv7-a-neon.c
index 0e87b82..00259c1 100644
--- a/vm/mterp/out/InterpC-armv7-a-neon.c
+++ b/vm/mterp/out/InterpC-armv7-a-neon.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpC-armv7-a.c b/vm/mterp/out/InterpC-armv7-a.c
index 92aeff1..c443bb3 100644
--- a/vm/mterp/out/InterpC-armv7-a.c
+++ b/vm/mterp/out/InterpC-armv7-a.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c
index c159bc7..edf7ec9 100644
--- a/vm/mterp/out/InterpC-portdbg.c
+++ b/vm/mterp/out/InterpC-portdbg.c
@@ -988,7 +988,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1013,7 +1013,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
@@ -2532,7 +2532,7 @@
             GOTO_exceptionThrown();
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {
             dvmThrowArrayIndexOutOfBoundsException(
-                GET_REGISTER(vsrc2), arrayObj->length);
+                arrayObj->length, GET_REGISTER(vsrc2));
             GOTO_exceptionThrown();
         }
         obj = (Object*) GET_REGISTER(vdst);
diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c
index 3d8fe6a..0b6ff7c 100644
--- a/vm/mterp/out/InterpC-portstd.c
+++ b/vm/mterp/out/InterpC-portstd.c
@@ -979,7 +979,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1004,7 +1004,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
@@ -2282,7 +2282,7 @@
             GOTO_exceptionThrown();
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {
             dvmThrowArrayIndexOutOfBoundsException(
-                GET_REGISTER(vsrc2), arrayObj->length);
+                arrayObj->length, GET_REGISTER(vsrc2));
             GOTO_exceptionThrown();
         }
         obj = (Object*) GET_REGISTER(vdst);
diff --git a/vm/mterp/out/InterpC-x86-atom.c b/vm/mterp/out/InterpC-x86-atom.c
index e8013da..22b1c9a 100644
--- a/vm/mterp/out/InterpC-x86-atom.c
+++ b/vm/mterp/out/InterpC-x86-atom.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c
index 00ac495..c84b236 100644
--- a/vm/mterp/out/InterpC-x86.c
+++ b/vm/mterp/out/InterpC-x86.c
@@ -996,7 +996,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         SET_REGISTER##_regsize(vdst,                                        \
@@ -1021,7 +1021,7 @@
             GOTO_exceptionThrown();                                         \
         if (GET_REGISTER(vsrc2) >= arrayObj->length) {                      \
             dvmThrowArrayIndexOutOfBoundsException(                         \
-                GET_REGISTER(vsrc2), arrayObj->length);                     \
+                arrayObj->length, GET_REGISTER(vsrc2));                     \
             GOTO_exceptionThrown();                                         \
         }                                                                   \
         ILOGV("+ APUT[%d]=0x%08x", GET_REGISTER(vsrc2), GET_REGISTER(vdst));\
diff --git a/vm/mterp/x86-atom/TODO.txt b/vm/mterp/x86-atom/TODO.txt
index 1c0acc8..115ac23 100644
--- a/vm/mterp/x86-atom/TODO.txt
+++ b/vm/mterp/x86-atom/TODO.txt
@@ -19,7 +19,7 @@
 
 (md) Correct OP_MONITOR_EXIT (need to adjust PC before throw)
 (md) OP_THROW needs to export the PC
-(md) Use dvmThrowArrayIndexOutOfBoundsException(index, length) for
+(md) Use dvmThrowArrayIndexOutOfBoundsException(length, index) for
      array bounds errors.
 (md) Use dvmThrowClassCastException(actual, desired) for class cast errors.
 (md) Use dvmThrowArrayStoreException(actual, desired) for array store errors.
diff --git a/vm/mterp/x86/footer.S b/vm/mterp/x86/footer.S
index a185096..643deb8 100644
--- a/vm/mterp/x86/footer.S
+++ b/vm/mterp/x86/footer.S
@@ -623,9 +623,9 @@
 common_errArrayIndex:
     EXPORT_PC
     movl    offArrayObject_length(%eax), %eax
-    movl    %ecx,OUT_ARG0(%esp)
-    movl    %eax,OUT_ARG1(%esp)
-    call    dvmThrowArrayIndexOutOfBoundsException   # args (index, length)
+    movl    %eax,OUT_ARG0(%esp)
+    movl    %ecx,OUT_ARG1(%esp)
+    call    dvmThrowArrayIndexOutOfBoundsException   # args (length, index)
     jmp     common_exceptionThrown
 
 /*