summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/004-JniTest/jni_test.cc12
-rw-r--r--test/004-ReferenceMap/stack_walk_refmap_jni.cc45
-rw-r--r--test/004-SignalTest/signaltest.cc9
-rw-r--r--test/040-miranda/src/Main.java4
-rw-r--r--test/040-miranda/src/MirandaAbstract.java2
-rw-r--r--test/040-miranda/src/MirandaClass.java3
-rw-r--r--test/040-miranda/src/MirandaClass2.java16
-rw-r--r--test/051-thread/expected.txt2
-rw-r--r--test/051-thread/src/Main.java54
-rw-r--r--test/051-thread/thread_test.cc38
-rw-r--r--test/083-compiler-regressions/expected.txt1
-rw-r--r--test/083-compiler-regressions/src/Main.java13
-rw-r--r--test/100-reflect2/expected.txt2
-rw-r--r--test/115-native-bridge/nativebridge.cc8
-rw-r--r--test/116-nodex2oat/nodex2oat.cc2
-rw-r--r--test/117-nopatchoat/expected.txt6
-rw-r--r--test/117-nopatchoat/nopatchoat.cc25
-rw-r--r--test/117-nopatchoat/src/Main.java9
-rw-r--r--test/118-noimage-dex2oat/noimage-dex2oat.cc4
-rw-r--r--test/126-miranda-multidex/build32
-rw-r--r--test/126-miranda-multidex/expected.txt32
-rw-r--r--test/126-miranda-multidex/info.txt2
-rwxr-xr-xtest/126-miranda-multidex/run21
-rw-r--r--test/126-miranda-multidex/src/Main.java56
-rw-r--r--test/126-miranda-multidex/src/MirandaAbstract.java36
-rw-r--r--test/126-miranda-multidex/src/MirandaClass.java52
-rw-r--r--test/126-miranda-multidex/src/MirandaClass2.java42
-rw-r--r--test/126-miranda-multidex/src/MirandaInterface.java31
-rw-r--r--test/126-miranda-multidex/src/MirandaInterface2.java26
-rwxr-xr-xtest/127-secondarydex/build31
-rw-r--r--test/127-secondarydex/expected.txt3
-rw-r--r--test/127-secondarydex/info.txt3
-rwxr-xr-xtest/127-secondarydex/run18
-rw-r--r--test/127-secondarydex/src/Main.java43
-rw-r--r--test/127-secondarydex/src/Super.java21
-rw-r--r--test/127-secondarydex/src/Test.java25
-rw-r--r--test/128-reg-spilling-on-implicit-nullcheck/expected.txt1
-rw-r--r--test/128-reg-spilling-on-implicit-nullcheck/info.txt1
-rw-r--r--test/128-reg-spilling-on-implicit-nullcheck/src/Main.java44
-rw-r--r--test/401-optimizing-compiler/src/Main.java12
-rw-r--r--test/406-fields/src/Main.java6
-rw-r--r--test/411-optimizing-arith/src/Main.java2
-rw-r--r--test/414-static-fields/src/Main.java6
-rw-r--r--test/415-optimizing-arith-neg/src/Main.java135
-rw-r--r--test/416-optimizing-arith-not/src/Main.java24
-rw-r--r--test/417-optimizing-arith-div/src/Main.java117
-rw-r--r--test/418-const-string/expected.txt2
-rw-r--r--test/418-const-string/info.txt1
-rw-r--r--test/418-const-string/src/Main.java28
-rw-r--r--test/419-long-parameter/expected.txt0
-rw-r--r--test/419-long-parameter/info.txt3
-rw-r--r--test/419-long-parameter/src/Main.java34
-rw-r--r--test/420-const-class/expected.txt16
-rw-r--r--test/420-const-class/info.txt1
-rw-r--r--test/420-const-class/src/Main.java77
-rw-r--r--test/421-exceptions/expected.txt20
-rw-r--r--test/421-exceptions/info.txt1
-rw-r--r--test/421-exceptions/src/Main.java65
-rw-r--r--test/421-large-frame/expected.txt0
-rw-r--r--test/421-large-frame/info.txt1
-rw-r--r--test/421-large-frame/src/Main.java2034
-rw-r--r--test/422-instanceof/expected.txt0
-rw-r--r--test/422-instanceof/info.txt1
-rw-r--r--test/422-instanceof/src/Main.java70
-rw-r--r--test/422-type-conversion/expected.txt0
-rw-r--r--test/422-type-conversion/info.txt1
-rw-r--r--test/422-type-conversion/src/Main.java302
-rw-r--r--test/423-invoke-interface/expected.txt0
-rw-r--r--test/423-invoke-interface/info.txt2
-rw-r--r--test/423-invoke-interface/src/Main.java120
-rw-r--r--test/424-checkcast/expected.txt0
-rw-r--r--test/424-checkcast/info.txt1
-rw-r--r--test/424-checkcast/src/Main.java73
-rw-r--r--test/425-invoke-super/expected.txt1
-rw-r--r--test/425-invoke-super/info.txt1
-rw-r--r--test/425-invoke-super/smali/invokesuper.smali40
-rw-r--r--test/425-invoke-super/smali/subclass.smali29
-rw-r--r--test/425-invoke-super/smali/superclass.smali29
-rw-r--r--test/425-invoke-super/src/Main.java55
-rw-r--r--test/426-monitor/expected.txt5
-rw-r--r--test/426-monitor/info.txt1
-rw-r--r--test/426-monitor/src/Main.java52
-rw-r--r--test/427-bitwise/expected.txt0
-rw-r--r--test/427-bitwise/info.txt1
-rw-r--r--test/427-bitwise/src/Main.java233
-rw-r--r--test/427-bounds/expected.txt0
-rw-r--r--test/427-bounds/info.txt2
-rw-r--r--test/427-bounds/src/Main.java51
-rw-r--r--test/428-optimizing-arith-rem/expected.txt0
-rw-r--r--test/428-optimizing-arith-rem/info.txt1
-rw-r--r--test/428-optimizing-arith-rem/src/Main.java160
-rw-r--r--test/703-floating-point-div/expected.txt1
-rw-r--r--test/703-floating-point-div/info.txt1
-rw-r--r--test/703-floating-point-div/src/Main.java90
-rw-r--r--test/800-smali/expected.txt3
-rw-r--r--test/800-smali/smali/b_17978759.smali28
-rwxr-xr-xtest/800-smali/smali/negLong.smali186
-rw-r--r--test/800-smali/smali/sameFieldNames.smali64
-rw-r--r--test/800-smali/src/Main.java82
-rw-r--r--test/Android.libarttest.mk1
-rw-r--r--test/Android.run-test.mk134
-rwxr-xr-xtest/etc/default-build4
-rwxr-xr-xtest/etc/run-test-jar30
-rwxr-xr-xtest/run-test18
104 files changed, 5103 insertions, 130 deletions
diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc
index 6fc4484731..c2877be02e 100644
--- a/test/004-JniTest/jni_test.cc
+++ b/test/004-JniTest/jni_test.cc
@@ -172,7 +172,7 @@ extern "C" void JNICALL Java_Main_testZeroLengthByteBuffers(JNIEnv* env, jclass)
constexpr size_t kByteReturnSize = 7;
jbyte byte_returns[kByteReturnSize] = { 0, 1, 2, 127, -1, -2, -128 };
-extern "C" jbyte JNICALL Java_Main_byteMethod(JNIEnv* env, jclass klass, jbyte b1, jbyte b2,
+extern "C" jbyte JNICALL Java_Main_byteMethod(JNIEnv*, jclass, jbyte b1, jbyte b2,
jbyte b3, jbyte b4, jbyte b5, jbyte b6,
jbyte b7, jbyte b8, jbyte b9, jbyte b10) {
// We use b1 to drive the output.
@@ -197,7 +197,7 @@ jshort short_returns[kShortReturnSize] = { 0, 1, 2, 127, 32767, -1, -2, -128,
static_cast<jshort>(0x8000) };
// The weird static_cast is because short int is only guaranteed down to -32767, not Java's -32768.
-extern "C" jshort JNICALL Java_Main_shortMethod(JNIEnv* env, jclass klass, jshort s1, jshort s2,
+extern "C" jshort JNICALL Java_Main_shortMethod(JNIEnv*, jclass, jshort s1, jshort s2,
jshort s3, jshort s4, jshort s5, jshort s6,
jshort s7, jshort s8, jshort s9, jshort s10) {
// We use s1 to drive the output.
@@ -217,7 +217,7 @@ extern "C" jshort JNICALL Java_Main_shortMethod(JNIEnv* env, jclass klass, jshor
return short_returns[s1];
}
-extern "C" jboolean JNICALL Java_Main_booleanMethod(JNIEnv* env, jclass klass, jboolean b1,
+extern "C" jboolean JNICALL Java_Main_booleanMethod(JNIEnv*, jclass, jboolean b1,
jboolean b2, jboolean b3, jboolean b4,
jboolean b5, jboolean b6, jboolean b7,
jboolean b8, jboolean b9, jboolean b10) {
@@ -239,7 +239,7 @@ extern "C" jboolean JNICALL Java_Main_booleanMethod(JNIEnv* env, jclass klass, j
constexpr size_t kCharReturnSize = 8;
jchar char_returns[kCharReturnSize] = { 0, 1, 2, 127, 255, 256, 15000, 34000 };
-extern "C" jchar JNICALL Java_Main_charMethod(JNIEnv* env, jclass klacc, jchar c1, jchar c2,
+extern "C" jchar JNICALL Java_Main_charMethod(JNIEnv*, jclass, jchar c1, jchar c2,
jchar c3, jchar c4, jchar c5, jchar c6, jchar c7,
jchar c8, jchar c9, jchar c10) {
// We use c1 to drive the output.
@@ -312,7 +312,7 @@ static void testShallowGetCallingClassLoader(JNIEnv* env) {
}
// http://b/16867274
-extern "C" JNIEXPORT void JNICALL Java_Main_nativeTestShallowGetCallingClassLoader(JNIEnv* env,
+extern "C" JNIEXPORT void JNICALL Java_Main_nativeTestShallowGetCallingClassLoader(JNIEnv*,
jclass) {
PthreadHelper(&testShallowGetCallingClassLoader);
}
@@ -350,7 +350,7 @@ static void testShallowGetStackClass2(JNIEnv* env) {
// ourselves.
}
-extern "C" JNIEXPORT void JNICALL Java_Main_nativeTestShallowGetStackClass2(JNIEnv* env, jclass) {
+extern "C" JNIEXPORT void JNICALL Java_Main_nativeTestShallowGetStackClass2(JNIEnv*, jclass) {
PthreadHelper(&testShallowGetStackClass2);
}
diff --git a/test/004-ReferenceMap/stack_walk_refmap_jni.cc b/test/004-ReferenceMap/stack_walk_refmap_jni.cc
index 291b45f358..631c4be90f 100644
--- a/test/004-ReferenceMap/stack_walk_refmap_jni.cc
+++ b/test/004-ReferenceMap/stack_walk_refmap_jni.cc
@@ -19,10 +19,13 @@
namespace art {
-#define CHECK_REGS_CONTAIN_REFS(native_pc_offset, ...) do { \
+#define CHECK_REGS_CONTAIN_REFS(dex_pc, abort_if_not_found, ...) do { \
int t[] = {__VA_ARGS__}; \
int t_size = sizeof(t) / sizeof(*t); \
- CheckReferences(t, t_size, m->NativeQuickPcOffset(m->ToNativeQuickPc(native_pc_offset))); \
+ uintptr_t native_quick_pc = m->ToNativeQuickPc(dex_pc, abort_if_not_found); \
+ if (native_quick_pc != UINTPTR_MAX) { \
+ CheckReferences(t, t_size, m->NativeQuickPcOffset(native_quick_pc)); \
+ } \
} while (false);
struct ReferenceMap2Visitor : public CheckReferenceMapVisitor {
@@ -40,31 +43,33 @@ struct ReferenceMap2Visitor : public CheckReferenceMapVisitor {
// we know the Dex registers with live reference values. Assert that what we
// find is what is expected.
if (m_name.compare("f") == 0) {
- CHECK_REGS_CONTAIN_REFS(0x03U, 8); // v8: this
- CHECK_REGS_CONTAIN_REFS(0x06U, 8, 1); // v8: this, v1: x
- CHECK_REGS_CONTAIN_REFS(0x08U, 8, 3, 1); // v8: this, v3: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x0cU, 8, 3, 1); // v8: this, v3: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x0eU, 8, 3, 1); // v8: this, v3: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x10U, 8, 3, 1); // v8: this, v3: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x03U, true, 8); // v8: this
+ CHECK_REGS_CONTAIN_REFS(0x06U, true, 8, 1); // v8: this, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x08U, true, 8, 3, 1); // v8: this, v3: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x0cU, true, 8, 3, 1); // v8: this, v3: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x0eU, true, 8, 3, 1); // v8: this, v3: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x10U, true, 8, 3, 1); // v8: this, v3: y, v1: x
// v2 is added because of the instruction at DexPC 0024. Object merges with 0 is Object. See:
// 0024: move-object v3, v2
// 0025: goto 0013
// Detaled dex instructions for ReferenceMap.java are at the end of this function.
// CHECK_REGS_CONTAIN_REFS(8, 3, 2, 1); // v8: this, v3: y, v2: y, v1: x
- // We eliminate the non-live registers at a return, so only v3 is live:
- CHECK_REGS_CONTAIN_REFS(0x13U); // v3: y
- CHECK_REGS_CONTAIN_REFS(0x18U, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
- CHECK_REGS_CONTAIN_REFS(0x1aU, 8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
- CHECK_REGS_CONTAIN_REFS(0x1dU, 8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
+ // We eliminate the non-live registers at a return, so only v3 is live.
+ // Note that it is OK for a compiler to not have a dex map at this dex PC because
+ // a return is not a safepoint.
+ CHECK_REGS_CONTAIN_REFS(0x13U, false); // v3: y
+ CHECK_REGS_CONTAIN_REFS(0x18U, true, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
+ CHECK_REGS_CONTAIN_REFS(0x1aU, true, 8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
+ CHECK_REGS_CONTAIN_REFS(0x1dU, true, 8, 5, 2, 1, 0); // v8: this, v5: x[1], v2: y, v1: x, v0: ex
// v5 is removed from the root set because there is a "merge" operation.
// See 0015: if-nez v2, 001f.
- CHECK_REGS_CONTAIN_REFS(0x1fU, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
- CHECK_REGS_CONTAIN_REFS(0x21U, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
- CHECK_REGS_CONTAIN_REFS(0x27U, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x29U, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x2cU, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x2fU, 8, 4, 3, 2, 1); // v8: this, v4: ex, v3: y, v2: y, v1: x
- CHECK_REGS_CONTAIN_REFS(0x32U, 8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex
+ CHECK_REGS_CONTAIN_REFS(0x1fU, true, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
+ CHECK_REGS_CONTAIN_REFS(0x21U, true, 8, 2, 1, 0); // v8: this, v2: y, v1: x, v0: ex
+ CHECK_REGS_CONTAIN_REFS(0x27U, true, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x29U, true, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x2cU, true, 8, 4, 2, 1); // v8: this, v4: ex, v2: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x2fU, true, 8, 4, 3, 2, 1); // v8: this, v4: ex, v3: y, v2: y, v1: x
+ CHECK_REGS_CONTAIN_REFS(0x32U, true, 8, 3, 2, 1, 0); // v8: this, v3: y, v2: y, v1: x, v0: ex
}
return true;
diff --git a/test/004-SignalTest/signaltest.cc b/test/004-SignalTest/signaltest.cc
index a6d9b668cc..31371f6d22 100644
--- a/test/004-SignalTest/signaltest.cc
+++ b/test/004-SignalTest/signaltest.cc
@@ -14,14 +14,14 @@
* limitations under the License.
*/
+#include <jni.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/ucontext.h>
#include <unistd.h>
-#include "jni.h"
-
-#include <sys/ucontext.h>
+#include "base/macros.h"
static int signal_count;
static const int kMaxSignal = 2;
@@ -47,7 +47,8 @@ static const int kMaxSignal = 2;
#endif
#endif
-static void signalhandler(int sig, siginfo_t* info, void* context) {
+static void signalhandler(int sig ATTRIBUTE_UNUSED, siginfo_t* info ATTRIBUTE_UNUSED,
+ void* context) {
printf("signal caught\n");
++signal_count;
if (signal_count > kMaxSignal) {
diff --git a/test/040-miranda/src/Main.java b/test/040-miranda/src/Main.java
index ff5eba0a17..65f4fb4c4a 100644
--- a/test/040-miranda/src/Main.java
+++ b/test/040-miranda/src/Main.java
@@ -42,8 +42,8 @@ public class Main {
System.out.println("Test getting miranda method via reflection:");
try {
- Class mirandaClass = Class.forName("MirandaAbstract");
- Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface", (Class[]) null);
+ Class<?> mirandaClass = Class.forName("MirandaAbstract");
+ Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface");
System.out.println(" did not expect to find miranda method");
} catch (NoSuchMethodException nsme) {
System.out.println(" caught expected NoSuchMethodException");
diff --git a/test/040-miranda/src/MirandaAbstract.java b/test/040-miranda/src/MirandaAbstract.java
index 309ecca764..c8cfa3465d 100644
--- a/test/040-miranda/src/MirandaAbstract.java
+++ b/test/040-miranda/src/MirandaAbstract.java
@@ -21,6 +21,8 @@ public abstract class MirandaAbstract implements MirandaInterface, MirandaInterf
{
protected MirandaAbstract() { }
+ // These will be miranda methods, as the interfaces define them, but they are not
+ // implemented in this abstract class:
//public abstract boolean inInterface();
//public abstract int inInterface2();
diff --git a/test/040-miranda/src/MirandaClass.java b/test/040-miranda/src/MirandaClass.java
index 0d942f0c98..4160992710 100644
--- a/test/040-miranda/src/MirandaClass.java
+++ b/test/040-miranda/src/MirandaClass.java
@@ -22,17 +22,14 @@ public class MirandaClass extends MirandaAbstract {
public MirandaClass() {}
public boolean inInterface() {
- //System.out.println(" MirandaClass inInterface");
return true;
}
public int inInterface2() {
- //System.out.println(" MirandaClass inInterface2");
return 27;
}
public boolean inAbstract() {
- //System.out.println(" MirandaClass inAbstract");
return false;
}
}
diff --git a/test/040-miranda/src/MirandaClass2.java b/test/040-miranda/src/MirandaClass2.java
index e9bdf2b9ad..143eb371e6 100644
--- a/test/040-miranda/src/MirandaClass2.java
+++ b/test/040-miranda/src/MirandaClass2.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
class MirandaClass2 extends MirandaAbstract {
public boolean inInterface() {
return true;
diff --git a/test/051-thread/expected.txt b/test/051-thread/expected.txt
index 943d1dfac2..54e34af3aa 100644
--- a/test/051-thread/expected.txt
+++ b/test/051-thread/expected.txt
@@ -9,4 +9,6 @@ testSleepZero finished
testSetName starting
testSetName running
testSetName finished
+testThreadPriorities starting
+testThreadPriorities finished
thread test done
diff --git a/test/051-thread/src/Main.java b/test/051-thread/src/Main.java
index 390685d049..b81273ea4e 100644
--- a/test/051-thread/src/Main.java
+++ b/test/051-thread/src/Main.java
@@ -20,12 +20,17 @@ import java.util.ArrayList;
* Test some basic thread stuff.
*/
public class Main {
+ static {
+ System.loadLibrary("arttest");
+ }
+
public static void main(String[] args) throws Exception {
System.out.println("thread test starting");
testThreadCapacity();
testThreadDaemons();
testSleepZero();
testSetName();
+ testThreadPriorities();
System.out.println("thread test done");
}
@@ -133,4 +138,53 @@ public class Main {
}
System.out.print("testSetName finished\n");
}
+
+ private static void testThreadPriorities() throws Exception {
+ System.out.print("testThreadPriorities starting\n");
+
+ PriorityStoringThread t1 = new PriorityStoringThread(false);
+ t1.setPriority(Thread.MAX_PRIORITY);
+ t1.start();
+ t1.join();
+ if (supportsThreadPriorities() && (t1.getNativePriority() != Thread.MAX_PRIORITY)) {
+ System.out.print("thread priority for t1 was " + t1.getNativePriority() +
+ " [expected Thread.MAX_PRIORITY]\n");
+ }
+
+ PriorityStoringThread t2 = new PriorityStoringThread(true);
+ t2.start();
+ t2.join();
+ if (supportsThreadPriorities() && (t2.getNativePriority() != Thread.MAX_PRIORITY)) {
+ System.out.print("thread priority for t2 was " + t2.getNativePriority() +
+ " [expected Thread.MAX_PRIORITY]\n");
+ }
+
+ System.out.print("testThreadPriorities finished\n");
+ }
+
+ private static native int getNativePriority();
+ private static native boolean supportsThreadPriorities();
+
+ static class PriorityStoringThread extends Thread {
+ private final boolean setPriority;
+ private volatile int nativePriority;
+
+ public PriorityStoringThread(boolean setPriority) {
+ this.setPriority = setPriority;
+ this.nativePriority = -1;
+ }
+
+ @Override
+ public void run() {
+ if (setPriority) {
+ setPriority(Thread.MAX_PRIORITY);
+ }
+
+ nativePriority = Main.getNativePriority();
+ }
+
+ public int getNativePriority() {
+ return nativePriority;
+ }
+ }
}
diff --git a/test/051-thread/thread_test.cc b/test/051-thread/thread_test.cc
new file mode 100644
index 0000000000..2b8e675cc6
--- /dev/null
+++ b/test/051-thread/thread_test.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "base/macros.h"
+#include "jni.h"
+#include "thread-inl.h"
+
+namespace art {
+
+extern "C" JNIEXPORT jint JNICALL Java_Main_getNativePriority(JNIEnv* env,
+ jclass clazz ATTRIBUTE_UNUSED) {
+ return ThreadForEnv(env)->GetNativePriority();
+}
+
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_supportsThreadPriorities(
+ JNIEnv* env ATTRIBUTE_UNUSED,
+ jclass clazz ATTRIBUTE_UNUSED) {
+#if defined(HAVE_ANDROID_OS)
+ return JNI_TRUE;
+#else
+ return JNI_FALSE;
+#endif
+}
+
+} // namespace art
diff --git a/test/083-compiler-regressions/expected.txt b/test/083-compiler-regressions/expected.txt
index c43d1f78cb..51bf8471c5 100644
--- a/test/083-compiler-regressions/expected.txt
+++ b/test/083-compiler-regressions/expected.txt
@@ -1,3 +1,4 @@
+b17630605 passes
b17411468 passes
b2296099 passes
b2302318 passes
diff --git a/test/083-compiler-regressions/src/Main.java b/test/083-compiler-regressions/src/Main.java
index 9c772b9fb0..9ad8ea7b1b 100644
--- a/test/083-compiler-regressions/src/Main.java
+++ b/test/083-compiler-regressions/src/Main.java
@@ -30,6 +30,7 @@ public class Main {
}
public static void main(String args[]) throws Exception {
+ b17630605();
b17411468();
b2296099Test();
b2302318Test();
@@ -63,6 +64,18 @@ public class Main {
minDoubleWith3ConstsTest();
}
+ public static void b17630605() {
+ // b/17630605 - failure to properly handle min long immediates.
+ long a1 = 40455547223404749L;
+ long a2 = Long.MIN_VALUE;
+ long answer = a1 + a2;
+ if (answer == -9182916489631371059L) {
+ System.out.println("b17630605 passes");
+ } else {
+ System.out.println("b17630605 fails: " + answer);
+ }
+ }
+
public static void b17411468() {
// b/17411468 - inline Math.round failure.
double d1 = 1.0;
diff --git a/test/100-reflect2/expected.txt b/test/100-reflect2/expected.txt
index 1af4121d49..8fdecccbff 100644
--- a/test/100-reflect2/expected.txt
+++ b/test/100-reflect2/expected.txt
@@ -32,7 +32,7 @@ z (class java.lang.Character)
62 (class java.lang.Long)
14 (class java.lang.Short)
[public java.lang.String(), java.lang.String(int,int,char[]), public java.lang.String(java.lang.String), public java.lang.String(java.lang.StringBuffer), public java.lang.String(java.lang.StringBuilder), public java.lang.String(byte[]), public java.lang.String(byte[],int), public java.lang.String(byte[],int,int), public java.lang.String(byte[],int,int,int), public java.lang.String(byte[],int,int,java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],int,int,java.nio.charset.Charset), public java.lang.String(byte[],java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],java.nio.charset.Charset), public java.lang.String(char[]), public java.lang.String(char[],int,int), public java.lang.String(int[],int,int)]
-[private final char[] java.lang.String.value, private final int java.lang.String.count, private int java.lang.String.hashCode, private final int java.lang.String.offset, private static final char[] java.lang.String.ASCII, public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER, private static final long java.lang.String.serialVersionUID, private static final char java.lang.String.REPLACEMENT_CHAR]
+[private final int java.lang.String.count, private int java.lang.String.hashCode, private final int java.lang.String.offset, private final char[] java.lang.String.value, private static final char[] java.lang.String.ASCII, public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER, private static final char java.lang.String.REPLACEMENT_CHAR, private static final long java.lang.String.serialVersionUID]
[void java.lang.String._getChars(int,int,char[],int), public char java.lang.String.charAt(int), public int java.lang.String.codePointAt(int), public int java.lang.String.codePointBefore(int), public int java.lang.String.codePointCount(int,int), public volatile int java.lang.String.compareTo(java.lang.Object), public native int java.lang.String.compareTo(java.lang.String), public int java.lang.String.compareToIgnoreCase(java.lang.String), public java.lang.String java.lang.String.concat(java.lang.String), public boolean java.lang.String.contains(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.StringBuffer), public boolean java.lang.String.endsWith(java.lang.String), public boolean java.lang.String.equals(java.lang.Object), public boolean java.lang.String.equalsIgnoreCase(java.lang.String), public void java.lang.String.getBytes(int,int,byte[],int), public [B java.lang.String.getBytes(), public [B java.lang.String.getBytes(java.lang.String) throws java.io.UnsupportedEncodingException, public [B java.lang.String.getBytes(java.nio.charset.Charset), public void java.lang.String.getChars(int,int,char[],int), public int java.lang.String.hashCode(), public int java.lang.String.indexOf(int), public int java.lang.String.indexOf(int,int), public int java.lang.String.indexOf(java.lang.String), public int java.lang.String.indexOf(java.lang.String,int), public native java.lang.String java.lang.String.intern(), public boolean java.lang.String.isEmpty(), public int java.lang.String.lastIndexOf(int), public int java.lang.String.lastIndexOf(int,int), public int java.lang.String.lastIndexOf(java.lang.String), public int java.lang.String.lastIndexOf(java.lang.String,int), public int java.lang.String.length(), public boolean java.lang.String.matches(java.lang.String), public int java.lang.String.offsetByCodePoints(int,int), public boolean java.lang.String.regionMatches(int,java.lang.String,int,int), public boolean java.lang.String.regionMatches(boolean,int,java.lang.String,int,int), public java.lang.String java.lang.String.replace(char,char), public java.lang.String java.lang.String.replace(java.lang.CharSequence,java.lang.CharSequence), public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String), public java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String,int), public boolean java.lang.String.startsWith(java.lang.String), public boolean java.lang.String.startsWith(java.lang.String,int), public java.lang.CharSequence java.lang.String.subSequence(int,int), public java.lang.String java.lang.String.substring(int), public java.lang.String java.lang.String.substring(int,int), public [C java.lang.String.toCharArray(), public java.lang.String java.lang.String.toLowerCase(), public java.lang.String java.lang.String.toLowerCase(java.util.Locale), public java.lang.String java.lang.String.toString(), public java.lang.String java.lang.String.toUpperCase(), public java.lang.String java.lang.String.toUpperCase(java.util.Locale), public java.lang.String java.lang.String.trim(), public static java.lang.String java.lang.String.copyValueOf(char[]), public static java.lang.String java.lang.String.copyValueOf(char[],int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.failedBoundsCheck(int,int,int), private native int java.lang.String.fastIndexOf(int,int), private char java.lang.String.foldCase(char), public static transient java.lang.String java.lang.String.format(java.lang.String,java.lang.Object[]), public static transient java.lang.String java.lang.String.format(java.util.Locale,java.lang.String,java.lang.Object[]), private java.lang.StringIndexOutOfBoundsException java.lang.String.indexAndLength(int), private static int java.lang.String.indexOf(java.lang.String,java.lang.String,int,int,char), private int java.lang.String.indexOfSupplementary(int,int), private int java.lang.String.lastIndexOfSupplementary(int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.startEndAndLength(int,int), public static java.lang.String java.lang.String.valueOf(char), public static java.lang.String java.lang.String.valueOf(double), public static java.lang.String java.lang.String.valueOf(float), public static java.lang.String java.lang.String.valueOf(int), public static java.lang.String java.lang.String.valueOf(long), public static java.lang.String java.lang.String.valueOf(java.lang.Object), public static java.lang.String java.lang.String.valueOf(boolean), public static java.lang.String java.lang.String.valueOf(char[]), public static java.lang.String java.lang.String.valueOf(char[],int,int)]
[]
[interface java.io.Serializable, interface java.lang.Comparable, interface java.lang.CharSequence]
diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc
index 23145e3216..6bcc1f5413 100644
--- a/test/115-native-bridge/nativebridge.cc
+++ b/test/115-native-bridge/nativebridge.cc
@@ -18,13 +18,14 @@
#include <algorithm>
#include <dlfcn.h>
+#include <jni.h>
#include <vector>
-#include "jni.h"
#include "stdio.h"
#include "unistd.h"
#include "sys/stat.h"
+#include "base/macros.h"
#include "nativebridge/native_bridge.h"
struct NativeBridgeMethod {
@@ -209,7 +210,8 @@ static NativeBridgeMethod* find_native_bridge_method(const char *name) {
// NativeBridgeCallbacks implementations
extern "C" bool native_bridge_initialize(const android::NativeBridgeRuntimeCallbacks* art_cbs,
- const char* app_code_cache_dir, const char* isa) {
+ const char* app_code_cache_dir,
+ const char* isa ATTRIBUTE_UNUSED) {
struct stat st;
if ((app_code_cache_dir != nullptr)
&& (stat(app_code_cache_dir, &st) == 0)
@@ -248,7 +250,7 @@ extern "C" void* native_bridge_loadLibrary(const char* libpath, int flag) {
}
extern "C" void* native_bridge_getTrampoline(void* handle, const char* name, const char* shorty,
- uint32_t len) {
+ uint32_t len ATTRIBUTE_UNUSED) {
printf("Getting trampoline for %s with shorty %s.\n", name, shorty);
// The name here is actually the JNI name, so we can directly do the lookup.
diff --git a/test/116-nodex2oat/nodex2oat.cc b/test/116-nodex2oat/nodex2oat.cc
index 04cac45f8e..564d58d251 100644
--- a/test/116-nodex2oat/nodex2oat.cc
+++ b/test/116-nodex2oat/nodex2oat.cc
@@ -38,7 +38,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_hasOat(JNIEnv*, jclass cls) {
return NoDex2OatTest::hasOat(cls);
}
-extern "C" JNIEXPORT jboolean JNICALL Java_Main_isDex2OatEnabled(JNIEnv*, jclass cls) {
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_isDex2OatEnabled(JNIEnv*, jclass) {
return Runtime::Current()->IsDex2OatEnabled();
}
diff --git a/test/117-nopatchoat/expected.txt b/test/117-nopatchoat/expected.txt
index a1293aed67..5cc02d1662 100644
--- a/test/117-nopatchoat/expected.txt
+++ b/test/117-nopatchoat/expected.txt
@@ -1,9 +1,9 @@
Run without dex2oat/patchoat
-dex2oat & patchoat are disabled, has oat is true, has executable oat is false.
+dex2oat & patchoat are disabled, has oat is true, has executable oat is expected.
This is a function call
Run with dexoat/patchoat
-dex2oat & patchoat are enabled, has oat is true, has executable oat is true.
+dex2oat & patchoat are enabled, has oat is true, has executable oat is expected.
This is a function call
Run default
-dex2oat & patchoat are enabled, has oat is true, has executable oat is true.
+dex2oat & patchoat are enabled, has oat is true, has executable oat is expected.
This is a function call
diff --git a/test/117-nopatchoat/nopatchoat.cc b/test/117-nopatchoat/nopatchoat.cc
index 5994653dc9..da276f2b52 100644
--- a/test/117-nopatchoat/nopatchoat.cc
+++ b/test/117-nopatchoat/nopatchoat.cc
@@ -24,18 +24,41 @@ namespace art {
class NoPatchoatTest {
public:
- static bool hasExecutableOat(jclass cls) {
+ static const OatFile::OatDexFile* getOatDexFile(jclass cls) {
ScopedObjectAccess soa(Thread::Current());
mirror::Class* klass = soa.Decode<mirror::Class*>(cls);
const DexFile& dex_file = klass->GetDexFile();
+
const OatFile::OatDexFile* oat_dex_file =
Runtime::Current()->GetClassLinker()->FindOpenedOatDexFileForDexFile(dex_file);
+
+ return oat_dex_file;
+ }
+
+ static bool hasExecutableOat(jclass cls) {
+ const OatFile::OatDexFile* oat_dex_file = getOatDexFile(cls);
+
return oat_dex_file != nullptr && oat_dex_file->GetOatFile()->IsExecutable();
}
+
+ static bool isPic(jclass cls) {
+ const OatFile::OatDexFile* oat_dex_file = getOatDexFile(cls);
+
+ if (oat_dex_file == nullptr) {
+ return false;
+ }
+
+ const OatFile* oat_file = oat_dex_file->GetOatFile();
+ return oat_file->IsPic();
+ }
};
extern "C" JNIEXPORT jboolean JNICALL Java_Main_hasExecutableOat(JNIEnv*, jclass cls) {
return NoPatchoatTest::hasExecutableOat(cls);
}
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_isPic(JNIEnv*, jclass cls) {
+ return NoPatchoatTest::isPic(cls);
+}
+
} // namespace art
diff --git a/test/117-nopatchoat/src/Main.java b/test/117-nopatchoat/src/Main.java
index f3f91ce1a5..7bc9dbb947 100644
--- a/test/117-nopatchoat/src/Main.java
+++ b/test/117-nopatchoat/src/Main.java
@@ -16,9 +16,14 @@
public class Main {
public static void main(String[] args) {
+ boolean executable_correct = (isPic() ?
+ hasExecutableOat() == true :
+ hasExecutableOat() == isDex2OatEnabled());
+
System.out.println(
"dex2oat & patchoat are " + ((isDex2OatEnabled()) ? "enabled" : "disabled") +
- ", has oat is " + hasOat() + ", has executable oat is " + hasExecutableOat() + ".");
+ ", has oat is " + hasOat() + ", has executable oat is " + (
+ executable_correct ? "expected" : "not expected") + ".");
if (!hasOat() && isDex2OatEnabled()) {
throw new Error("Application with dex2oat enabled runs without an oat file");
@@ -42,6 +47,8 @@ public class Main {
private native static boolean isDex2OatEnabled();
+ private native static boolean isPic();
+
private native static boolean hasOat();
private native static boolean hasExecutableOat();
diff --git a/test/118-noimage-dex2oat/noimage-dex2oat.cc b/test/118-noimage-dex2oat/noimage-dex2oat.cc
index 7340d9e7f7..c49a13e8f4 100644
--- a/test/118-noimage-dex2oat/noimage-dex2oat.cc
+++ b/test/118-noimage-dex2oat/noimage-dex2oat.cc
@@ -34,11 +34,11 @@ class NoDex2OatTest {
}
};
-extern "C" JNIEXPORT jboolean JNICALL Java_Main_hasImage(JNIEnv*, jclass cls) {
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_hasImage(JNIEnv*, jclass) {
return Runtime::Current()->GetHeap()->HasImageSpace();
}
-extern "C" JNIEXPORT jboolean JNICALL Java_Main_isImageDex2OatEnabled(JNIEnv*, jclass cls) {
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_isImageDex2OatEnabled(JNIEnv*, jclass) {
return Runtime::Current()->IsImageDex2OatEnabled();
}
diff --git a/test/126-miranda-multidex/build b/test/126-miranda-multidex/build
new file mode 100644
index 0000000000..4c30f3f721
--- /dev/null
+++ b/test/126-miranda-multidex/build
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Stop if something fails.
+set -e
+
+mkdir classes
+
+# All except Main
+${JAVAC} -d classes `find src -name '*.java'`
+rm classes/MirandaInterface.class
+${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes
+
+# Only Main
+${JAVAC} -d classes `find src -name '*.java'`
+rm classes/Main.class classes/MirandaAbstract.class classes/MirandaClass*.class classes/MirandaInterface2*.class
+${DX} -JXmx256m --debug --dex --dump-to=classes2.lst --output=classes2.dex classes
+
+zip $TEST_NAME.jar classes.dex classes2.dex
diff --git a/test/126-miranda-multidex/expected.txt b/test/126-miranda-multidex/expected.txt
new file mode 100644
index 0000000000..dbe37173a5
--- /dev/null
+++ b/test/126-miranda-multidex/expected.txt
@@ -0,0 +1,32 @@
+MirandaClass:
+ inInterface: true
+ inInterface2: 27
+ inAbstract: false
+MirandaAbstract / MirandaClass:
+ inInterface: true
+ inInterface2: 27
+ inAbstract: false
+true 27
+MirandaAbstract / MirandaClass2:
+ inInterface: true
+ inInterface2: 28
+ inAbstract: true
+true 28
+Test getting miranda method via reflection:
+ caught expected NoSuchMethodException
+MirandaClass:
+ inInterface: true
+ inInterface2: 27
+ inAbstract: false
+MirandaAbstract / MirandaClass:
+ inInterface: true
+ inInterface2: 27
+ inAbstract: false
+true 27
+MirandaAbstract / MirandaClass2:
+ inInterface: true
+ inInterface2: 28
+ inAbstract: true
+true 28
+Test getting miranda method via reflection:
+ caught expected NoSuchMethodException
diff --git a/test/126-miranda-multidex/info.txt b/test/126-miranda-multidex/info.txt
new file mode 100644
index 0000000000..ac50e2e8a4
--- /dev/null
+++ b/test/126-miranda-multidex/info.txt
@@ -0,0 +1,2 @@
+This test ensures that cross-dex-file Miranda methods are correctly resolved.
+See b/18193682 for details.
diff --git a/test/126-miranda-multidex/run b/test/126-miranda-multidex/run
new file mode 100755
index 0000000000..23c9935c1c
--- /dev/null
+++ b/test/126-miranda-multidex/run
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+${RUN} $@
+
+# The problem was first exposed in a no-verify setting, as that changes the resolution path
+# taken. Make sure we also test in that environment.
+${RUN} --no-verify ${@}
diff --git a/test/126-miranda-multidex/src/Main.java b/test/126-miranda-multidex/src/Main.java
new file mode 100644
index 0000000000..86243781ae
--- /dev/null
+++ b/test/126-miranda-multidex/src/Main.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Method;
+
+/**
+ * Miranda testing.
+ */
+public class Main {
+ public static void main(String[] args) {
+ MirandaClass mir = new MirandaClass();
+ System.out.println("MirandaClass:");
+ System.out.println(" inInterface: " + mir.inInterface());
+ System.out.println(" inInterface2: " + mir.inInterface2());
+ System.out.println(" inAbstract: " + mir.inAbstract());
+
+ /* try again through abstract class; results should be identical */
+ MirandaAbstract mira = mir;
+ System.out.println("MirandaAbstract / MirandaClass:");
+ System.out.println(" inInterface: " + mira.inInterface());
+ System.out.println(" inInterface2: " + mira.inInterface2());
+ System.out.println(" inAbstract: " + mira.inAbstract());
+ mira.callMiranda();
+
+ MirandaAbstract mira2 = new MirandaClass2();
+ System.out.println("MirandaAbstract / MirandaClass2:");
+ System.out.println(" inInterface: " + mira2.inInterface());
+ System.out.println(" inInterface2: " + mira2.inInterface2());
+ System.out.println(" inAbstract: " + mira2.inAbstract());
+ mira2.callMiranda();
+
+ System.out.println("Test getting miranda method via reflection:");
+ try {
+ Class<?> mirandaClass = Class.forName("MirandaAbstract");
+ Method mirandaMethod = mirandaClass.getDeclaredMethod("inInterface");
+ System.out.println(" did not expect to find miranda method");
+ } catch (NoSuchMethodException nsme) {
+ System.out.println(" caught expected NoSuchMethodException");
+ } catch (Exception e) {
+ System.out.println(" caught unexpected exception " + e);
+ }
+ }
+}
diff --git a/test/126-miranda-multidex/src/MirandaAbstract.java b/test/126-miranda-multidex/src/MirandaAbstract.java
new file mode 100644
index 0000000000..c09a61f3c6
--- /dev/null
+++ b/test/126-miranda-multidex/src/MirandaAbstract.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Miranda testing.
+ */
+public abstract class MirandaAbstract implements MirandaInterface, MirandaInterface2
+{
+ protected MirandaAbstract() { }
+
+ // These will be miranda methods, as the interfaces define them, but they are not
+ // implemented in this abstract class:
+ //public abstract boolean inInterface();
+ //public abstract int inInterface2();
+
+ public boolean inAbstract() {
+ return true;
+ }
+
+ public void callMiranda() {
+ System.out.println(inInterface() + " " + inInterface2());
+ }
+}
diff --git a/test/126-miranda-multidex/src/MirandaClass.java b/test/126-miranda-multidex/src/MirandaClass.java
new file mode 100644
index 0000000000..7bb37e738e
--- /dev/null
+++ b/test/126-miranda-multidex/src/MirandaClass.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Miranda testing.
+ */
+public class MirandaClass extends MirandaAbstract {
+
+ public MirandaClass() {}
+
+ public boolean inInterface() {
+ return true;
+ }
+
+ public int inInterface2() {
+ return 27;
+ }
+
+ public boolean inAbstract() {
+ return false;
+ }
+
+ // Better not hit any of these...
+ public void inInterfaceDummy1() {
+ System.out.println("inInterfaceDummy1");
+ }
+ public void inInterfaceDummy2() {
+ System.out.println("inInterfaceDummy2");
+ }
+ public void inInterfaceDummy3() {
+ System.out.println("inInterfaceDummy3");
+ }
+ public void inInterfaceDummy4() {
+ System.out.println("inInterfaceDummy4");
+ }
+ public void inInterfaceDummy5() {
+ System.out.println("inInterfaceDummy5");
+ }
+}
diff --git a/test/126-miranda-multidex/src/MirandaClass2.java b/test/126-miranda-multidex/src/MirandaClass2.java
new file mode 100644
index 0000000000..797ead23a5
--- /dev/null
+++ b/test/126-miranda-multidex/src/MirandaClass2.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class MirandaClass2 extends MirandaAbstract {
+ public boolean inInterface() {
+ return true;
+ }
+
+ public int inInterface2() {
+ return 28;
+ }
+
+ // Better not hit any of these...
+ public void inInterfaceDummy1() {
+ System.out.println("inInterfaceDummy1");
+ }
+ public void inInterfaceDummy2() {
+ System.out.println("inInterfaceDummy2");
+ }
+ public void inInterfaceDummy3() {
+ System.out.println("inInterfaceDummy3");
+ }
+ public void inInterfaceDummy4() {
+ System.out.println("inInterfaceDummy4");
+ }
+ public void inInterfaceDummy5() {
+ System.out.println("inInterfaceDummy5");
+ }
+}
diff --git a/test/126-miranda-multidex/src/MirandaInterface.java b/test/126-miranda-multidex/src/MirandaInterface.java
new file mode 100644
index 0000000000..df12fcc475
--- /dev/null
+++ b/test/126-miranda-multidex/src/MirandaInterface.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Miranda testing.
+ */
+public interface MirandaInterface {
+
+ public boolean inInterface();
+
+ // A couple of dummy methods to fill the method table.
+ public void inInterfaceDummy1();
+ public void inInterfaceDummy2();
+ public void inInterfaceDummy3();
+ public void inInterfaceDummy4();
+ public void inInterfaceDummy5();
+
+}
diff --git a/test/126-miranda-multidex/src/MirandaInterface2.java b/test/126-miranda-multidex/src/MirandaInterface2.java
new file mode 100644
index 0000000000..7c93fd0634
--- /dev/null
+++ b/test/126-miranda-multidex/src/MirandaInterface2.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Miranda testing.
+ */
+public interface MirandaInterface2 {
+
+ public boolean inInterface();
+
+ public int inInterface2();
+
+}
diff --git a/test/127-secondarydex/build b/test/127-secondarydex/build
new file mode 100755
index 0000000000..712774f7ef
--- /dev/null
+++ b/test/127-secondarydex/build
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Stop if something fails.
+set -e
+
+mkdir classes
+${JAVAC} -d classes `find src -name '*.java'`
+
+mkdir classes-ex
+mv classes/Super.class classes-ex
+
+if [ ${NEED_DEX} = "true" ]; then
+ ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes
+ zip $TEST_NAME.jar classes.dex
+ ${DX} -JXmx256m --debug --dex --dump-to=classes-ex.lst --output=classes.dex --dump-width=1000 classes-ex
+ zip ${TEST_NAME}-ex.jar classes.dex
+fi
diff --git a/test/127-secondarydex/expected.txt b/test/127-secondarydex/expected.txt
new file mode 100644
index 0000000000..29a1411ad3
--- /dev/null
+++ b/test/127-secondarydex/expected.txt
@@ -0,0 +1,3 @@
+testSlowPathDirectInvoke
+Test
+Got null pointer exception
diff --git a/test/127-secondarydex/info.txt b/test/127-secondarydex/info.txt
new file mode 100644
index 0000000000..0479d1a784
--- /dev/null
+++ b/test/127-secondarydex/info.txt
@@ -0,0 +1,3 @@
+Test features with a secondary dex file.
+
+- Regression test to ensure slow path of direct invoke does null check.
diff --git a/test/127-secondarydex/run b/test/127-secondarydex/run
new file mode 100755
index 0000000000..d8c3c798bf
--- /dev/null
+++ b/test/127-secondarydex/run
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Use secondary switch to add secondary dex file to class path.
+exec ${RUN} "${@}" --secondary
diff --git a/test/127-secondarydex/src/Main.java b/test/127-secondarydex/src/Main.java
new file mode 100644
index 0000000000..c921c5b0c8
--- /dev/null
+++ b/test/127-secondarydex/src/Main.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+/**
+ * Secondary dex file test.
+ */
+public class Main {
+ public static void main(String[] args) {
+ testSlowPathDirectInvoke();
+ }
+
+ public static void testSlowPathDirectInvoke() {
+ System.out.println("testSlowPathDirectInvoke");
+ try {
+ Test t1 = new Test();
+ Test t2 = new Test();
+ Test t3 = null;
+ t1.test(t2);
+ t1.test(t3);
+ } catch (NullPointerException npe) {
+ System.out.println("Got null pointer exception");
+ } catch (Exception e) {
+ System.out.println("Got unexpected exception " + e);
+ }
+ }
+}
diff --git a/test/127-secondarydex/src/Super.java b/test/127-secondarydex/src/Super.java
new file mode 100644
index 0000000000..7608d4a7c8
--- /dev/null
+++ b/test/127-secondarydex/src/Super.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Super {
+ private void print() {
+ System.out.println("Super");
+ }
+}
diff --git a/test/127-secondarydex/src/Test.java b/test/127-secondarydex/src/Test.java
new file mode 100644
index 0000000000..82cb901374
--- /dev/null
+++ b/test/127-secondarydex/src/Test.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Test extends Super {
+ public void test(Test t) {
+ t.print();
+ }
+
+ private void print() {
+ System.out.println("Test");
+ }
+}
diff --git a/test/128-reg-spilling-on-implicit-nullcheck/expected.txt b/test/128-reg-spilling-on-implicit-nullcheck/expected.txt
new file mode 100644
index 0000000000..9bdf658823
--- /dev/null
+++ b/test/128-reg-spilling-on-implicit-nullcheck/expected.txt
@@ -0,0 +1 @@
+t7q = 2
diff --git a/test/128-reg-spilling-on-implicit-nullcheck/info.txt b/test/128-reg-spilling-on-implicit-nullcheck/info.txt
new file mode 100644
index 0000000000..18b2112268
--- /dev/null
+++ b/test/128-reg-spilling-on-implicit-nullcheck/info.txt
@@ -0,0 +1 @@
+This is a compiler reggression test for missing reg spilling on implicit nullcheck.
diff --git a/test/128-reg-spilling-on-implicit-nullcheck/src/Main.java b/test/128-reg-spilling-on-implicit-nullcheck/src/Main.java
new file mode 100644
index 0000000000..48276bfd9f
--- /dev/null
+++ b/test/128-reg-spilling-on-implicit-nullcheck/src/Main.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+
+ public static void main(String[] args) {
+ int t7q = 0;
+ long q = 1L;
+
+ try {
+ for (int i = 1; i < 8; i++) {
+ t7q = (--t7q);
+ TestClass f = null;
+ t7q = f.field;
+ }
+ }
+ catch (NullPointerException wpw) {
+ q++;
+ }
+ finally {
+ t7q += (int)(1 - ((q - q) - 2));
+ }
+
+ System.out.println("t7q = " + t7q);
+ }
+}
+
+class TestClass {
+ public int field;
+ public void meth() {field = 1;}
+}
diff --git a/test/401-optimizing-compiler/src/Main.java b/test/401-optimizing-compiler/src/Main.java
index 07c407b565..7c3fd25ea7 100644
--- a/test/401-optimizing-compiler/src/Main.java
+++ b/test/401-optimizing-compiler/src/Main.java
@@ -94,6 +94,14 @@ public class Main {
exception = e;
}
+ // Test that we do NPE checks on array length.
+ exception = null;
+ try {
+ $opt$ArrayLengthOfNull(null);
+ } catch (NullPointerException e) {
+ exception = e;
+ }
+
if (exception == null) {
throw new Error("Missing NullPointerException");
}
@@ -218,5 +226,9 @@ public class Main {
return 42;
}
+ public static int $opt$ArrayLengthOfNull(int[] array) {
+ return array.length;
+ }
+
Object o;
}
diff --git a/test/406-fields/src/Main.java b/test/406-fields/src/Main.java
index 3e94e42945..768a78472c 100644
--- a/test/406-fields/src/Main.java
+++ b/test/406-fields/src/Main.java
@@ -30,6 +30,8 @@ public class Main extends TestCase {
assertEquals(0, fields.iI);
assertEquals(0, fields.iJ);
assertEquals(0, fields.iS);
+ assertEquals(0.0f, fields.iF);
+ assertEquals(0.0, fields.iD);
assertNull(fields.iObject);
long longValue = -1122198787987987987L;
@@ -40,6 +42,8 @@ public class Main extends TestCase {
fields.iJ = longValue;
fields.iS = 68;
fields.iObject = fields;
+ fields.iF = 2.3f;
+ fields.iD = 5.3;
assertEquals(true, fields.iZ);
assertEquals(-2, fields.iB);
@@ -48,6 +52,8 @@ public class Main extends TestCase {
assertEquals(longValue, fields.iJ);
assertEquals(68, fields.iS);
assertEquals(fields, fields.iObject);
+ assertEquals(2.3f, fields.iF);
+ assertEquals(5.3, fields.iD);
}
static class AllFields {
diff --git a/test/411-optimizing-arith/src/Main.java b/test/411-optimizing-arith/src/Main.java
index a22c516ff4..3a5d7c05c9 100644
--- a/test/411-optimizing-arith/src/Main.java
+++ b/test/411-optimizing-arith/src/Main.java
@@ -101,7 +101,7 @@ public class Main {
expectEquals(0L, $opt$Mul(3L, 0L));
expectEquals(-3L, $opt$Mul(1L, -3L));
expectEquals(36L, $opt$Mul(-12L, -3L));
- expectEquals(33L, $opt$Mul(1L, 3L) * 11F);
+ expectEquals(33L, $opt$Mul(1L, 3L) * 11L);
expectEquals(240518168583L, $opt$Mul(34359738369L, 7L)); // (2^35 + 1) * 7
}
diff --git a/test/414-static-fields/src/Main.java b/test/414-static-fields/src/Main.java
index 9c5cf133a0..3403772629 100644
--- a/test/414-static-fields/src/Main.java
+++ b/test/414-static-fields/src/Main.java
@@ -59,6 +59,8 @@ public class Main extends TestCase {
assertEquals(0, sI);
assertEquals(0, sJ);
assertEquals(0, sS);
+ assertEquals(0.0f, sF);
+ assertEquals(0.0, sD);
assertNull(sObject);
long longValue = -1122198787987987987L;
@@ -70,6 +72,8 @@ public class Main extends TestCase {
sJ = longValue;
sS = 68;
sObject = o;
+ sF = 2.3f;
+ sD = 5.3;
assertEquals(true, sZ);
assertEquals(-2, sB);
@@ -78,6 +82,8 @@ public class Main extends TestCase {
assertEquals(longValue, sJ);
assertEquals(68, sS);
assertEquals(o, sObject);
+ assertEquals(2.3f, sF);
+ assertEquals(5.3, sD);
}
static boolean sZ;
diff --git a/test/415-optimizing-arith-neg/src/Main.java b/test/415-optimizing-arith-neg/src/Main.java
index b21b998235..d9f8bcf0c2 100644
--- a/test/415-optimizing-arith-neg/src/Main.java
+++ b/test/415-optimizing-arith-neg/src/Main.java
@@ -18,34 +18,61 @@
// it does compile the method.
public class Main {
- public static void expectEquals(int expected, int result) {
+ public static void assertEquals(int expected, int result) {
if (expected != result) {
throw new Error("Expected: " + expected + ", found: " + result);
}
}
- public static void expectEquals(long expected, long result) {
+ public static void assertEquals(long expected, long result) {
if (expected != result) {
throw new Error("Expected: " + expected + ", found: " + result);
}
}
+ public static void assertEquals(float expected, float result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertEquals(double expected, double result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertIsNaN(float result) {
+ if (!Float.isNaN(result)) {
+ throw new Error("Expected NaN: " + result);
+ }
+ }
+
+ public static void assertIsNaN(double result) {
+ if (!Double.isNaN(result)) {
+ throw new Error("Expected NaN: " + result);
+ }
+ }
+
public static void main(String[] args) {
negInt();
$opt$InplaceNegOneInt(1);
negLong();
$opt$InplaceNegOneLong(1L);
+
+ negFloat();
+ negDouble();
}
private static void negInt() {
- expectEquals(-1, $opt$NegInt(1));
- expectEquals(1, $opt$NegInt(-1));
- expectEquals(0, $opt$NegInt(0));
- expectEquals(51, $opt$NegInt(-51));
- expectEquals(-51, $opt$NegInt(51));
- expectEquals(2147483647, $opt$NegInt(-2147483647)); // (2^31 - 1)
- expectEquals(-2147483647, $opt$NegInt(2147483647)); // -(2^31 - 1)
+ assertEquals(-1, $opt$NegInt(1));
+ assertEquals(1, $opt$NegInt(-1));
+ assertEquals(0, $opt$NegInt(0));
+ assertEquals(51, $opt$NegInt(-51));
+ assertEquals(-51, $opt$NegInt(51));
+ assertEquals(2147483647, $opt$NegInt(-2147483647)); // -(2^31 - 1)
+ assertEquals(-2147483647, $opt$NegInt(2147483647)); // 2^31 - 1
// From the Java 7 SE Edition specification:
// http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.15.4
//
@@ -56,36 +83,84 @@ public class Main {
// int or long results in that same maximum negative number.
// Overflow occurs in this case, but no exception is thrown.
// For all integer values x, -x equals (~x)+1.''
- expectEquals(-2147483648, $opt$NegInt(-2147483648)); // -(2^31)
+ assertEquals(-2147483648, $opt$NegInt(-2147483648)); // -(2^31)
}
private static void $opt$InplaceNegOneInt(int a) {
a = -a;
- expectEquals(-1, a);
+ assertEquals(-1, a);
}
private static void negLong() {
- expectEquals(-1L, $opt$NegLong(1L));
- expectEquals(1L, $opt$NegLong(-1L));
- expectEquals(0L, $opt$NegLong(0L));
- expectEquals(51L, $opt$NegLong(-51L));
- expectEquals(-51L, $opt$NegLong(51L));
-
- expectEquals(2147483647L, $opt$NegLong(-2147483647L)); // (2^31 - 1)
- expectEquals(-2147483647L, $opt$NegLong(2147483647L)); // -(2^31 - 1)
- expectEquals(2147483648L, $opt$NegLong(-2147483648L)); // 2^31
- expectEquals(-2147483648L, $opt$NegLong(2147483648L)); // -(2^31)
-
- expectEquals(9223372036854775807L, $opt$NegLong(-9223372036854775807L)); // (2^63 - 1)
- expectEquals(-9223372036854775807L, $opt$NegLong(9223372036854775807L)); // -(2^63 - 1)
+ assertEquals(-1L, $opt$NegLong(1L));
+ assertEquals(1L, $opt$NegLong(-1L));
+ assertEquals(0L, $opt$NegLong(0L));
+ assertEquals(51L, $opt$NegLong(-51L));
+ assertEquals(-51L, $opt$NegLong(51L));
+
+ assertEquals(2147483647L, $opt$NegLong(-2147483647L)); // -(2^31 - 1)
+ assertEquals(-2147483647L, $opt$NegLong(2147483647L)); // (2^31 - 1)
+ assertEquals(2147483648L, $opt$NegLong(-2147483648L)); // -(2^31)
+ assertEquals(-2147483648L, $opt$NegLong(2147483648L)); // 2^31
+
+ assertEquals(9223372036854775807L, $opt$NegLong(-9223372036854775807L)); // -(2^63 - 1)
+ assertEquals(-9223372036854775807L, $opt$NegLong(9223372036854775807L)); // 2^63 - 1
// See remark regarding the negation of the maximum negative
// (long) value in negInt().
- expectEquals(-9223372036854775808L, $opt$NegLong(-9223372036854775808L)); // -(2^63)
+ assertEquals(-9223372036854775808L, $opt$NegLong(-9223372036854775808L)); // -(2^63)
}
private static void $opt$InplaceNegOneLong(long a) {
a = -a;
- expectEquals(-1L, a);
+ assertEquals(-1L, a);
+ }
+
+ private static void negFloat() {
+ assertEquals(-1F, $opt$NegFloat(1F));
+ assertEquals(1F, $opt$NegFloat(-1F));
+ assertEquals(0F, $opt$NegFloat(0F));
+ assertEquals(51F, $opt$NegFloat(-51F));
+ assertEquals(-51F, $opt$NegFloat(51F));
+
+ assertEquals(-0.1F, $opt$NegFloat(0.1F));
+ assertEquals(0.1F, $opt$NegFloat(-0.1F));
+ assertEquals(343597.38362F, $opt$NegFloat(-343597.38362F));
+ assertEquals(-343597.38362F, $opt$NegFloat(343597.38362F));
+
+ assertEquals(-Float.MIN_NORMAL, $opt$NegFloat(Float.MIN_NORMAL));
+ assertEquals(Float.MIN_NORMAL, $opt$NegFloat(-Float.MIN_NORMAL));
+ assertEquals(-Float.MIN_VALUE, $opt$NegFloat(Float.MIN_VALUE));
+ assertEquals(Float.MIN_VALUE, $opt$NegFloat(-Float.MIN_VALUE));
+ assertEquals(-Float.MAX_VALUE, $opt$NegFloat(Float.MAX_VALUE));
+ assertEquals(Float.MAX_VALUE, $opt$NegFloat(-Float.MAX_VALUE));
+
+ assertEquals(Float.NEGATIVE_INFINITY, $opt$NegFloat(Float.POSITIVE_INFINITY));
+ assertEquals(Float.POSITIVE_INFINITY, $opt$NegFloat(Float.NEGATIVE_INFINITY));
+ assertIsNaN($opt$NegFloat(Float.NaN));
+ }
+
+ private static void negDouble() {
+ assertEquals(-1D, $opt$NegDouble(1D));
+ assertEquals(1D, $opt$NegDouble(-1D));
+ assertEquals(0D, $opt$NegDouble(0D));
+ assertEquals(51D, $opt$NegDouble(-51D));
+ assertEquals(-51D, $opt$NegDouble(51D));
+
+ assertEquals(-0.1D, $opt$NegDouble(0.1D));
+ assertEquals(0.1D, $opt$NegDouble(-0.1D));
+ assertEquals(343597.38362D, $opt$NegDouble(-343597.38362D));
+ assertEquals(-343597.38362D, $opt$NegDouble(343597.38362D));
+
+ assertEquals(-Double.MIN_NORMAL, $opt$NegDouble(Double.MIN_NORMAL));
+ assertEquals(Double.MIN_NORMAL, $opt$NegDouble(-Double.MIN_NORMAL));
+ assertEquals(-Double.MIN_VALUE, $opt$NegDouble(Double.MIN_VALUE));
+ assertEquals(Double.MIN_VALUE, $opt$NegDouble(-Double.MIN_VALUE));
+ assertEquals(-Double.MAX_VALUE, $opt$NegDouble(Double.MAX_VALUE));
+ assertEquals(Double.MAX_VALUE, $opt$NegDouble(-Double.MAX_VALUE));
+
+ assertEquals(Double.NEGATIVE_INFINITY, $opt$NegDouble(Double.POSITIVE_INFINITY));
+ assertEquals(Double.POSITIVE_INFINITY, $opt$NegDouble(Double.NEGATIVE_INFINITY));
+ assertIsNaN($opt$NegDouble(Double.NaN));
}
static int $opt$NegInt(int a){
@@ -95,4 +170,12 @@ public class Main {
static long $opt$NegLong(long a){
return -a;
}
+
+ static float $opt$NegFloat(float a){
+ return -a;
+ }
+
+ static double $opt$NegDouble(double a){
+ return -a;
+ }
}
diff --git a/test/416-optimizing-arith-not/src/Main.java b/test/416-optimizing-arith-not/src/Main.java
index 26e206c94d..44c7d3cfb0 100644
--- a/test/416-optimizing-arith-not/src/Main.java
+++ b/test/416-optimizing-arith-not/src/Main.java
@@ -40,10 +40,10 @@ public class Main {
expectEquals(0, smaliNotInt(-1));
expectEquals(-1, smaliNotInt(0));
expectEquals(-2, smaliNotInt(1));
- expectEquals(2147483647, smaliNotInt(-2147483648)); // (2^31) - 1
- expectEquals(2147483646, smaliNotInt(-2147483647)); // (2^31) - 2
- expectEquals(-2147483647, smaliNotInt(2147483646)); // -(2^31) - 1
- expectEquals(-2147483648, smaliNotInt(2147483647)); // -(2^31)
+ expectEquals(2147483647, smaliNotInt(-2147483648)); // -(2^31)
+ expectEquals(2147483646, smaliNotInt(-2147483647)); // -(2^31 - 1)
+ expectEquals(-2147483647, smaliNotInt(2147483646)); // 2^31 - 2
+ expectEquals(-2147483648, smaliNotInt(2147483647)); // 2^31 - 1
}
private static void notLong() throws Exception {
@@ -51,14 +51,14 @@ public class Main {
expectEquals(0L, smaliNotLong(-1L));
expectEquals(-1L, smaliNotLong(0L));
expectEquals(-2L, smaliNotLong(1L));
- expectEquals(2147483647L, smaliNotLong(-2147483648L)); // (2^31) - 1
- expectEquals(2147483646L, smaliNotLong(-2147483647L)); // (2^31) - 2
- expectEquals(-2147483647L, smaliNotLong(2147483646L)); // -(2^31) - 1
- expectEquals(-2147483648L, smaliNotLong(2147483647L)); // -(2^31)
- expectEquals(9223372036854775807L, smaliNotLong(-9223372036854775808L)); // (2^63) - 1
- expectEquals(9223372036854775806L, smaliNotLong(-9223372036854775807L)); // (2^63) - 2
- expectEquals(-9223372036854775807L, smaliNotLong(9223372036854775806L)); // -(2^63) - 1
- expectEquals(-9223372036854775808L, smaliNotLong(9223372036854775807L)); // -(2^63)
+ expectEquals(2147483647L, smaliNotLong(-2147483648L)); // -(2^31)
+ expectEquals(2147483646L, smaliNotLong(-2147483647L)); // -(2^31 - 1)
+ expectEquals(-2147483647L, smaliNotLong(2147483646L)); // 2^31 - 2
+ expectEquals(-2147483648L, smaliNotLong(2147483647L)); // 2^31 - 1
+ expectEquals(9223372036854775807L, smaliNotLong(-9223372036854775808L)); // -(2^63)
+ expectEquals(9223372036854775806L, smaliNotLong(-9223372036854775807L)); // -(2^63 - 1)
+ expectEquals(-9223372036854775807L, smaliNotLong(9223372036854775806L)); // 2^63 - 2
+ expectEquals(-9223372036854775808L, smaliNotLong(9223372036854775807L)); // 2^63 - 1
}
// Wrappers around methods located in file not.smali.
diff --git a/test/417-optimizing-arith-div/src/Main.java b/test/417-optimizing-arith-div/src/Main.java
index 535cafb113..909ceb43d6 100644
--- a/test/417-optimizing-arith-div/src/Main.java
+++ b/test/417-optimizing-arith-div/src/Main.java
@@ -18,6 +18,18 @@
// it does compile the method.
public class Main {
+ public static void expectEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void expectEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
public static void expectEquals(float expected, float result) {
if (expected != result) {
throw new Error("Expected: " + expected + ", found: " + result);
@@ -60,15 +72,95 @@ public class Main {
}
}
+ public static void expectDivisionByZero(int value) {
+ try {
+ $opt$Div(value, 0);
+ throw new Error("Expected RuntimeException when dividing by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ try {
+ $opt$DivZero(value);
+ throw new Error("Expected RuntimeException when dividing by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ }
+
+ public static void expectDivisionByZero(long value) {
+ try {
+ $opt$Div(value, 0L);
+ throw new Error("Expected RuntimeException when dividing by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ try {
+ $opt$DivZero(value);
+ throw new Error("Expected RuntimeException when dividing by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ }
+
public static void main(String[] args) {
div();
}
public static void div() {
+ divInt();
+ divLong();
divFloat();
divDouble();
}
+ private static void divInt() {
+ expectEquals(2, $opt$DivConst(6));
+ expectEquals(2, $opt$Div(6, 3));
+ expectEquals(6, $opt$Div(6, 1));
+ expectEquals(-2, $opt$Div(6, -3));
+ expectEquals(1, $opt$Div(4, 3));
+ expectEquals(-1, $opt$Div(4, -3));
+ expectEquals(5, $opt$Div(23, 4));
+ expectEquals(-5, $opt$Div(-23, 4));
+
+ expectEquals(-Integer.MAX_VALUE, $opt$Div(Integer.MAX_VALUE, -1));
+ expectEquals(Integer.MIN_VALUE, $opt$Div(Integer.MIN_VALUE, -1)); // overflow
+ expectEquals(-1073741824, $opt$Div(Integer.MIN_VALUE, 2));
+
+ expectEquals(0, $opt$Div(0, Integer.MAX_VALUE));
+ expectEquals(0, $opt$Div(0, Integer.MIN_VALUE));
+
+ expectDivisionByZero(0);
+ expectDivisionByZero(1);
+ expectDivisionByZero(Integer.MAX_VALUE);
+ expectDivisionByZero(Integer.MIN_VALUE);
+ }
+
+ private static void divLong() {
+ expectEquals(2L, $opt$DivConst(6L));
+ expectEquals(2L, $opt$Div(6L, 3L));
+ expectEquals(6L, $opt$Div(6L, 1L));
+ expectEquals(-2L, $opt$Div(6L, -3L));
+ expectEquals(1L, $opt$Div(4L, 3L));
+ expectEquals(-1L, $opt$Div(4L, -3L));
+ expectEquals(5L, $opt$Div(23L, 4L));
+ expectEquals(-5L, $opt$Div(-23L, 4L));
+
+ expectEquals(-Integer.MAX_VALUE, $opt$Div(Integer.MAX_VALUE, -1L));
+ expectEquals(2147483648L, $opt$Div(Integer.MIN_VALUE, -1L));
+ expectEquals(-1073741824L, $opt$Div(Integer.MIN_VALUE, 2L));
+
+ expectEquals(-Long.MAX_VALUE, $opt$Div(Long.MAX_VALUE, -1L));
+ expectEquals(Long.MIN_VALUE, $opt$Div(Long.MIN_VALUE, -1L)); // overflow
+
+ expectEquals(11111111111111L, $opt$Div(33333333333333L, 3L));
+ expectEquals(3L, $opt$Div(33333333333333L, 11111111111111L));
+
+ expectEquals(0L, $opt$Div(0L, Long.MAX_VALUE));
+ expectEquals(0L, $opt$Div(0L, Long.MIN_VALUE));
+
+ expectDivisionByZero(0L);
+ expectDivisionByZero(1L);
+ expectDivisionByZero(Long.MAX_VALUE);
+ expectDivisionByZero(Long.MIN_VALUE);
+ }
+
private static void divFloat() {
expectApproxEquals(1.6666666F, $opt$Div(5F, 3F));
expectApproxEquals(0F, $opt$Div(0F, 3F));
@@ -127,6 +219,31 @@ public class Main {
expectEquals(Float.NEGATIVE_INFINITY, $opt$Div(-Float.MAX_VALUE, Float.MIN_VALUE));
}
+ static int $opt$Div(int a, int b) {
+ return a / b;
+ }
+
+ static int $opt$DivZero(int a) {
+ return a / 0;
+ }
+
+ // Division by literals != 0 should not generate checks.
+ static int $opt$DivConst(int a) {
+ return a / 3;
+ }
+
+ static long $opt$DivConst(long a) {
+ return a / 3L;
+ }
+
+ static long $opt$Div(long a, long b) {
+ return a / b;
+ }
+
+ static long $opt$DivZero(long a) {
+ return a / 0L;
+ }
+
static float $opt$Div(float a, float b) {
return a / b;
}
diff --git a/test/418-const-string/expected.txt b/test/418-const-string/expected.txt
new file mode 100644
index 0000000000..8254f875c6
--- /dev/null
+++ b/test/418-const-string/expected.txt
@@ -0,0 +1,2 @@
+Hello World
+Hello World
diff --git a/test/418-const-string/info.txt b/test/418-const-string/info.txt
new file mode 100644
index 0000000000..b7a468fd70
--- /dev/null
+++ b/test/418-const-string/info.txt
@@ -0,0 +1 @@
+Small test case for testing CONST_STRING.
diff --git a/test/418-const-string/src/Main.java b/test/418-const-string/src/Main.java
new file mode 100644
index 0000000000..7c1ffec18c
--- /dev/null
+++ b/test/418-const-string/src/Main.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ // First call: may go in slow path.
+ System.out.println($opt$ReturnHelloWorld());
+ // Second call: no slow path.
+ System.out.println($opt$ReturnHelloWorld());
+ }
+
+ public static String $opt$ReturnHelloWorld() {
+ return "Hello World";
+ }
+}
diff --git a/test/419-long-parameter/expected.txt b/test/419-long-parameter/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/419-long-parameter/expected.txt
diff --git a/test/419-long-parameter/info.txt b/test/419-long-parameter/info.txt
new file mode 100644
index 0000000000..5eac9771a9
--- /dev/null
+++ b/test/419-long-parameter/info.txt
@@ -0,0 +1,3 @@
+Regression test for the long parameter passed both in stack and register
+on 32bits architectures. The move to hard float ABI makes it so that the
+register index does not necessarily match the stack index anymore.
diff --git a/test/419-long-parameter/src/Main.java b/test/419-long-parameter/src/Main.java
new file mode 100644
index 0000000000..808b7f616b
--- /dev/null
+++ b/test/419-long-parameter/src/Main.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ if ($opt$TestCallee(1.0, 2.0, 1L, 2L) != 1L) {
+ throw new Error("Unexpected result");
+ }
+ if ($opt$TestCaller() != 1L) {
+ throw new Error("Unexpected result");
+ }
+ }
+
+ public static long $opt$TestCallee(double a, double b, long c, long d) {
+ return d - c;
+ }
+
+ public static long $opt$TestCaller() {
+ return $opt$TestCallee(1.0, 2.0, 1L, 2L);
+ }
+}
diff --git a/test/420-const-class/expected.txt b/test/420-const-class/expected.txt
new file mode 100644
index 0000000000..3213026619
--- /dev/null
+++ b/test/420-const-class/expected.txt
@@ -0,0 +1,16 @@
+class Main
+class Main
+class Main$Other
+class Main$Other
+class java.lang.System
+class java.lang.System
+Hello from OtherWithClinit
+42
+class Main$OtherWithClinit
+42
+class Main$OtherWithClinit
+class Main$OtherWithClinit2
+Hello from OtherWithClinit2
+43
+class Main$OtherWithClinit2
+43
diff --git a/test/420-const-class/info.txt b/test/420-const-class/info.txt
new file mode 100644
index 0000000000..81cbac7faa
--- /dev/null
+++ b/test/420-const-class/info.txt
@@ -0,0 +1 @@
+Test for the CONST_CLASS opcode.
diff --git a/test/420-const-class/src/Main.java b/test/420-const-class/src/Main.java
new file mode 100644
index 0000000000..44a7436103
--- /dev/null
+++ b/test/420-const-class/src/Main.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ static class Other {
+ }
+
+ static class OtherWithClinit {
+ static int a;
+ static {
+ System.out.println("Hello from OtherWithClinit");
+ a = 42;
+ }
+ }
+
+ static class OtherWithClinit2 {
+ static int a;
+ static {
+ System.out.println("Hello from OtherWithClinit2");
+ a = 43;
+ }
+ }
+
+ public static void main(String[] args) {
+ // Call methods twice in case they have a slow path.
+
+ System.out.println($opt$LoadThisClass());
+ System.out.println($opt$LoadThisClass());
+
+ System.out.println($opt$LoadOtherClass());
+ System.out.println($opt$LoadOtherClass());
+
+ System.out.println($opt$LoadSystemClass());
+ System.out.println($opt$LoadSystemClass());
+
+ $opt$ClinitCheckAndLoad();
+ $opt$ClinitCheckAndLoad();
+
+ $opt$LoadAndClinitCheck();
+ $opt$LoadAndClinitCheck();
+ }
+
+ public static Class $opt$LoadThisClass() {
+ return Main.class;
+ }
+
+ public static Class $opt$LoadOtherClass() {
+ return Other.class;
+ }
+
+ public static Class $opt$LoadSystemClass() {
+ return System.class;
+ }
+
+ public static void $opt$ClinitCheckAndLoad() {
+ System.out.println(OtherWithClinit.a);
+ System.out.println(OtherWithClinit.class);
+ }
+
+ public static void $opt$LoadAndClinitCheck() {
+ System.out.println(OtherWithClinit2.class);
+ System.out.println(OtherWithClinit2.a);
+ }
+}
diff --git a/test/421-exceptions/expected.txt b/test/421-exceptions/expected.txt
new file mode 100644
index 0000000000..94db350a03
--- /dev/null
+++ b/test/421-exceptions/expected.txt
@@ -0,0 +1,20 @@
+1
+3
+4
+1
+4
+1
+4
+1
+4
+Caught class java.lang.RuntimeException
+1
+2
+4
+1
+4
+1
+4
+1
+4
+Caught class java.lang.NullPointerException
diff --git a/test/421-exceptions/info.txt b/test/421-exceptions/info.txt
new file mode 100644
index 0000000000..bdec67e963
--- /dev/null
+++ b/test/421-exceptions/info.txt
@@ -0,0 +1 @@
+Simple test for try/catch/throw.
diff --git a/test/421-exceptions/src/Main.java b/test/421-exceptions/src/Main.java
new file mode 100644
index 0000000000..6bf2377ceb
--- /dev/null
+++ b/test/421-exceptions/src/Main.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void $opt$bar() {
+ try {
+ $opt$foo(1);
+ } catch (NullPointerException e) {
+ $opt$foo(2);
+ } catch (RuntimeException e) {
+ $opt$foo(3);
+ } finally {
+ $opt$foo(4);
+ }
+ }
+
+ static int barState;
+ static int fooState;
+
+ public static void main(String[] args) {
+ fooState = 0;
+ $opt$runTest();
+ fooState = 1;
+ $opt$runTest();
+ }
+
+ public static void $opt$runTest() {
+ barState = 1;
+ $opt$bar();
+ barState = 2;
+ $opt$bar();
+ barState = 3;
+ $opt$bar();
+ barState = 4;
+ try {
+ $opt$bar();
+ } catch (RuntimeException e) {
+ System.out.println("Caught " + e.getClass());
+ }
+ }
+
+ public static void $opt$foo(int value) {
+ System.out.println(value);
+ if (value == barState) {
+ if (fooState == 0) {
+ throw new RuntimeException();
+ } else {
+ throw new NullPointerException();
+ }
+ }
+ }
+}
diff --git a/test/421-large-frame/expected.txt b/test/421-large-frame/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/421-large-frame/expected.txt
diff --git a/test/421-large-frame/info.txt b/test/421-large-frame/info.txt
new file mode 100644
index 0000000000..d71e7eeeb9
--- /dev/null
+++ b/test/421-large-frame/info.txt
@@ -0,0 +1 @@
+Tests for large stack frames.
diff --git a/test/421-large-frame/src/Main.java b/test/421-large-frame/src/Main.java
new file mode 100644
index 0000000000..01b89bab8e
--- /dev/null
+++ b/test/421-large-frame/src/Main.java
@@ -0,0 +1,2034 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Note that $opt$ is a marker for the optimizing compiler to ensure
+// it does compile the method.
+public class Main {
+
+ public static void assertEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void main(String[] args) {
+ // Sum[i = 0..999](i) = 999 * 1000 / 2 = 499500L.
+ assertEquals(499500L, $opt$LargeFrame());
+ }
+
+ static long $opt$LargeFrame() {
+ long l0 = 0L;
+ long l1 = 1L;
+ long l2 = 2L;
+ long l3 = 3L;
+ long l4 = 4L;
+ long l5 = 5L;
+ long l6 = 6L;
+ long l7 = 7L;
+ long l8 = 8L;
+ long l9 = 9L;
+ long l10 = 10L;
+ long l11 = 11L;
+ long l12 = 12L;
+ long l13 = 13L;
+ long l14 = 14L;
+ long l15 = 15L;
+ long l16 = 16L;
+ long l17 = 17L;
+ long l18 = 18L;
+ long l19 = 19L;
+ long l20 = 20L;
+ long l21 = 21L;
+ long l22 = 22L;
+ long l23 = 23L;
+ long l24 = 24L;
+ long l25 = 25L;
+ long l26 = 26L;
+ long l27 = 27L;
+ long l28 = 28L;
+ long l29 = 29L;
+ long l30 = 30L;
+ long l31 = 31L;
+ long l32 = 32L;
+ long l33 = 33L;
+ long l34 = 34L;
+ long l35 = 35L;
+ long l36 = 36L;
+ long l37 = 37L;
+ long l38 = 38L;
+ long l39 = 39L;
+ long l40 = 40L;
+ long l41 = 41L;
+ long l42 = 42L;
+ long l43 = 43L;
+ long l44 = 44L;
+ long l45 = 45L;
+ long l46 = 46L;
+ long l47 = 47L;
+ long l48 = 48L;
+ long l49 = 49L;
+ long l50 = 50L;
+ long l51 = 51L;
+ long l52 = 52L;
+ long l53 = 53L;
+ long l54 = 54L;
+ long l55 = 55L;
+ long l56 = 56L;
+ long l57 = 57L;
+ long l58 = 58L;
+ long l59 = 59L;
+ long l60 = 60L;
+ long l61 = 61L;
+ long l62 = 62L;
+ long l63 = 63L;
+ long l64 = 64L;
+ long l65 = 65L;
+ long l66 = 66L;
+ long l67 = 67L;
+ long l68 = 68L;
+ long l69 = 69L;
+ long l70 = 70L;
+ long l71 = 71L;
+ long l72 = 72L;
+ long l73 = 73L;
+ long l74 = 74L;
+ long l75 = 75L;
+ long l76 = 76L;
+ long l77 = 77L;
+ long l78 = 78L;
+ long l79 = 79L;
+ long l80 = 80L;
+ long l81 = 81L;
+ long l82 = 82L;
+ long l83 = 83L;
+ long l84 = 84L;
+ long l85 = 85L;
+ long l86 = 86L;
+ long l87 = 87L;
+ long l88 = 88L;
+ long l89 = 89L;
+ long l90 = 90L;
+ long l91 = 91L;
+ long l92 = 92L;
+ long l93 = 93L;
+ long l94 = 94L;
+ long l95 = 95L;
+ long l96 = 96L;
+ long l97 = 97L;
+ long l98 = 98L;
+ long l99 = 99L;
+ long l100 = 100L;
+ long l101 = 101L;
+ long l102 = 102L;
+ long l103 = 103L;
+ long l104 = 104L;
+ long l105 = 105L;
+ long l106 = 106L;
+ long l107 = 107L;
+ long l108 = 108L;
+ long l109 = 109L;
+ long l110 = 110L;
+ long l111 = 111L;
+ long l112 = 112L;
+ long l113 = 113L;
+ long l114 = 114L;
+ long l115 = 115L;
+ long l116 = 116L;
+ long l117 = 117L;
+ long l118 = 118L;
+ long l119 = 119L;
+ long l120 = 120L;
+ long l121 = 121L;
+ long l122 = 122L;
+ long l123 = 123L;
+ long l124 = 124L;
+ long l125 = 125L;
+ long l126 = 126L;
+ long l127 = 127L;
+ long l128 = 128L;
+ long l129 = 129L;
+ long l130 = 130L;
+ long l131 = 131L;
+ long l132 = 132L;
+ long l133 = 133L;
+ long l134 = 134L;
+ long l135 = 135L;
+ long l136 = 136L;
+ long l137 = 137L;
+ long l138 = 138L;
+ long l139 = 139L;
+ long l140 = 140L;
+ long l141 = 141L;
+ long l142 = 142L;
+ long l143 = 143L;
+ long l144 = 144L;
+ long l145 = 145L;
+ long l146 = 146L;
+ long l147 = 147L;
+ long l148 = 148L;
+ long l149 = 149L;
+ long l150 = 150L;
+ long l151 = 151L;
+ long l152 = 152L;
+ long l153 = 153L;
+ long l154 = 154L;
+ long l155 = 155L;
+ long l156 = 156L;
+ long l157 = 157L;
+ long l158 = 158L;
+ long l159 = 159L;
+ long l160 = 160L;
+ long l161 = 161L;
+ long l162 = 162L;
+ long l163 = 163L;
+ long l164 = 164L;
+ long l165 = 165L;
+ long l166 = 166L;
+ long l167 = 167L;
+ long l168 = 168L;
+ long l169 = 169L;
+ long l170 = 170L;
+ long l171 = 171L;
+ long l172 = 172L;
+ long l173 = 173L;
+ long l174 = 174L;
+ long l175 = 175L;
+ long l176 = 176L;
+ long l177 = 177L;
+ long l178 = 178L;
+ long l179 = 179L;
+ long l180 = 180L;
+ long l181 = 181L;
+ long l182 = 182L;
+ long l183 = 183L;
+ long l184 = 184L;
+ long l185 = 185L;
+ long l186 = 186L;
+ long l187 = 187L;
+ long l188 = 188L;
+ long l189 = 189L;
+ long l190 = 190L;
+ long l191 = 191L;
+ long l192 = 192L;
+ long l193 = 193L;
+ long l194 = 194L;
+ long l195 = 195L;
+ long l196 = 196L;
+ long l197 = 197L;
+ long l198 = 198L;
+ long l199 = 199L;
+ long l200 = 200L;
+ long l201 = 201L;
+ long l202 = 202L;
+ long l203 = 203L;
+ long l204 = 204L;
+ long l205 = 205L;
+ long l206 = 206L;
+ long l207 = 207L;
+ long l208 = 208L;
+ long l209 = 209L;
+ long l210 = 210L;
+ long l211 = 211L;
+ long l212 = 212L;
+ long l213 = 213L;
+ long l214 = 214L;
+ long l215 = 215L;
+ long l216 = 216L;
+ long l217 = 217L;
+ long l218 = 218L;
+ long l219 = 219L;
+ long l220 = 220L;
+ long l221 = 221L;
+ long l222 = 222L;
+ long l223 = 223L;
+ long l224 = 224L;
+ long l225 = 225L;
+ long l226 = 226L;
+ long l227 = 227L;
+ long l228 = 228L;
+ long l229 = 229L;
+ long l230 = 230L;
+ long l231 = 231L;
+ long l232 = 232L;
+ long l233 = 233L;
+ long l234 = 234L;
+ long l235 = 235L;
+ long l236 = 236L;
+ long l237 = 237L;
+ long l238 = 238L;
+ long l239 = 239L;
+ long l240 = 240L;
+ long l241 = 241L;
+ long l242 = 242L;
+ long l243 = 243L;
+ long l244 = 244L;
+ long l245 = 245L;
+ long l246 = 246L;
+ long l247 = 247L;
+ long l248 = 248L;
+ long l249 = 249L;
+ long l250 = 250L;
+ long l251 = 251L;
+ long l252 = 252L;
+ long l253 = 253L;
+ long l254 = 254L;
+ long l255 = 255L;
+ long l256 = 256L;
+ long l257 = 257L;
+ long l258 = 258L;
+ long l259 = 259L;
+ long l260 = 260L;
+ long l261 = 261L;
+ long l262 = 262L;
+ long l263 = 263L;
+ long l264 = 264L;
+ long l265 = 265L;
+ long l266 = 266L;
+ long l267 = 267L;
+ long l268 = 268L;
+ long l269 = 269L;
+ long l270 = 270L;
+ long l271 = 271L;
+ long l272 = 272L;
+ long l273 = 273L;
+ long l274 = 274L;
+ long l275 = 275L;
+ long l276 = 276L;
+ long l277 = 277L;
+ long l278 = 278L;
+ long l279 = 279L;
+ long l280 = 280L;
+ long l281 = 281L;
+ long l282 = 282L;
+ long l283 = 283L;
+ long l284 = 284L;
+ long l285 = 285L;
+ long l286 = 286L;
+ long l287 = 287L;
+ long l288 = 288L;
+ long l289 = 289L;
+ long l290 = 290L;
+ long l291 = 291L;
+ long l292 = 292L;
+ long l293 = 293L;
+ long l294 = 294L;
+ long l295 = 295L;
+ long l296 = 296L;
+ long l297 = 297L;
+ long l298 = 298L;
+ long l299 = 299L;
+ long l300 = 300L;
+ long l301 = 301L;
+ long l302 = 302L;
+ long l303 = 303L;
+ long l304 = 304L;
+ long l305 = 305L;
+ long l306 = 306L;
+ long l307 = 307L;
+ long l308 = 308L;
+ long l309 = 309L;
+ long l310 = 310L;
+ long l311 = 311L;
+ long l312 = 312L;
+ long l313 = 313L;
+ long l314 = 314L;
+ long l315 = 315L;
+ long l316 = 316L;
+ long l317 = 317L;
+ long l318 = 318L;
+ long l319 = 319L;
+ long l320 = 320L;
+ long l321 = 321L;
+ long l322 = 322L;
+ long l323 = 323L;
+ long l324 = 324L;
+ long l325 = 325L;
+ long l326 = 326L;
+ long l327 = 327L;
+ long l328 = 328L;
+ long l329 = 329L;
+ long l330 = 330L;
+ long l331 = 331L;
+ long l332 = 332L;
+ long l333 = 333L;
+ long l334 = 334L;
+ long l335 = 335L;
+ long l336 = 336L;
+ long l337 = 337L;
+ long l338 = 338L;
+ long l339 = 339L;
+ long l340 = 340L;
+ long l341 = 341L;
+ long l342 = 342L;
+ long l343 = 343L;
+ long l344 = 344L;
+ long l345 = 345L;
+ long l346 = 346L;
+ long l347 = 347L;
+ long l348 = 348L;
+ long l349 = 349L;
+ long l350 = 350L;
+ long l351 = 351L;
+ long l352 = 352L;
+ long l353 = 353L;
+ long l354 = 354L;
+ long l355 = 355L;
+ long l356 = 356L;
+ long l357 = 357L;
+ long l358 = 358L;
+ long l359 = 359L;
+ long l360 = 360L;
+ long l361 = 361L;
+ long l362 = 362L;
+ long l363 = 363L;
+ long l364 = 364L;
+ long l365 = 365L;
+ long l366 = 366L;
+ long l367 = 367L;
+ long l368 = 368L;
+ long l369 = 369L;
+ long l370 = 370L;
+ long l371 = 371L;
+ long l372 = 372L;
+ long l373 = 373L;
+ long l374 = 374L;
+ long l375 = 375L;
+ long l376 = 376L;
+ long l377 = 377L;
+ long l378 = 378L;
+ long l379 = 379L;
+ long l380 = 380L;
+ long l381 = 381L;
+ long l382 = 382L;
+ long l383 = 383L;
+ long l384 = 384L;
+ long l385 = 385L;
+ long l386 = 386L;
+ long l387 = 387L;
+ long l388 = 388L;
+ long l389 = 389L;
+ long l390 = 390L;
+ long l391 = 391L;
+ long l392 = 392L;
+ long l393 = 393L;
+ long l394 = 394L;
+ long l395 = 395L;
+ long l396 = 396L;
+ long l397 = 397L;
+ long l398 = 398L;
+ long l399 = 399L;
+ long l400 = 400L;
+ long l401 = 401L;
+ long l402 = 402L;
+ long l403 = 403L;
+ long l404 = 404L;
+ long l405 = 405L;
+ long l406 = 406L;
+ long l407 = 407L;
+ long l408 = 408L;
+ long l409 = 409L;
+ long l410 = 410L;
+ long l411 = 411L;
+ long l412 = 412L;
+ long l413 = 413L;
+ long l414 = 414L;
+ long l415 = 415L;
+ long l416 = 416L;
+ long l417 = 417L;
+ long l418 = 418L;
+ long l419 = 419L;
+ long l420 = 420L;
+ long l421 = 421L;
+ long l422 = 422L;
+ long l423 = 423L;
+ long l424 = 424L;
+ long l425 = 425L;
+ long l426 = 426L;
+ long l427 = 427L;
+ long l428 = 428L;
+ long l429 = 429L;
+ long l430 = 430L;
+ long l431 = 431L;
+ long l432 = 432L;
+ long l433 = 433L;
+ long l434 = 434L;
+ long l435 = 435L;
+ long l436 = 436L;
+ long l437 = 437L;
+ long l438 = 438L;
+ long l439 = 439L;
+ long l440 = 440L;
+ long l441 = 441L;
+ long l442 = 442L;
+ long l443 = 443L;
+ long l444 = 444L;
+ long l445 = 445L;
+ long l446 = 446L;
+ long l447 = 447L;
+ long l448 = 448L;
+ long l449 = 449L;
+ long l450 = 450L;
+ long l451 = 451L;
+ long l452 = 452L;
+ long l453 = 453L;
+ long l454 = 454L;
+ long l455 = 455L;
+ long l456 = 456L;
+ long l457 = 457L;
+ long l458 = 458L;
+ long l459 = 459L;
+ long l460 = 460L;
+ long l461 = 461L;
+ long l462 = 462L;
+ long l463 = 463L;
+ long l464 = 464L;
+ long l465 = 465L;
+ long l466 = 466L;
+ long l467 = 467L;
+ long l468 = 468L;
+ long l469 = 469L;
+ long l470 = 470L;
+ long l471 = 471L;
+ long l472 = 472L;
+ long l473 = 473L;
+ long l474 = 474L;
+ long l475 = 475L;
+ long l476 = 476L;
+ long l477 = 477L;
+ long l478 = 478L;
+ long l479 = 479L;
+ long l480 = 480L;
+ long l481 = 481L;
+ long l482 = 482L;
+ long l483 = 483L;
+ long l484 = 484L;
+ long l485 = 485L;
+ long l486 = 486L;
+ long l487 = 487L;
+ long l488 = 488L;
+ long l489 = 489L;
+ long l490 = 490L;
+ long l491 = 491L;
+ long l492 = 492L;
+ long l493 = 493L;
+ long l494 = 494L;
+ long l495 = 495L;
+ long l496 = 496L;
+ long l497 = 497L;
+ long l498 = 498L;
+ long l499 = 499L;
+ long l500 = 500L;
+ long l501 = 501L;
+ long l502 = 502L;
+ long l503 = 503L;
+ long l504 = 504L;
+ long l505 = 505L;
+ long l506 = 506L;
+ long l507 = 507L;
+ long l508 = 508L;
+ long l509 = 509L;
+ long l510 = 510L;
+ long l511 = 511L;
+ long l512 = 512L;
+ long l513 = 513L;
+ long l514 = 514L;
+ long l515 = 515L;
+ long l516 = 516L;
+ long l517 = 517L;
+ long l518 = 518L;
+ long l519 = 519L;
+ long l520 = 520L;
+ long l521 = 521L;
+ long l522 = 522L;
+ long l523 = 523L;
+ long l524 = 524L;
+ long l525 = 525L;
+ long l526 = 526L;
+ long l527 = 527L;
+ long l528 = 528L;
+ long l529 = 529L;
+ long l530 = 530L;
+ long l531 = 531L;
+ long l532 = 532L;
+ long l533 = 533L;
+ long l534 = 534L;
+ long l535 = 535L;
+ long l536 = 536L;
+ long l537 = 537L;
+ long l538 = 538L;
+ long l539 = 539L;
+ long l540 = 540L;
+ long l541 = 541L;
+ long l542 = 542L;
+ long l543 = 543L;
+ long l544 = 544L;
+ long l545 = 545L;
+ long l546 = 546L;
+ long l547 = 547L;
+ long l548 = 548L;
+ long l549 = 549L;
+ long l550 = 550L;
+ long l551 = 551L;
+ long l552 = 552L;
+ long l553 = 553L;
+ long l554 = 554L;
+ long l555 = 555L;
+ long l556 = 556L;
+ long l557 = 557L;
+ long l558 = 558L;
+ long l559 = 559L;
+ long l560 = 560L;
+ long l561 = 561L;
+ long l562 = 562L;
+ long l563 = 563L;
+ long l564 = 564L;
+ long l565 = 565L;
+ long l566 = 566L;
+ long l567 = 567L;
+ long l568 = 568L;
+ long l569 = 569L;
+ long l570 = 570L;
+ long l571 = 571L;
+ long l572 = 572L;
+ long l573 = 573L;
+ long l574 = 574L;
+ long l575 = 575L;
+ long l576 = 576L;
+ long l577 = 577L;
+ long l578 = 578L;
+ long l579 = 579L;
+ long l580 = 580L;
+ long l581 = 581L;
+ long l582 = 582L;
+ long l583 = 583L;
+ long l584 = 584L;
+ long l585 = 585L;
+ long l586 = 586L;
+ long l587 = 587L;
+ long l588 = 588L;
+ long l589 = 589L;
+ long l590 = 590L;
+ long l591 = 591L;
+ long l592 = 592L;
+ long l593 = 593L;
+ long l594 = 594L;
+ long l595 = 595L;
+ long l596 = 596L;
+ long l597 = 597L;
+ long l598 = 598L;
+ long l599 = 599L;
+ long l600 = 600L;
+ long l601 = 601L;
+ long l602 = 602L;
+ long l603 = 603L;
+ long l604 = 604L;
+ long l605 = 605L;
+ long l606 = 606L;
+ long l607 = 607L;
+ long l608 = 608L;
+ long l609 = 609L;
+ long l610 = 610L;
+ long l611 = 611L;
+ long l612 = 612L;
+ long l613 = 613L;
+ long l614 = 614L;
+ long l615 = 615L;
+ long l616 = 616L;
+ long l617 = 617L;
+ long l618 = 618L;
+ long l619 = 619L;
+ long l620 = 620L;
+ long l621 = 621L;
+ long l622 = 622L;
+ long l623 = 623L;
+ long l624 = 624L;
+ long l625 = 625L;
+ long l626 = 626L;
+ long l627 = 627L;
+ long l628 = 628L;
+ long l629 = 629L;
+ long l630 = 630L;
+ long l631 = 631L;
+ long l632 = 632L;
+ long l633 = 633L;
+ long l634 = 634L;
+ long l635 = 635L;
+ long l636 = 636L;
+ long l637 = 637L;
+ long l638 = 638L;
+ long l639 = 639L;
+ long l640 = 640L;
+ long l641 = 641L;
+ long l642 = 642L;
+ long l643 = 643L;
+ long l644 = 644L;
+ long l645 = 645L;
+ long l646 = 646L;
+ long l647 = 647L;
+ long l648 = 648L;
+ long l649 = 649L;
+ long l650 = 650L;
+ long l651 = 651L;
+ long l652 = 652L;
+ long l653 = 653L;
+ long l654 = 654L;
+ long l655 = 655L;
+ long l656 = 656L;
+ long l657 = 657L;
+ long l658 = 658L;
+ long l659 = 659L;
+ long l660 = 660L;
+ long l661 = 661L;
+ long l662 = 662L;
+ long l663 = 663L;
+ long l664 = 664L;
+ long l665 = 665L;
+ long l666 = 666L;
+ long l667 = 667L;
+ long l668 = 668L;
+ long l669 = 669L;
+ long l670 = 670L;
+ long l671 = 671L;
+ long l672 = 672L;
+ long l673 = 673L;
+ long l674 = 674L;
+ long l675 = 675L;
+ long l676 = 676L;
+ long l677 = 677L;
+ long l678 = 678L;
+ long l679 = 679L;
+ long l680 = 680L;
+ long l681 = 681L;
+ long l682 = 682L;
+ long l683 = 683L;
+ long l684 = 684L;
+ long l685 = 685L;
+ long l686 = 686L;
+ long l687 = 687L;
+ long l688 = 688L;
+ long l689 = 689L;
+ long l690 = 690L;
+ long l691 = 691L;
+ long l692 = 692L;
+ long l693 = 693L;
+ long l694 = 694L;
+ long l695 = 695L;
+ long l696 = 696L;
+ long l697 = 697L;
+ long l698 = 698L;
+ long l699 = 699L;
+ long l700 = 700L;
+ long l701 = 701L;
+ long l702 = 702L;
+ long l703 = 703L;
+ long l704 = 704L;
+ long l705 = 705L;
+ long l706 = 706L;
+ long l707 = 707L;
+ long l708 = 708L;
+ long l709 = 709L;
+ long l710 = 710L;
+ long l711 = 711L;
+ long l712 = 712L;
+ long l713 = 713L;
+ long l714 = 714L;
+ long l715 = 715L;
+ long l716 = 716L;
+ long l717 = 717L;
+ long l718 = 718L;
+ long l719 = 719L;
+ long l720 = 720L;
+ long l721 = 721L;
+ long l722 = 722L;
+ long l723 = 723L;
+ long l724 = 724L;
+ long l725 = 725L;
+ long l726 = 726L;
+ long l727 = 727L;
+ long l728 = 728L;
+ long l729 = 729L;
+ long l730 = 730L;
+ long l731 = 731L;
+ long l732 = 732L;
+ long l733 = 733L;
+ long l734 = 734L;
+ long l735 = 735L;
+ long l736 = 736L;
+ long l737 = 737L;
+ long l738 = 738L;
+ long l739 = 739L;
+ long l740 = 740L;
+ long l741 = 741L;
+ long l742 = 742L;
+ long l743 = 743L;
+ long l744 = 744L;
+ long l745 = 745L;
+ long l746 = 746L;
+ long l747 = 747L;
+ long l748 = 748L;
+ long l749 = 749L;
+ long l750 = 750L;
+ long l751 = 751L;
+ long l752 = 752L;
+ long l753 = 753L;
+ long l754 = 754L;
+ long l755 = 755L;
+ long l756 = 756L;
+ long l757 = 757L;
+ long l758 = 758L;
+ long l759 = 759L;
+ long l760 = 760L;
+ long l761 = 761L;
+ long l762 = 762L;
+ long l763 = 763L;
+ long l764 = 764L;
+ long l765 = 765L;
+ long l766 = 766L;
+ long l767 = 767L;
+ long l768 = 768L;
+ long l769 = 769L;
+ long l770 = 770L;
+ long l771 = 771L;
+ long l772 = 772L;
+ long l773 = 773L;
+ long l774 = 774L;
+ long l775 = 775L;
+ long l776 = 776L;
+ long l777 = 777L;
+ long l778 = 778L;
+ long l779 = 779L;
+ long l780 = 780L;
+ long l781 = 781L;
+ long l782 = 782L;
+ long l783 = 783L;
+ long l784 = 784L;
+ long l785 = 785L;
+ long l786 = 786L;
+ long l787 = 787L;
+ long l788 = 788L;
+ long l789 = 789L;
+ long l790 = 790L;
+ long l791 = 791L;
+ long l792 = 792L;
+ long l793 = 793L;
+ long l794 = 794L;
+ long l795 = 795L;
+ long l796 = 796L;
+ long l797 = 797L;
+ long l798 = 798L;
+ long l799 = 799L;
+ long l800 = 800L;
+ long l801 = 801L;
+ long l802 = 802L;
+ long l803 = 803L;
+ long l804 = 804L;
+ long l805 = 805L;
+ long l806 = 806L;
+ long l807 = 807L;
+ long l808 = 808L;
+ long l809 = 809L;
+ long l810 = 810L;
+ long l811 = 811L;
+ long l812 = 812L;
+ long l813 = 813L;
+ long l814 = 814L;
+ long l815 = 815L;
+ long l816 = 816L;
+ long l817 = 817L;
+ long l818 = 818L;
+ long l819 = 819L;
+ long l820 = 820L;
+ long l821 = 821L;
+ long l822 = 822L;
+ long l823 = 823L;
+ long l824 = 824L;
+ long l825 = 825L;
+ long l826 = 826L;
+ long l827 = 827L;
+ long l828 = 828L;
+ long l829 = 829L;
+ long l830 = 830L;
+ long l831 = 831L;
+ long l832 = 832L;
+ long l833 = 833L;
+ long l834 = 834L;
+ long l835 = 835L;
+ long l836 = 836L;
+ long l837 = 837L;
+ long l838 = 838L;
+ long l839 = 839L;
+ long l840 = 840L;
+ long l841 = 841L;
+ long l842 = 842L;
+ long l843 = 843L;
+ long l844 = 844L;
+ long l845 = 845L;
+ long l846 = 846L;
+ long l847 = 847L;
+ long l848 = 848L;
+ long l849 = 849L;
+ long l850 = 850L;
+ long l851 = 851L;
+ long l852 = 852L;
+ long l853 = 853L;
+ long l854 = 854L;
+ long l855 = 855L;
+ long l856 = 856L;
+ long l857 = 857L;
+ long l858 = 858L;
+ long l859 = 859L;
+ long l860 = 860L;
+ long l861 = 861L;
+ long l862 = 862L;
+ long l863 = 863L;
+ long l864 = 864L;
+ long l865 = 865L;
+ long l866 = 866L;
+ long l867 = 867L;
+ long l868 = 868L;
+ long l869 = 869L;
+ long l870 = 870L;
+ long l871 = 871L;
+ long l872 = 872L;
+ long l873 = 873L;
+ long l874 = 874L;
+ long l875 = 875L;
+ long l876 = 876L;
+ long l877 = 877L;
+ long l878 = 878L;
+ long l879 = 879L;
+ long l880 = 880L;
+ long l881 = 881L;
+ long l882 = 882L;
+ long l883 = 883L;
+ long l884 = 884L;
+ long l885 = 885L;
+ long l886 = 886L;
+ long l887 = 887L;
+ long l888 = 888L;
+ long l889 = 889L;
+ long l890 = 890L;
+ long l891 = 891L;
+ long l892 = 892L;
+ long l893 = 893L;
+ long l894 = 894L;
+ long l895 = 895L;
+ long l896 = 896L;
+ long l897 = 897L;
+ long l898 = 898L;
+ long l899 = 899L;
+ long l900 = 900L;
+ long l901 = 901L;
+ long l902 = 902L;
+ long l903 = 903L;
+ long l904 = 904L;
+ long l905 = 905L;
+ long l906 = 906L;
+ long l907 = 907L;
+ long l908 = 908L;
+ long l909 = 909L;
+ long l910 = 910L;
+ long l911 = 911L;
+ long l912 = 912L;
+ long l913 = 913L;
+ long l914 = 914L;
+ long l915 = 915L;
+ long l916 = 916L;
+ long l917 = 917L;
+ long l918 = 918L;
+ long l919 = 919L;
+ long l920 = 920L;
+ long l921 = 921L;
+ long l922 = 922L;
+ long l923 = 923L;
+ long l924 = 924L;
+ long l925 = 925L;
+ long l926 = 926L;
+ long l927 = 927L;
+ long l928 = 928L;
+ long l929 = 929L;
+ long l930 = 930L;
+ long l931 = 931L;
+ long l932 = 932L;
+ long l933 = 933L;
+ long l934 = 934L;
+ long l935 = 935L;
+ long l936 = 936L;
+ long l937 = 937L;
+ long l938 = 938L;
+ long l939 = 939L;
+ long l940 = 940L;
+ long l941 = 941L;
+ long l942 = 942L;
+ long l943 = 943L;
+ long l944 = 944L;
+ long l945 = 945L;
+ long l946 = 946L;
+ long l947 = 947L;
+ long l948 = 948L;
+ long l949 = 949L;
+ long l950 = 950L;
+ long l951 = 951L;
+ long l952 = 952L;
+ long l953 = 953L;
+ long l954 = 954L;
+ long l955 = 955L;
+ long l956 = 956L;
+ long l957 = 957L;
+ long l958 = 958L;
+ long l959 = 959L;
+ long l960 = 960L;
+ long l961 = 961L;
+ long l962 = 962L;
+ long l963 = 963L;
+ long l964 = 964L;
+ long l965 = 965L;
+ long l966 = 966L;
+ long l967 = 967L;
+ long l968 = 968L;
+ long l969 = 969L;
+ long l970 = 970L;
+ long l971 = 971L;
+ long l972 = 972L;
+ long l973 = 973L;
+ long l974 = 974L;
+ long l975 = 975L;
+ long l976 = 976L;
+ long l977 = 977L;
+ long l978 = 978L;
+ long l979 = 979L;
+ long l980 = 980L;
+ long l981 = 981L;
+ long l982 = 982L;
+ long l983 = 983L;
+ long l984 = 984L;
+ long l985 = 985L;
+ long l986 = 986L;
+ long l987 = 987L;
+ long l988 = 988L;
+ long l989 = 989L;
+ long l990 = 990L;
+ long l991 = 991L;
+ long l992 = 992L;
+ long l993 = 993L;
+ long l994 = 994L;
+ long l995 = 995L;
+ long l996 = 996L;
+ long l997 = 997L;
+ long l998 = 998L;
+ long l999 = 999L;
+ l1 += l0;
+ l2 += l1;
+ l3 += l2;
+ l4 += l3;
+ l5 += l4;
+ l6 += l5;
+ l7 += l6;
+ l8 += l7;
+ l9 += l8;
+ l10 += l9;
+ l11 += l10;
+ l12 += l11;
+ l13 += l12;
+ l14 += l13;
+ l15 += l14;
+ l16 += l15;
+ l17 += l16;
+ l18 += l17;
+ l19 += l18;
+ l20 += l19;
+ l21 += l20;
+ l22 += l21;
+ l23 += l22;
+ l24 += l23;
+ l25 += l24;
+ l26 += l25;
+ l27 += l26;
+ l28 += l27;
+ l29 += l28;
+ l30 += l29;
+ l31 += l30;
+ l32 += l31;
+ l33 += l32;
+ l34 += l33;
+ l35 += l34;
+ l36 += l35;
+ l37 += l36;
+ l38 += l37;
+ l39 += l38;
+ l40 += l39;
+ l41 += l40;
+ l42 += l41;
+ l43 += l42;
+ l44 += l43;
+ l45 += l44;
+ l46 += l45;
+ l47 += l46;
+ l48 += l47;
+ l49 += l48;
+ l50 += l49;
+ l51 += l50;
+ l52 += l51;
+ l53 += l52;
+ l54 += l53;
+ l55 += l54;
+ l56 += l55;
+ l57 += l56;
+ l58 += l57;
+ l59 += l58;
+ l60 += l59;
+ l61 += l60;
+ l62 += l61;
+ l63 += l62;
+ l64 += l63;
+ l65 += l64;
+ l66 += l65;
+ l67 += l66;
+ l68 += l67;
+ l69 += l68;
+ l70 += l69;
+ l71 += l70;
+ l72 += l71;
+ l73 += l72;
+ l74 += l73;
+ l75 += l74;
+ l76 += l75;
+ l77 += l76;
+ l78 += l77;
+ l79 += l78;
+ l80 += l79;
+ l81 += l80;
+ l82 += l81;
+ l83 += l82;
+ l84 += l83;
+ l85 += l84;
+ l86 += l85;
+ l87 += l86;
+ l88 += l87;
+ l89 += l88;
+ l90 += l89;
+ l91 += l90;
+ l92 += l91;
+ l93 += l92;
+ l94 += l93;
+ l95 += l94;
+ l96 += l95;
+ l97 += l96;
+ l98 += l97;
+ l99 += l98;
+ l100 += l99;
+ l101 += l100;
+ l102 += l101;
+ l103 += l102;
+ l104 += l103;
+ l105 += l104;
+ l106 += l105;
+ l107 += l106;
+ l108 += l107;
+ l109 += l108;
+ l110 += l109;
+ l111 += l110;
+ l112 += l111;
+ l113 += l112;
+ l114 += l113;
+ l115 += l114;
+ l116 += l115;
+ l117 += l116;
+ l118 += l117;
+ l119 += l118;
+ l120 += l119;
+ l121 += l120;
+ l122 += l121;
+ l123 += l122;
+ l124 += l123;
+ l125 += l124;
+ l126 += l125;
+ l127 += l126;
+ l128 += l127;
+ l129 += l128;
+ l130 += l129;
+ l131 += l130;
+ l132 += l131;
+ l133 += l132;
+ l134 += l133;
+ l135 += l134;
+ l136 += l135;
+ l137 += l136;
+ l138 += l137;
+ l139 += l138;
+ l140 += l139;
+ l141 += l140;
+ l142 += l141;
+ l143 += l142;
+ l144 += l143;
+ l145 += l144;
+ l146 += l145;
+ l147 += l146;
+ l148 += l147;
+ l149 += l148;
+ l150 += l149;
+ l151 += l150;
+ l152 += l151;
+ l153 += l152;
+ l154 += l153;
+ l155 += l154;
+ l156 += l155;
+ l157 += l156;
+ l158 += l157;
+ l159 += l158;
+ l160 += l159;
+ l161 += l160;
+ l162 += l161;
+ l163 += l162;
+ l164 += l163;
+ l165 += l164;
+ l166 += l165;
+ l167 += l166;
+ l168 += l167;
+ l169 += l168;
+ l170 += l169;
+ l171 += l170;
+ l172 += l171;
+ l173 += l172;
+ l174 += l173;
+ l175 += l174;
+ l176 += l175;
+ l177 += l176;
+ l178 += l177;
+ l179 += l178;
+ l180 += l179;
+ l181 += l180;
+ l182 += l181;
+ l183 += l182;
+ l184 += l183;
+ l185 += l184;
+ l186 += l185;
+ l187 += l186;
+ l188 += l187;
+ l189 += l188;
+ l190 += l189;
+ l191 += l190;
+ l192 += l191;
+ l193 += l192;
+ l194 += l193;
+ l195 += l194;
+ l196 += l195;
+ l197 += l196;
+ l198 += l197;
+ l199 += l198;
+ l200 += l199;
+ l201 += l200;
+ l202 += l201;
+ l203 += l202;
+ l204 += l203;
+ l205 += l204;
+ l206 += l205;
+ l207 += l206;
+ l208 += l207;
+ l209 += l208;
+ l210 += l209;
+ l211 += l210;
+ l212 += l211;
+ l213 += l212;
+ l214 += l213;
+ l215 += l214;
+ l216 += l215;
+ l217 += l216;
+ l218 += l217;
+ l219 += l218;
+ l220 += l219;
+ l221 += l220;
+ l222 += l221;
+ l223 += l222;
+ l224 += l223;
+ l225 += l224;
+ l226 += l225;
+ l227 += l226;
+ l228 += l227;
+ l229 += l228;
+ l230 += l229;
+ l231 += l230;
+ l232 += l231;
+ l233 += l232;
+ l234 += l233;
+ l235 += l234;
+ l236 += l235;
+ l237 += l236;
+ l238 += l237;
+ l239 += l238;
+ l240 += l239;
+ l241 += l240;
+ l242 += l241;
+ l243 += l242;
+ l244 += l243;
+ l245 += l244;
+ l246 += l245;
+ l247 += l246;
+ l248 += l247;
+ l249 += l248;
+ l250 += l249;
+ l251 += l250;
+ l252 += l251;
+ l253 += l252;
+ l254 += l253;
+ l255 += l254;
+ l256 += l255;
+ l257 += l256;
+ l258 += l257;
+ l259 += l258;
+ l260 += l259;
+ l261 += l260;
+ l262 += l261;
+ l263 += l262;
+ l264 += l263;
+ l265 += l264;
+ l266 += l265;
+ l267 += l266;
+ l268 += l267;
+ l269 += l268;
+ l270 += l269;
+ l271 += l270;
+ l272 += l271;
+ l273 += l272;
+ l274 += l273;
+ l275 += l274;
+ l276 += l275;
+ l277 += l276;
+ l278 += l277;
+ l279 += l278;
+ l280 += l279;
+ l281 += l280;
+ l282 += l281;
+ l283 += l282;
+ l284 += l283;
+ l285 += l284;
+ l286 += l285;
+ l287 += l286;
+ l288 += l287;
+ l289 += l288;
+ l290 += l289;
+ l291 += l290;
+ l292 += l291;
+ l293 += l292;
+ l294 += l293;
+ l295 += l294;
+ l296 += l295;
+ l297 += l296;
+ l298 += l297;
+ l299 += l298;
+ l300 += l299;
+ l301 += l300;
+ l302 += l301;
+ l303 += l302;
+ l304 += l303;
+ l305 += l304;
+ l306 += l305;
+ l307 += l306;
+ l308 += l307;
+ l309 += l308;
+ l310 += l309;
+ l311 += l310;
+ l312 += l311;
+ l313 += l312;
+ l314 += l313;
+ l315 += l314;
+ l316 += l315;
+ l317 += l316;
+ l318 += l317;
+ l319 += l318;
+ l320 += l319;
+ l321 += l320;
+ l322 += l321;
+ l323 += l322;
+ l324 += l323;
+ l325 += l324;
+ l326 += l325;
+ l327 += l326;
+ l328 += l327;
+ l329 += l328;
+ l330 += l329;
+ l331 += l330;
+ l332 += l331;
+ l333 += l332;
+ l334 += l333;
+ l335 += l334;
+ l336 += l335;
+ l337 += l336;
+ l338 += l337;
+ l339 += l338;
+ l340 += l339;
+ l341 += l340;
+ l342 += l341;
+ l343 += l342;
+ l344 += l343;
+ l345 += l344;
+ l346 += l345;
+ l347 += l346;
+ l348 += l347;
+ l349 += l348;
+ l350 += l349;
+ l351 += l350;
+ l352 += l351;
+ l353 += l352;
+ l354 += l353;
+ l355 += l354;
+ l356 += l355;
+ l357 += l356;
+ l358 += l357;
+ l359 += l358;
+ l360 += l359;
+ l361 += l360;
+ l362 += l361;
+ l363 += l362;
+ l364 += l363;
+ l365 += l364;
+ l366 += l365;
+ l367 += l366;
+ l368 += l367;
+ l369 += l368;
+ l370 += l369;
+ l371 += l370;
+ l372 += l371;
+ l373 += l372;
+ l374 += l373;
+ l375 += l374;
+ l376 += l375;
+ l377 += l376;
+ l378 += l377;
+ l379 += l378;
+ l380 += l379;
+ l381 += l380;
+ l382 += l381;
+ l383 += l382;
+ l384 += l383;
+ l385 += l384;
+ l386 += l385;
+ l387 += l386;
+ l388 += l387;
+ l389 += l388;
+ l390 += l389;
+ l391 += l390;
+ l392 += l391;
+ l393 += l392;
+ l394 += l393;
+ l395 += l394;
+ l396 += l395;
+ l397 += l396;
+ l398 += l397;
+ l399 += l398;
+ l400 += l399;
+ l401 += l400;
+ l402 += l401;
+ l403 += l402;
+ l404 += l403;
+ l405 += l404;
+ l406 += l405;
+ l407 += l406;
+ l408 += l407;
+ l409 += l408;
+ l410 += l409;
+ l411 += l410;
+ l412 += l411;
+ l413 += l412;
+ l414 += l413;
+ l415 += l414;
+ l416 += l415;
+ l417 += l416;
+ l418 += l417;
+ l419 += l418;
+ l420 += l419;
+ l421 += l420;
+ l422 += l421;
+ l423 += l422;
+ l424 += l423;
+ l425 += l424;
+ l426 += l425;
+ l427 += l426;
+ l428 += l427;
+ l429 += l428;
+ l430 += l429;
+ l431 += l430;
+ l432 += l431;
+ l433 += l432;
+ l434 += l433;
+ l435 += l434;
+ l436 += l435;
+ l437 += l436;
+ l438 += l437;
+ l439 += l438;
+ l440 += l439;
+ l441 += l440;
+ l442 += l441;
+ l443 += l442;
+ l444 += l443;
+ l445 += l444;
+ l446 += l445;
+ l447 += l446;
+ l448 += l447;
+ l449 += l448;
+ l450 += l449;
+ l451 += l450;
+ l452 += l451;
+ l453 += l452;
+ l454 += l453;
+ l455 += l454;
+ l456 += l455;
+ l457 += l456;
+ l458 += l457;
+ l459 += l458;
+ l460 += l459;
+ l461 += l460;
+ l462 += l461;
+ l463 += l462;
+ l464 += l463;
+ l465 += l464;
+ l466 += l465;
+ l467 += l466;
+ l468 += l467;
+ l469 += l468;
+ l470 += l469;
+ l471 += l470;
+ l472 += l471;
+ l473 += l472;
+ l474 += l473;
+ l475 += l474;
+ l476 += l475;
+ l477 += l476;
+ l478 += l477;
+ l479 += l478;
+ l480 += l479;
+ l481 += l480;
+ l482 += l481;
+ l483 += l482;
+ l484 += l483;
+ l485 += l484;
+ l486 += l485;
+ l487 += l486;
+ l488 += l487;
+ l489 += l488;
+ l490 += l489;
+ l491 += l490;
+ l492 += l491;
+ l493 += l492;
+ l494 += l493;
+ l495 += l494;
+ l496 += l495;
+ l497 += l496;
+ l498 += l497;
+ l499 += l498;
+ l500 += l499;
+ l501 += l500;
+ l502 += l501;
+ l503 += l502;
+ l504 += l503;
+ l505 += l504;
+ l506 += l505;
+ l507 += l506;
+ l508 += l507;
+ l509 += l508;
+ l510 += l509;
+ l511 += l510;
+ l512 += l511;
+ l513 += l512;
+ l514 += l513;
+ l515 += l514;
+ l516 += l515;
+ l517 += l516;
+ l518 += l517;
+ l519 += l518;
+ l520 += l519;
+ l521 += l520;
+ l522 += l521;
+ l523 += l522;
+ l524 += l523;
+ l525 += l524;
+ l526 += l525;
+ l527 += l526;
+ l528 += l527;
+ l529 += l528;
+ l530 += l529;
+ l531 += l530;
+ l532 += l531;
+ l533 += l532;
+ l534 += l533;
+ l535 += l534;
+ l536 += l535;
+ l537 += l536;
+ l538 += l537;
+ l539 += l538;
+ l540 += l539;
+ l541 += l540;
+ l542 += l541;
+ l543 += l542;
+ l544 += l543;
+ l545 += l544;
+ l546 += l545;
+ l547 += l546;
+ l548 += l547;
+ l549 += l548;
+ l550 += l549;
+ l551 += l550;
+ l552 += l551;
+ l553 += l552;
+ l554 += l553;
+ l555 += l554;
+ l556 += l555;
+ l557 += l556;
+ l558 += l557;
+ l559 += l558;
+ l560 += l559;
+ l561 += l560;
+ l562 += l561;
+ l563 += l562;
+ l564 += l563;
+ l565 += l564;
+ l566 += l565;
+ l567 += l566;
+ l568 += l567;
+ l569 += l568;
+ l570 += l569;
+ l571 += l570;
+ l572 += l571;
+ l573 += l572;
+ l574 += l573;
+ l575 += l574;
+ l576 += l575;
+ l577 += l576;
+ l578 += l577;
+ l579 += l578;
+ l580 += l579;
+ l581 += l580;
+ l582 += l581;
+ l583 += l582;
+ l584 += l583;
+ l585 += l584;
+ l586 += l585;
+ l587 += l586;
+ l588 += l587;
+ l589 += l588;
+ l590 += l589;
+ l591 += l590;
+ l592 += l591;
+ l593 += l592;
+ l594 += l593;
+ l595 += l594;
+ l596 += l595;
+ l597 += l596;
+ l598 += l597;
+ l599 += l598;
+ l600 += l599;
+ l601 += l600;
+ l602 += l601;
+ l603 += l602;
+ l604 += l603;
+ l605 += l604;
+ l606 += l605;
+ l607 += l606;
+ l608 += l607;
+ l609 += l608;
+ l610 += l609;
+ l611 += l610;
+ l612 += l611;
+ l613 += l612;
+ l614 += l613;
+ l615 += l614;
+ l616 += l615;
+ l617 += l616;
+ l618 += l617;
+ l619 += l618;
+ l620 += l619;
+ l621 += l620;
+ l622 += l621;
+ l623 += l622;
+ l624 += l623;
+ l625 += l624;
+ l626 += l625;
+ l627 += l626;
+ l628 += l627;
+ l629 += l628;
+ l630 += l629;
+ l631 += l630;
+ l632 += l631;
+ l633 += l632;
+ l634 += l633;
+ l635 += l634;
+ l636 += l635;
+ l637 += l636;
+ l638 += l637;
+ l639 += l638;
+ l640 += l639;
+ l641 += l640;
+ l642 += l641;
+ l643 += l642;
+ l644 += l643;
+ l645 += l644;
+ l646 += l645;
+ l647 += l646;
+ l648 += l647;
+ l649 += l648;
+ l650 += l649;
+ l651 += l650;
+ l652 += l651;
+ l653 += l652;
+ l654 += l653;
+ l655 += l654;
+ l656 += l655;
+ l657 += l656;
+ l658 += l657;
+ l659 += l658;
+ l660 += l659;
+ l661 += l660;
+ l662 += l661;
+ l663 += l662;
+ l664 += l663;
+ l665 += l664;
+ l666 += l665;
+ l667 += l666;
+ l668 += l667;
+ l669 += l668;
+ l670 += l669;
+ l671 += l670;
+ l672 += l671;
+ l673 += l672;
+ l674 += l673;
+ l675 += l674;
+ l676 += l675;
+ l677 += l676;
+ l678 += l677;
+ l679 += l678;
+ l680 += l679;
+ l681 += l680;
+ l682 += l681;
+ l683 += l682;
+ l684 += l683;
+ l685 += l684;
+ l686 += l685;
+ l687 += l686;
+ l688 += l687;
+ l689 += l688;
+ l690 += l689;
+ l691 += l690;
+ l692 += l691;
+ l693 += l692;
+ l694 += l693;
+ l695 += l694;
+ l696 += l695;
+ l697 += l696;
+ l698 += l697;
+ l699 += l698;
+ l700 += l699;
+ l701 += l700;
+ l702 += l701;
+ l703 += l702;
+ l704 += l703;
+ l705 += l704;
+ l706 += l705;
+ l707 += l706;
+ l708 += l707;
+ l709 += l708;
+ l710 += l709;
+ l711 += l710;
+ l712 += l711;
+ l713 += l712;
+ l714 += l713;
+ l715 += l714;
+ l716 += l715;
+ l717 += l716;
+ l718 += l717;
+ l719 += l718;
+ l720 += l719;
+ l721 += l720;
+ l722 += l721;
+ l723 += l722;
+ l724 += l723;
+ l725 += l724;
+ l726 += l725;
+ l727 += l726;
+ l728 += l727;
+ l729 += l728;
+ l730 += l729;
+ l731 += l730;
+ l732 += l731;
+ l733 += l732;
+ l734 += l733;
+ l735 += l734;
+ l736 += l735;
+ l737 += l736;
+ l738 += l737;
+ l739 += l738;
+ l740 += l739;
+ l741 += l740;
+ l742 += l741;
+ l743 += l742;
+ l744 += l743;
+ l745 += l744;
+ l746 += l745;
+ l747 += l746;
+ l748 += l747;
+ l749 += l748;
+ l750 += l749;
+ l751 += l750;
+ l752 += l751;
+ l753 += l752;
+ l754 += l753;
+ l755 += l754;
+ l756 += l755;
+ l757 += l756;
+ l758 += l757;
+ l759 += l758;
+ l760 += l759;
+ l761 += l760;
+ l762 += l761;
+ l763 += l762;
+ l764 += l763;
+ l765 += l764;
+ l766 += l765;
+ l767 += l766;
+ l768 += l767;
+ l769 += l768;
+ l770 += l769;
+ l771 += l770;
+ l772 += l771;
+ l773 += l772;
+ l774 += l773;
+ l775 += l774;
+ l776 += l775;
+ l777 += l776;
+ l778 += l777;
+ l779 += l778;
+ l780 += l779;
+ l781 += l780;
+ l782 += l781;
+ l783 += l782;
+ l784 += l783;
+ l785 += l784;
+ l786 += l785;
+ l787 += l786;
+ l788 += l787;
+ l789 += l788;
+ l790 += l789;
+ l791 += l790;
+ l792 += l791;
+ l793 += l792;
+ l794 += l793;
+ l795 += l794;
+ l796 += l795;
+ l797 += l796;
+ l798 += l797;
+ l799 += l798;
+ l800 += l799;
+ l801 += l800;
+ l802 += l801;
+ l803 += l802;
+ l804 += l803;
+ l805 += l804;
+ l806 += l805;
+ l807 += l806;
+ l808 += l807;
+ l809 += l808;
+ l810 += l809;
+ l811 += l810;
+ l812 += l811;
+ l813 += l812;
+ l814 += l813;
+ l815 += l814;
+ l816 += l815;
+ l817 += l816;
+ l818 += l817;
+ l819 += l818;
+ l820 += l819;
+ l821 += l820;
+ l822 += l821;
+ l823 += l822;
+ l824 += l823;
+ l825 += l824;
+ l826 += l825;
+ l827 += l826;
+ l828 += l827;
+ l829 += l828;
+ l830 += l829;
+ l831 += l830;
+ l832 += l831;
+ l833 += l832;
+ l834 += l833;
+ l835 += l834;
+ l836 += l835;
+ l837 += l836;
+ l838 += l837;
+ l839 += l838;
+ l840 += l839;
+ l841 += l840;
+ l842 += l841;
+ l843 += l842;
+ l844 += l843;
+ l845 += l844;
+ l846 += l845;
+ l847 += l846;
+ l848 += l847;
+ l849 += l848;
+ l850 += l849;
+ l851 += l850;
+ l852 += l851;
+ l853 += l852;
+ l854 += l853;
+ l855 += l854;
+ l856 += l855;
+ l857 += l856;
+ l858 += l857;
+ l859 += l858;
+ l860 += l859;
+ l861 += l860;
+ l862 += l861;
+ l863 += l862;
+ l864 += l863;
+ l865 += l864;
+ l866 += l865;
+ l867 += l866;
+ l868 += l867;
+ l869 += l868;
+ l870 += l869;
+ l871 += l870;
+ l872 += l871;
+ l873 += l872;
+ l874 += l873;
+ l875 += l874;
+ l876 += l875;
+ l877 += l876;
+ l878 += l877;
+ l879 += l878;
+ l880 += l879;
+ l881 += l880;
+ l882 += l881;
+ l883 += l882;
+ l884 += l883;
+ l885 += l884;
+ l886 += l885;
+ l887 += l886;
+ l888 += l887;
+ l889 += l888;
+ l890 += l889;
+ l891 += l890;
+ l892 += l891;
+ l893 += l892;
+ l894 += l893;
+ l895 += l894;
+ l896 += l895;
+ l897 += l896;
+ l898 += l897;
+ l899 += l898;
+ l900 += l899;
+ l901 += l900;
+ l902 += l901;
+ l903 += l902;
+ l904 += l903;
+ l905 += l904;
+ l906 += l905;
+ l907 += l906;
+ l908 += l907;
+ l909 += l908;
+ l910 += l909;
+ l911 += l910;
+ l912 += l911;
+ l913 += l912;
+ l914 += l913;
+ l915 += l914;
+ l916 += l915;
+ l917 += l916;
+ l918 += l917;
+ l919 += l918;
+ l920 += l919;
+ l921 += l920;
+ l922 += l921;
+ l923 += l922;
+ l924 += l923;
+ l925 += l924;
+ l926 += l925;
+ l927 += l926;
+ l928 += l927;
+ l929 += l928;
+ l930 += l929;
+ l931 += l930;
+ l932 += l931;
+ l933 += l932;
+ l934 += l933;
+ l935 += l934;
+ l936 += l935;
+ l937 += l936;
+ l938 += l937;
+ l939 += l938;
+ l940 += l939;
+ l941 += l940;
+ l942 += l941;
+ l943 += l942;
+ l944 += l943;
+ l945 += l944;
+ l946 += l945;
+ l947 += l946;
+ l948 += l947;
+ l949 += l948;
+ l950 += l949;
+ l951 += l950;
+ l952 += l951;
+ l953 += l952;
+ l954 += l953;
+ l955 += l954;
+ l956 += l955;
+ l957 += l956;
+ l958 += l957;
+ l959 += l958;
+ l960 += l959;
+ l961 += l960;
+ l962 += l961;
+ l963 += l962;
+ l964 += l963;
+ l965 += l964;
+ l966 += l965;
+ l967 += l966;
+ l968 += l967;
+ l969 += l968;
+ l970 += l969;
+ l971 += l970;
+ l972 += l971;
+ l973 += l972;
+ l974 += l973;
+ l975 += l974;
+ l976 += l975;
+ l977 += l976;
+ l978 += l977;
+ l979 += l978;
+ l980 += l979;
+ l981 += l980;
+ l982 += l981;
+ l983 += l982;
+ l984 += l983;
+ l985 += l984;
+ l986 += l985;
+ l987 += l986;
+ l988 += l987;
+ l989 += l988;
+ l990 += l989;
+ l991 += l990;
+ l992 += l991;
+ l993 += l992;
+ l994 += l993;
+ l995 += l994;
+ l996 += l995;
+ l997 += l996;
+ l998 += l997;
+ l999 += l998;
+ return l999;
+ }
+}
diff --git a/test/422-instanceof/expected.txt b/test/422-instanceof/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/422-instanceof/expected.txt
diff --git a/test/422-instanceof/info.txt b/test/422-instanceof/info.txt
new file mode 100644
index 0000000000..b2f7ff17c1
--- /dev/null
+++ b/test/422-instanceof/info.txt
@@ -0,0 +1 @@
+Tests for instanceof bytecode.
diff --git a/test/422-instanceof/src/Main.java b/test/422-instanceof/src/Main.java
new file mode 100644
index 0000000000..307c987cda
--- /dev/null
+++ b/test/422-instanceof/src/Main.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static Object a;
+
+ public static void assertTrue(boolean value) {
+ if (!value) {
+ throw new Error("Wrong result");
+ }
+ }
+
+ public static void assertFalse(boolean value) {
+ if (value) {
+ throw new Error("Wrong result");
+ }
+ }
+
+ public static boolean $opt$InstanceOfMain() {
+ return a instanceof Main;
+ }
+
+ public static boolean $opt$InstanceOfFinalClass() {
+ return a instanceof FinalClass;
+ }
+
+ public static void main(String[] args) {
+ $opt$TestMain();
+ $opt$TestFinalClass();
+ }
+
+ public static void $opt$TestMain() {
+ a = new Main();
+ assertTrue($opt$InstanceOfMain());
+ a = null;
+ assertFalse($opt$InstanceOfMain());
+ a = new MainChild();
+ assertTrue($opt$InstanceOfMain());
+ a = new Object();
+ assertFalse($opt$InstanceOfMain());
+ }
+
+ public static void $opt$TestFinalClass() {
+ a = new FinalClass();
+ assertTrue($opt$InstanceOfFinalClass());
+ a = null;
+ assertFalse($opt$InstanceOfFinalClass());
+ a = new Main();
+ assertFalse($opt$InstanceOfFinalClass());
+ a = new Object();
+ assertFalse($opt$InstanceOfFinalClass());
+ }
+
+ static class MainChild extends Main {}
+
+ static final class FinalClass {}
+}
diff --git a/test/422-type-conversion/expected.txt b/test/422-type-conversion/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/422-type-conversion/expected.txt
diff --git a/test/422-type-conversion/info.txt b/test/422-type-conversion/info.txt
new file mode 100644
index 0000000000..e734f3213e
--- /dev/null
+++ b/test/422-type-conversion/info.txt
@@ -0,0 +1 @@
+Tests for type conversions.
diff --git a/test/422-type-conversion/src/Main.java b/test/422-type-conversion/src/Main.java
new file mode 100644
index 0000000000..0bf958541b
--- /dev/null
+++ b/test/422-type-conversion/src/Main.java
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Note that $opt$ is a marker for the optimizing compiler to ensure
+// it does compile the method.
+public class Main {
+
+ public static void assertByteEquals(byte expected, byte result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertShortEquals(short expected, short result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertIntEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertLongEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void assertCharEquals(char expected, char result) {
+ if (expected != result) {
+ // Values are cast to int to display numeric values instead of
+ // (UTF-16 encoded) characters.
+ throw new Error("Expected: " + (int)expected + ", found: " + (int)result);
+ }
+ }
+
+ public static void main(String[] args) {
+ // Generate, compile and check int-to-long Dex instructions.
+ byteToLong();
+ shortToLong();
+ intToLong();
+ charToLong();
+
+ // Generate, compile and check long-to-int Dex instructions.
+ longToInt();
+
+ // Generate, compile and check int-to-byte Dex instructions.
+ shortToByte();
+ intToByte();
+ charToByte();
+
+ // Generate, compile and check int-to-short Dex instructions.
+ byteToShort();
+ intToShort();
+ charToShort();
+
+ // Generate, compile and check int-to-char Dex instructions.
+ byteToChar();
+ shortToChar();
+ intToChar();
+ }
+
+ private static void byteToLong() {
+ assertLongEquals(1L, $opt$ByteToLong((byte)1));
+ assertLongEquals(0L, $opt$ByteToLong((byte)0));
+ assertLongEquals(-1L, $opt$ByteToLong((byte)-1));
+ assertLongEquals(51L, $opt$ByteToLong((byte)51));
+ assertLongEquals(-51L, $opt$ByteToLong((byte)-51));
+ assertLongEquals(127L, $opt$ByteToLong((byte)127)); // 2^7 - 1
+ assertLongEquals(-127L, $opt$ByteToLong((byte)-127)); // -(2^7 - 1)
+ assertLongEquals(-128L, $opt$ByteToLong((byte)-128)); // -(2^7)
+ }
+
+ private static void shortToLong() {
+ assertLongEquals(1L, $opt$ShortToLong((short)1));
+ assertLongEquals(0L, $opt$ShortToLong((short)0));
+ assertLongEquals(-1L, $opt$ShortToLong((short)-1));
+ assertLongEquals(51L, $opt$ShortToLong((short)51));
+ assertLongEquals(-51L, $opt$ShortToLong((short)-51));
+ assertLongEquals(32767L, $opt$ShortToLong((short)32767)); // 2^15 - 1
+ assertLongEquals(-32767L, $opt$ShortToLong((short)-32767)); // -(2^15 - 1)
+ assertLongEquals(-32768L, $opt$ShortToLong((short)-32768)); // -(2^15)
+ }
+
+ private static void intToLong() {
+ assertLongEquals(1L, $opt$IntToLong(1));
+ assertLongEquals(0L, $opt$IntToLong(0));
+ assertLongEquals(-1L, $opt$IntToLong(-1));
+ assertLongEquals(51L, $opt$IntToLong(51));
+ assertLongEquals(-51L, $opt$IntToLong(-51));
+ assertLongEquals(2147483647L, $opt$IntToLong(2147483647)); // 2^31 - 1
+ assertLongEquals(-2147483647L, $opt$IntToLong(-2147483647)); // -(2^31 - 1)
+ assertLongEquals(-2147483648L, $opt$IntToLong(-2147483648)); // -(2^31)
+ }
+
+ private static void charToLong() {
+ assertLongEquals(1L, $opt$CharToLong((char)1));
+ assertLongEquals(0L, $opt$CharToLong((char)0));
+ assertLongEquals(51L, $opt$CharToLong((char)51));
+ assertLongEquals(32767L, $opt$CharToLong((char)32767)); // 2^15 - 1
+ assertLongEquals(65535L, $opt$CharToLong((char)65535)); // 2^16 - 1
+ assertLongEquals(65535L, $opt$CharToLong((char)-1));
+ assertLongEquals(65485L, $opt$CharToLong((char)-51));
+ assertLongEquals(32769L, $opt$CharToLong((char)-32767)); // -(2^15 - 1)
+ assertLongEquals(32768L, $opt$CharToLong((char)-32768)); // -(2^15)
+ }
+
+ private static void longToInt() {
+ assertIntEquals(1, $opt$LongToInt(1L));
+ assertIntEquals(0, $opt$LongToInt(0L));
+ assertIntEquals(-1, $opt$LongToInt(-1L));
+ assertIntEquals(51, $opt$LongToInt(51L));
+ assertIntEquals(-51, $opt$LongToInt(-51L));
+ assertIntEquals(2147483647, $opt$LongToInt(2147483647L)); // 2^31 - 1
+ assertIntEquals(-2147483647, $opt$LongToInt(-2147483647L)); // -(2^31 - 1)
+ assertIntEquals(-2147483648, $opt$LongToInt(-2147483648L)); // -(2^31)
+ assertIntEquals(-2147483648, $opt$LongToInt(2147483648L)); // (2^31)
+ assertIntEquals(2147483647, $opt$LongToInt(-2147483649L)); // -(2^31 + 1)
+ assertIntEquals(-1, $opt$LongToInt(9223372036854775807L)); // 2^63 - 1
+ assertIntEquals(1, $opt$LongToInt(-9223372036854775807L)); // -(2^63 - 1)
+ assertIntEquals(0, $opt$LongToInt(-9223372036854775808L)); // -(2^63)
+
+ assertIntEquals(42, $opt$LongLiteralToInt());
+
+ // Ensure long-to-int conversions truncates values as expected.
+ assertLongEquals(1L, $opt$IntToLong($opt$LongToInt(4294967297L))); // 2^32 + 1
+ assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(4294967296L))); // 2^32
+ assertLongEquals(-1L, $opt$IntToLong($opt$LongToInt(4294967295L))); // 2^32 - 1
+ assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(0L)));
+ assertLongEquals(1L, $opt$IntToLong($opt$LongToInt(-4294967295L))); // -(2^32 - 1)
+ assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(-4294967296L))); // -(2^32)
+ assertLongEquals(-1, $opt$IntToLong($opt$LongToInt(-4294967297L))); // -(2^32 + 1)
+ }
+
+ private static void shortToByte() {
+ assertByteEquals((byte)1, $opt$ShortToByte((short)1));
+ assertByteEquals((byte)0, $opt$ShortToByte((short)0));
+ assertByteEquals((byte)-1, $opt$ShortToByte((short)-1));
+ assertByteEquals((byte)51, $opt$ShortToByte((short)51));
+ assertByteEquals((byte)-51, $opt$ShortToByte((short)-51));
+ assertByteEquals((byte)127, $opt$ShortToByte((short)127)); // 2^7 - 1
+ assertByteEquals((byte)-127, $opt$ShortToByte((short)-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$ShortToByte((short)-128)); // -(2^7)
+ assertByteEquals((byte)-128, $opt$ShortToByte((short)128)); // 2^7
+ assertByteEquals((byte)127, $opt$ShortToByte((short)-129)); // -(2^7 + 1)
+ assertByteEquals((byte)-1, $opt$ShortToByte((short)32767)); // 2^15 - 1
+ assertByteEquals((byte)0, $opt$ShortToByte((short)-32768)); // -(2^15)
+ }
+
+ private static void intToByte() {
+ assertByteEquals((byte)1, $opt$IntToByte(1));
+ assertByteEquals((byte)0, $opt$IntToByte(0));
+ assertByteEquals((byte)-1, $opt$IntToByte(-1));
+ assertByteEquals((byte)51, $opt$IntToByte(51));
+ assertByteEquals((byte)-51, $opt$IntToByte(-51));
+ assertByteEquals((byte)127, $opt$IntToByte(127)); // 2^7 - 1
+ assertByteEquals((byte)-127, $opt$IntToByte(-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$IntToByte(-128)); // -(2^7)
+ assertByteEquals((byte)-128, $opt$IntToByte(128)); // 2^7
+ assertByteEquals((byte)127, $opt$IntToByte(-129)); // -(2^7 + 1)
+ assertByteEquals((byte)-1, $opt$IntToByte(2147483647)); // 2^31 - 1
+ assertByteEquals((byte)0, $opt$IntToByte(-2147483648)); // -(2^31)
+ }
+
+ private static void charToByte() {
+ assertByteEquals((byte)1, $opt$CharToByte((char)1));
+ assertByteEquals((byte)0, $opt$CharToByte((char)0));
+ assertByteEquals((byte)51, $opt$CharToByte((char)51));
+ assertByteEquals((byte)127, $opt$CharToByte((char)127)); // 2^7 - 1
+ assertByteEquals((byte)-128, $opt$CharToByte((char)128)); // 2^7
+ assertByteEquals((byte)-1, $opt$CharToByte((char)32767)); // 2^15 - 1
+ assertByteEquals((byte)-1, $opt$CharToByte((char)65535)); // 2^16 - 1
+ assertByteEquals((byte)-1, $opt$CharToByte((char)-1));
+ assertByteEquals((byte)-51, $opt$CharToByte((char)-51));
+ assertByteEquals((byte)-127, $opt$CharToByte((char)-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$CharToByte((char)-128)); // -(2^7)
+ assertByteEquals((byte)127, $opt$CharToByte((char)-129)); // -(2^7 + 1)
+ }
+
+ private static void byteToShort() {
+ assertShortEquals((short)1, $opt$ByteToShort((byte)1));
+ assertShortEquals((short)0, $opt$ByteToShort((byte)0));
+ assertShortEquals((short)-1, $opt$ByteToShort((byte)-1));
+ assertShortEquals((short)51, $opt$ByteToShort((byte)51));
+ assertShortEquals((short)-51, $opt$ByteToShort((byte)-51));
+ assertShortEquals((short)127, $opt$ByteToShort((byte)127)); // 2^7 - 1
+ assertShortEquals((short)-127, $opt$ByteToShort((byte)-127)); // -(2^7 - 1)
+ assertShortEquals((short)-128, $opt$ByteToShort((byte)-128)); // -(2^7)
+ }
+
+ private static void intToShort() {
+ assertShortEquals((short)1, $opt$IntToShort(1));
+ assertShortEquals((short)0, $opt$IntToShort(0));
+ assertShortEquals((short)-1, $opt$IntToShort(-1));
+ assertShortEquals((short)51, $opt$IntToShort(51));
+ assertShortEquals((short)-51, $opt$IntToShort(-51));
+ assertShortEquals((short)32767, $opt$IntToShort(32767)); // 2^15 - 1
+ assertShortEquals((short)-32767, $opt$IntToShort(-32767)); // -(2^15 - 1)
+ assertShortEquals((short)-32768, $opt$IntToShort(-32768)); // -(2^15)
+ assertShortEquals((short)-32768, $opt$IntToShort(32768)); // 2^15
+ assertShortEquals((short)32767, $opt$IntToShort(-32769)); // -(2^15 + 1)
+ assertShortEquals((short)-1, $opt$IntToShort(2147483647)); // 2^31 - 1
+ assertShortEquals((short)0, $opt$IntToShort(-2147483648)); // -(2^31)
+ }
+
+ private static void charToShort() {
+ assertShortEquals((short)1, $opt$CharToShort((char)1));
+ assertShortEquals((short)0, $opt$CharToShort((char)0));
+ assertShortEquals((short)51, $opt$CharToShort((char)51));
+ assertShortEquals((short)32767, $opt$CharToShort((char)32767)); // 2^15 - 1
+ assertShortEquals((short)-32768, $opt$CharToShort((char)32768)); // 2^15
+ assertShortEquals((short)-32767, $opt$CharToShort((char)32769)); // 2^15
+ assertShortEquals((short)-1, $opt$CharToShort((char)65535)); // 2^16 - 1
+ assertShortEquals((short)-1, $opt$CharToShort((char)-1));
+ assertShortEquals((short)-51, $opt$CharToShort((char)-51));
+ assertShortEquals((short)-32767, $opt$CharToShort((char)-32767)); // -(2^15 - 1)
+ assertShortEquals((short)-32768, $opt$CharToShort((char)-32768)); // -(2^15)
+ assertShortEquals((short)32767, $opt$CharToShort((char)-32769)); // -(2^15 + 1)
+ }
+
+ private static void byteToChar() {
+ assertCharEquals((char)1, $opt$ByteToChar((byte)1));
+ assertCharEquals((char)0, $opt$ByteToChar((byte)0));
+ assertCharEquals((char)65535, $opt$ByteToChar((byte)-1));
+ assertCharEquals((char)51, $opt$ByteToChar((byte)51));
+ assertCharEquals((char)65485, $opt$ByteToChar((byte)-51));
+ assertCharEquals((char)127, $opt$ByteToChar((byte)127)); // 2^7 - 1
+ assertCharEquals((char)65409, $opt$ByteToChar((byte)-127)); // -(2^7 - 1)
+ assertCharEquals((char)65408, $opt$ByteToChar((byte)-128)); // -(2^7)
+ }
+
+ private static void shortToChar() {
+ assertCharEquals((char)1, $opt$ShortToChar((short)1));
+ assertCharEquals((char)0, $opt$ShortToChar((short)0));
+ assertCharEquals((char)65535, $opt$ShortToChar((short)-1));
+ assertCharEquals((char)51, $opt$ShortToChar((short)51));
+ assertCharEquals((char)65485, $opt$ShortToChar((short)-51));
+ assertCharEquals((char)32767, $opt$ShortToChar((short)32767)); // 2^15 - 1
+ assertCharEquals((char)32769, $opt$ShortToChar((short)-32767)); // -(2^15 - 1)
+ assertCharEquals((char)32768, $opt$ShortToChar((short)-32768)); // -(2^15)
+ }
+
+ private static void intToChar() {
+ assertCharEquals((char)1, $opt$IntToChar(1));
+ assertCharEquals((char)0, $opt$IntToChar(0));
+ assertCharEquals((char)65535, $opt$IntToChar(-1));
+ assertCharEquals((char)51, $opt$IntToChar(51));
+ assertCharEquals((char)65485, $opt$IntToChar(-51));
+ assertCharEquals((char)32767, $opt$IntToChar(32767)); // 2^15 - 1
+ assertCharEquals((char)32769, $opt$IntToChar(-32767)); // -(2^15 - 1)
+ assertCharEquals((char)32768, $opt$IntToChar(32768)); // 2^15
+ assertCharEquals((char)32768, $opt$IntToChar(-32768)); // -(2^15)
+ assertCharEquals((char)65535, $opt$IntToChar(65535)); // 2^16 - 1
+ assertCharEquals((char)1, $opt$IntToChar(-65535)); // -(2^16 - 1)
+ assertCharEquals((char)0, $opt$IntToChar(65536)); // 2^16
+ assertCharEquals((char)0, $opt$IntToChar(-65536)); // -(2^16)
+ assertCharEquals((char)65535, $opt$IntToChar(2147483647)); // 2^31 - 1
+ assertCharEquals((char)0, $opt$IntToChar(-2147483648)); // -(2^31)
+ }
+
+
+ // These methods produce int-to-long Dex instructions.
+ static long $opt$ByteToLong(byte a) { return a; }
+ static long $opt$ShortToLong(short a) { return a; }
+ static long $opt$IntToLong(int a) { return a; }
+ static long $opt$CharToLong(int a) { return a; }
+
+ // These methods produce long-to-int Dex instructions.
+ static int $opt$LongToInt(long a){ return (int)a; }
+ static int $opt$LongLiteralToInt(){ return (int)42L; }
+
+ // These methods produce int-to-byte Dex instructions.
+ static byte $opt$ShortToByte(short a){ return (byte)a; }
+ static byte $opt$IntToByte(int a){ return (byte)a; }
+ static byte $opt$CharToByte(char a){ return (byte)a; }
+
+ // These methods produce int-to-short Dex instructions.
+ static short $opt$ByteToShort(byte a){ return (short)a; }
+ static short $opt$IntToShort(int a){ return (short)a; }
+ static short $opt$CharToShort(char a){ return (short)a; }
+
+ // These methods produce int-to-char Dex instructions.
+ static char $opt$ByteToChar(byte a){ return (char)a; }
+ static char $opt$ShortToChar(short a){ return (char)a; }
+ static char $opt$IntToChar(int a){ return (char)a; }
+}
diff --git a/test/423-invoke-interface/expected.txt b/test/423-invoke-interface/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/423-invoke-interface/expected.txt
diff --git a/test/423-invoke-interface/info.txt b/test/423-invoke-interface/info.txt
new file mode 100644
index 0000000000..a496ffe809
--- /dev/null
+++ b/test/423-invoke-interface/info.txt
@@ -0,0 +1,2 @@
+invoke-interface test with hopefully enough interface methods to trigger
+a conflict in our imt table.
diff --git a/test/423-invoke-interface/src/Main.java b/test/423-invoke-interface/src/Main.java
new file mode 100644
index 0000000000..fae857a045
--- /dev/null
+++ b/test/423-invoke-interface/src/Main.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ static interface Itf {
+ public int return1();
+ public int return2();
+ public int return3();
+ public int return4();
+ public int return5();
+ public int return6();
+ public int return7();
+ public int return8();
+ public int return9();
+ public int return10();
+ public int return11();
+ public int return12();
+ public int return13();
+ public int return14();
+ public int return15();
+ public int return16();
+ public int return17();
+ public int return18();
+ public int return19();
+ public int return20();
+ }
+
+ static class ItfImpl1 implements Itf {
+ public int return1() { return 1; }
+ public int return2() { return 2; }
+ public int return3() { return 3; }
+ public int return4() { return 4; }
+ public int return5() { return 5; }
+ public int return6() { return 6; }
+ public int return7() { return 7; }
+ public int return8() { return 8; }
+ public int return9() { return 9; }
+ public int return10() { return 10; }
+ public int return11() { return 11; }
+ public int return12() { return 12; }
+ public int return13() { return 13; }
+ public int return14() { return 14; }
+ public int return15() { return 15; }
+ public int return16() { return 16; }
+ public int return17() { return 17; }
+ public int return18() { return 18; }
+ public int return19() { return 19; }
+ public int return20() { return 20; }
+ }
+
+ static class ItfImpl2 implements Itf {
+ public int return1() { return -1; }
+ public int return2() { return -2; }
+ public int return3() { return -3; }
+ public int return4() { return -4; }
+ public int return5() { return -5; }
+ public int return6() { return -6; }
+ public int return7() { return -7; }
+ public int return8() { return -8; }
+ public int return9() { return -9; }
+ public int return10() { return -10; }
+ public int return11() { return -11; }
+ public int return12() { return -12; }
+ public int return13() { return -13; }
+ public int return14() { return -14; }
+ public int return15() { return -15; }
+ public int return16() { return -16; }
+ public int return17() { return -17; }
+ public int return18() { return -18; }
+ public int return19() { return -19; }
+ public int return20() { return -20; }
+ }
+
+ public static void main(String[] args) {
+ $opt$InvokeInterface(new ItfImpl1(), 1);
+ $opt$InvokeInterface(new ItfImpl2(), -1);
+ }
+
+ public static void assertEquals(int expected, int value) {
+ if (expected != value) {
+ throw new Error("Expected " + expected + ", got " + value);
+ }
+ }
+
+ public static void $opt$InvokeInterface(Itf object, int factor) {
+ assertEquals(factor * 1, object.return1());
+ assertEquals(factor * 2, object.return2());
+ assertEquals(factor * 3, object.return3());
+ assertEquals(factor * 4, object.return4());
+ assertEquals(factor * 5, object.return5());
+ assertEquals(factor * 6, object.return6());
+ assertEquals(factor * 7, object.return7());
+ assertEquals(factor * 8, object.return8());
+ assertEquals(factor * 9, object.return9());
+ assertEquals(factor * 10, object.return10());
+ assertEquals(factor * 11, object.return11());
+ assertEquals(factor * 12, object.return12());
+ assertEquals(factor * 13, object.return13());
+ assertEquals(factor * 14, object.return14());
+ assertEquals(factor * 15, object.return15());
+ assertEquals(factor * 16, object.return16());
+ assertEquals(factor * 17, object.return17());
+ assertEquals(factor * 18, object.return18());
+ assertEquals(factor * 19, object.return19());
+ assertEquals(factor * 20, object.return20());
+ }
+}
diff --git a/test/424-checkcast/expected.txt b/test/424-checkcast/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/424-checkcast/expected.txt
diff --git a/test/424-checkcast/info.txt b/test/424-checkcast/info.txt
new file mode 100644
index 0000000000..b50b082651
--- /dev/null
+++ b/test/424-checkcast/info.txt
@@ -0,0 +1 @@
+Simple tests for the checkcast opcode.
diff --git a/test/424-checkcast/src/Main.java b/test/424-checkcast/src/Main.java
new file mode 100644
index 0000000000..791b166609
--- /dev/null
+++ b/test/424-checkcast/src/Main.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static Object a;
+
+ public static Object $opt$CheckCastMain() {
+ return (Main)a;
+ }
+
+ public static Object $opt$CheckCastFinalClass() {
+ return (FinalClass)a;
+ }
+
+ public static void main(String[] args) {
+ $opt$TestMain();
+ $opt$TestFinalClass();
+ }
+
+ public static void $opt$TestMain() {
+ a = new Main();
+ $opt$CheckCastMain();
+
+ a = null;
+ $opt$CheckCastMain();
+
+ a = new MainChild();
+ $opt$CheckCastMain();
+
+ a = new Object();
+ try {
+ $opt$CheckCastMain();
+ throw new Error("Should have gotten a ClassCastException");
+ } catch (ClassCastException ex) {}
+ }
+
+ public static void $opt$TestFinalClass() {
+ a = new FinalClass();
+ $opt$CheckCastFinalClass();
+
+ a = null;
+ $opt$CheckCastFinalClass();
+
+ a = new Main();
+ try {
+ $opt$CheckCastFinalClass();
+ throw new Error("Should have gotten a ClassCastException");
+ } catch (ClassCastException ex) {}
+
+ a = new Object();
+ try {
+ $opt$CheckCastFinalClass();
+ throw new Error("Should have gotten a ClassCastException");
+ } catch (ClassCastException ex) {}
+ }
+
+ static class MainChild extends Main {}
+
+ static final class FinalClass {}
+}
diff --git a/test/425-invoke-super/expected.txt b/test/425-invoke-super/expected.txt
new file mode 100644
index 0000000000..f7f6ae4911
--- /dev/null
+++ b/test/425-invoke-super/expected.txt
@@ -0,0 +1 @@
+Test started
diff --git a/test/425-invoke-super/info.txt b/test/425-invoke-super/info.txt
new file mode 100644
index 0000000000..ad99030a85
--- /dev/null
+++ b/test/425-invoke-super/info.txt
@@ -0,0 +1 @@
+Tests the invoke-super opcode.
diff --git a/test/425-invoke-super/smali/invokesuper.smali b/test/425-invoke-super/smali/invokesuper.smali
new file mode 100644
index 0000000000..ab1309161e
--- /dev/null
+++ b/test/425-invoke-super/smali/invokesuper.smali
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+.class public LInvokeSuper;
+.super LSuperClass;
+
+.method public constructor <init>()V
+.registers 1
+ invoke-direct {v0}, LSuperClass;-><init>()V
+ return-void
+.end method
+
+
+.method public run()I
+.registers 2
+ # Do an invoke super on a non-super class to force slow path.
+ invoke-super {v1}, LInvokeSuper;->returnInt()I
+ move-result v0
+ return v0
+.end method
+
+
+.method public returnInt()I
+.registers 2
+ const v0, 777
+ return v0
+.end method
diff --git a/test/425-invoke-super/smali/subclass.smali b/test/425-invoke-super/smali/subclass.smali
new file mode 100644
index 0000000000..54e3474078
--- /dev/null
+++ b/test/425-invoke-super/smali/subclass.smali
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.class public LSubClass;
+.super LInvokeSuper;
+
+.method public constructor <init>()V
+.registers 1
+ invoke-direct {v0}, LInvokeSuper;-><init>()V
+ return-void
+.end method
+
+.method public returnInt()I
+.registers 2
+ const v0, 0
+ return v0
+.end method
diff --git a/test/425-invoke-super/smali/superclass.smali b/test/425-invoke-super/smali/superclass.smali
new file mode 100644
index 0000000000..b366aa7a91
--- /dev/null
+++ b/test/425-invoke-super/smali/superclass.smali
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.class public LSuperClass;
+.super Ljava/lang/Object;
+
+.method public constructor <init>()V
+.registers 1
+ invoke-direct {v0}, Ljava/lang/Object;-><init>()V
+ return-void
+.end method
+
+.method public returnInt()I
+.registers 2
+ const v0, 42
+ return v0
+.end method
diff --git a/test/425-invoke-super/src/Main.java b/test/425-invoke-super/src/Main.java
new file mode 100644
index 0000000000..f3166fd35b
--- /dev/null
+++ b/test/425-invoke-super/src/Main.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Method;
+
+public class Main {
+ static class A {
+ public int foo() { return 1; }
+ }
+
+ static class B extends A {
+ public int $opt$bar() { return super.foo(); }
+ }
+
+ static class C extends B {
+ public int foo() { return 42; }
+ }
+
+ static class D extends C {
+ }
+
+ static void assertEquals(int expected, int value) {
+ if (expected != value) {
+ throw new Error("Expected " + expected + ", got " + value);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ // Workaround for b/18051191.
+ System.out.println("Test started");
+ assertEquals(1, new B().$opt$bar());
+ assertEquals(1, new C().$opt$bar());
+ assertEquals(1, new D().$opt$bar());
+
+ Class<?> c = Class.forName("InvokeSuper");
+ Method m = c.getMethod("run");
+ assertEquals(42, ((Integer)m.invoke(c.newInstance(), new Object[0])).intValue());
+
+ c = Class.forName("SubClass");
+ assertEquals(42, ((Integer)m.invoke(c.newInstance(), new Object[0])).intValue());
+ }
+}
diff --git a/test/426-monitor/expected.txt b/test/426-monitor/expected.txt
new file mode 100644
index 0000000000..2ffeff4be3
--- /dev/null
+++ b/test/426-monitor/expected.txt
@@ -0,0 +1,5 @@
+In static method
+In instance method
+In synchronized block
+In second instance method
+In second static method
diff --git a/test/426-monitor/info.txt b/test/426-monitor/info.txt
new file mode 100644
index 0000000000..1b093ea44e
--- /dev/null
+++ b/test/426-monitor/info.txt
@@ -0,0 +1 @@
+Simple tests for monitorenter/monitorexit.
diff --git a/test/426-monitor/src/Main.java b/test/426-monitor/src/Main.java
new file mode 100644
index 0000000000..a073a95918
--- /dev/null
+++ b/test/426-monitor/src/Main.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ $opt$StaticSynchronizedMethod();
+ new Main().$opt$InstanceSynchronizedMethod();
+ $opt$SynchronizedBlock();
+ new Main().$opt$DoubleInstanceSynchronized();
+ $opt$DoubleStaticSynchronized();
+ }
+
+ public static synchronized void $opt$StaticSynchronizedMethod() {
+ System.out.println("In static method");
+ }
+
+ public synchronized void $opt$InstanceSynchronizedMethod() {
+ System.out.println("In instance method");
+ }
+
+ public static void $opt$SynchronizedBlock() {
+ Object o = new Object();
+ synchronized(o) {
+ System.out.println("In synchronized block");
+ }
+ }
+
+ public synchronized void $opt$DoubleInstanceSynchronized() {
+ synchronized (this) {
+ System.out.println("In second instance method");
+ }
+ }
+
+ public synchronized static void $opt$DoubleStaticSynchronized() {
+ synchronized (Main.class) {
+ System.out.println("In second static method");
+ }
+ }
+}
diff --git a/test/427-bitwise/expected.txt b/test/427-bitwise/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/427-bitwise/expected.txt
diff --git a/test/427-bitwise/info.txt b/test/427-bitwise/info.txt
new file mode 100644
index 0000000000..47628479c7
--- /dev/null
+++ b/test/427-bitwise/info.txt
@@ -0,0 +1 @@
+Tests for the and/or/xor opcodes.
diff --git a/test/427-bitwise/src/Main.java b/test/427-bitwise/src/Main.java
new file mode 100644
index 0000000000..e9840669dd
--- /dev/null
+++ b/test/427-bitwise/src/Main.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Note that $opt$ is a marker for the optimizing compiler to ensure
+// it does compile the method.
+public class Main {
+
+ public static void expectEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void expectEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void main(String[] args) {
+ andInt();
+ andLong();
+
+ orInt();
+ orLong();
+
+ xorInt();
+ xorLong();
+ }
+
+ private static void andInt() {
+ expectEquals(1, $opt$And(5, 3));
+ expectEquals(0, $opt$And(0, 0));
+ expectEquals(0, $opt$And(0, 3));
+ expectEquals(0, $opt$And(3, 0));
+ expectEquals(1, $opt$And(1, -3));
+ expectEquals(-12, $opt$And(-12, -3));
+
+ expectEquals(1, $opt$AndLit8(1));
+ expectEquals(0, $opt$AndLit8(0));
+ expectEquals(0, $opt$AndLit8(0));
+ expectEquals(3, $opt$AndLit8(3));
+ expectEquals(4, $opt$AndLit8(-12));
+
+ expectEquals(0, $opt$AndLit16(1));
+ expectEquals(0, $opt$AndLit16(0));
+ expectEquals(0, $opt$AndLit16(0));
+ expectEquals(0, $opt$AndLit16(3));
+ expectEquals(65280, $opt$AndLit16(-12));
+ }
+
+ private static void andLong() {
+ expectEquals(1L, $opt$And(5L, 3L));
+ expectEquals(0L, $opt$And(0L, 0L));
+ expectEquals(0L, $opt$And(0L, 3L));
+ expectEquals(0L, $opt$And(3L, 0L));
+ expectEquals(1L, $opt$And(1L, -3L));
+ expectEquals(-12L, $opt$And(-12L, -3L));
+
+ expectEquals(1L, $opt$AndLit8(1L));
+ expectEquals(0L, $opt$AndLit8(0L));
+ expectEquals(0L, $opt$AndLit8(0L));
+ expectEquals(3L, $opt$AndLit8(3L));
+ expectEquals(4L, $opt$AndLit8(-12L));
+
+ expectEquals(0L, $opt$AndLit16(1L));
+ expectEquals(0L, $opt$AndLit16(0L));
+ expectEquals(0L, $opt$AndLit16(0L));
+ expectEquals(0L, $opt$AndLit16(3L));
+ expectEquals(65280L, $opt$AndLit16(-12L));
+ }
+
+ static int $opt$And(int a, int b) {
+ return a & b;
+ }
+
+ static int $opt$AndLit8(int a) {
+ return a & 0xF;
+ }
+
+ static int $opt$AndLit16(int a) {
+ return a & 0xFF00;
+ }
+
+ static long $opt$And(long a, long b) {
+ return a & b;
+ }
+
+ static long $opt$AndLit8(long a) {
+ return a & 0xF;
+ }
+
+ static long $opt$AndLit16(long a) {
+ return a & 0xFF00;
+ }
+
+ private static void orInt() {
+ expectEquals(7, $opt$Or(5, 3));
+ expectEquals(0, $opt$Or(0, 0));
+ expectEquals(3, $opt$Or(0, 3));
+ expectEquals(3, $opt$Or(3, 0));
+ expectEquals(-3, $opt$Or(1, -3));
+ expectEquals(-3, $opt$Or(-12, -3));
+
+ expectEquals(15, $opt$OrLit8(1));
+ expectEquals(15, $opt$OrLit8(0));
+ expectEquals(15, $opt$OrLit8(3));
+ expectEquals(-1, $opt$OrLit8(-12));
+
+ expectEquals(0xFF01, $opt$OrLit16(1));
+ expectEquals(0xFF00, $opt$OrLit16(0));
+ expectEquals(0xFF03, $opt$OrLit16(3));
+ expectEquals(-12, $opt$OrLit16(-12));
+ }
+
+ private static void orLong() {
+ expectEquals(7L, $opt$Or(5L, 3L));
+ expectEquals(0L, $opt$Or(0L, 0L));
+ expectEquals(3L, $opt$Or(0L, 3L));
+ expectEquals(3L, $opt$Or(3L, 0L));
+ expectEquals(-3L, $opt$Or(1L, -3L));
+ expectEquals(-3L, $opt$Or(-12L, -3L));
+
+ expectEquals(15L, $opt$OrLit8(1L));
+ expectEquals(15L, $opt$OrLit8(0L));
+ expectEquals(15L, $opt$OrLit8(3L));
+ expectEquals(-1L, $opt$OrLit8(-12L));
+
+ expectEquals(0xFF01L, $opt$OrLit16(1L));
+ expectEquals(0xFF00L, $opt$OrLit16(0L));
+ expectEquals(0xFF03L, $opt$OrLit16(3L));
+ expectEquals(-12L, $opt$OrLit16(-12L));
+ }
+
+ static int $opt$Or(int a, int b) {
+ return a | b;
+ }
+
+ static int $opt$OrLit8(int a) {
+ return a | 0xF;
+ }
+
+ static int $opt$OrLit16(int a) {
+ return a | 0xFF00;
+ }
+
+ static long $opt$Or(long a, long b) {
+ return a | b;
+ }
+
+ static long $opt$OrLit8(long a) {
+ return a | 0xF;
+ }
+
+ static long $opt$OrLit16(long a) {
+ return a | 0xFF00;
+ }
+
+ private static void xorInt() {
+ expectEquals(6, $opt$Xor(5, 3));
+ expectEquals(0, $opt$Xor(0, 0));
+ expectEquals(3, $opt$Xor(0, 3));
+ expectEquals(3, $opt$Xor(3, 0));
+ expectEquals(-4, $opt$Xor(1, -3));
+ expectEquals(9, $opt$Xor(-12, -3));
+
+ expectEquals(14, $opt$XorLit8(1));
+ expectEquals(15, $opt$XorLit8(0));
+ expectEquals(12, $opt$XorLit8(3));
+ expectEquals(-5, $opt$XorLit8(-12));
+
+ expectEquals(0xFF01, $opt$XorLit16(1));
+ expectEquals(0xFF00, $opt$XorLit16(0));
+ expectEquals(0xFF03, $opt$XorLit16(3));
+ expectEquals(-0xFF0c, $opt$XorLit16(-12));
+ }
+
+ private static void xorLong() {
+ expectEquals(6L, $opt$Xor(5L, 3L));
+ expectEquals(0L, $opt$Xor(0L, 0L));
+ expectEquals(3L, $opt$Xor(0L, 3L));
+ expectEquals(3L, $opt$Xor(3L, 0L));
+ expectEquals(-4L, $opt$Xor(1L, -3L));
+ expectEquals(9L, $opt$Xor(-12L, -3L));
+
+ expectEquals(14L, $opt$XorLit8(1L));
+ expectEquals(15L, $opt$XorLit8(0L));
+ expectEquals(12L, $opt$XorLit8(3L));
+ expectEquals(-5L, $opt$XorLit8(-12L));
+
+ expectEquals(0xFF01L, $opt$XorLit16(1L));
+ expectEquals(0xFF00L, $opt$XorLit16(0L));
+ expectEquals(0xFF03L, $opt$XorLit16(3L));
+ expectEquals(-0xFF0cL, $opt$XorLit16(-12L));
+ }
+
+ static int $opt$Xor(int a, int b) {
+ return a ^ b;
+ }
+
+ static int $opt$XorLit8(int a) {
+ return a ^ 0xF;
+ }
+
+ static int $opt$XorLit16(int a) {
+ return a ^ 0xFF00;
+ }
+
+ static long $opt$Xor(long a, long b) {
+ return a ^ b;
+ }
+
+ static long $opt$XorLit8(long a) {
+ return a ^ 0xF;
+ }
+
+ static long $opt$XorLit16(long a) {
+ return a ^ 0xFF00;
+ }
+}
diff --git a/test/427-bounds/expected.txt b/test/427-bounds/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/427-bounds/expected.txt
diff --git a/test/427-bounds/info.txt b/test/427-bounds/info.txt
new file mode 100644
index 0000000000..8b8b95778e
--- /dev/null
+++ b/test/427-bounds/info.txt
@@ -0,0 +1,2 @@
+Regression test for the optimizing compiler that used to incorrectly pass
+index and/or length to the pThrowArrayBounds entrypoint.
diff --git a/test/427-bounds/src/Main.java b/test/427-bounds/src/Main.java
new file mode 100644
index 0000000000..a2d84d23ca
--- /dev/null
+++ b/test/427-bounds/src/Main.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ Exception exception = null;
+ try {
+ $opt$Throw(new int[1]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ exception = e;
+ }
+
+ String exceptionMessage = exception.getMessage();
+
+ // Note that it's ART specific to emit the length.
+ if (exceptionMessage.contains("length")) {
+ if (!exceptionMessage.contains("length=1")) {
+ throw new Error("Wrong length in exception message");
+ }
+ }
+
+ // Note that it's ART specific to emit the index.
+ if (exceptionMessage.contains("index")) {
+ if (!exceptionMessage.contains("index=2")) {
+ throw new Error("Wrong index in exception message");
+ }
+ }
+ }
+
+ static void $opt$Throw(int[] array) {
+ // We fetch the length first, to ensure it is in EAX (on x86).
+ // The pThrowArrayBounds entrypoint expects the index in EAX and the
+ // length in ECX, and the optimizing compiler used to write to EAX
+ // before putting the length in ECX.
+ int length = array.length;
+ array[2] = 42;
+ }
+}
diff --git a/test/428-optimizing-arith-rem/expected.txt b/test/428-optimizing-arith-rem/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/428-optimizing-arith-rem/expected.txt
diff --git a/test/428-optimizing-arith-rem/info.txt b/test/428-optimizing-arith-rem/info.txt
new file mode 100644
index 0000000000..3e37ffeee8
--- /dev/null
+++ b/test/428-optimizing-arith-rem/info.txt
@@ -0,0 +1 @@
+Tests for modulo (rem) operation.
diff --git a/test/428-optimizing-arith-rem/src/Main.java b/test/428-optimizing-arith-rem/src/Main.java
new file mode 100644
index 0000000000..46bd3c6ac5
--- /dev/null
+++ b/test/428-optimizing-arith-rem/src/Main.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+
+ public static void expectEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void expectEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void expectDivisionByZero(int value) {
+ try {
+ $opt$Rem(value, 0);
+ throw new Error("Expected RuntimeException when modulo by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ try {
+ $opt$RemZero(value);
+ throw new Error("Expected RuntimeException when modulo by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ }
+
+ public static void expectDivisionByZero(long value) {
+ try {
+ $opt$Rem(value, 0L);
+ throw new Error("Expected RuntimeException when modulo by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ try {
+ $opt$RemZero(value);
+ throw new Error("Expected RuntimeException when modulo by 0");
+ } catch (java.lang.RuntimeException e) {
+ }
+ }
+
+ public static void main(String[] args) {
+ rem();
+ }
+
+ public static void rem() {
+ remInt();
+ remLong();
+ }
+
+ private static void remInt() {
+ expectEquals(2, $opt$RemConst(6));
+ expectEquals(2, $opt$Rem(6, 4));
+ expectEquals(2, $opt$Rem(6, -4));
+ expectEquals(0, $opt$Rem(6, 3));
+ expectEquals(0, $opt$Rem(6, -3));
+ expectEquals(0, $opt$Rem(6, 1));
+ expectEquals(0, $opt$Rem(6, -1));
+ expectEquals(-1, $opt$Rem(-7, 3));
+ expectEquals(-1, $opt$Rem(-7, -3));
+ expectEquals(0, $opt$Rem(6, 6));
+ expectEquals(0, $opt$Rem(-6, -6));
+ expectEquals(7, $opt$Rem(7, 9));
+ expectEquals(7, $opt$Rem(7, -9));
+ expectEquals(-7, $opt$Rem(-7, 9));
+ expectEquals(-7, $opt$Rem(-7, -9));
+
+ expectEquals(0, $opt$Rem(Integer.MAX_VALUE, 1));
+ expectEquals(0, $opt$Rem(Integer.MAX_VALUE, -1));
+ expectEquals(0, $opt$Rem(Integer.MIN_VALUE, 1));
+ expectEquals(0, $opt$Rem(Integer.MIN_VALUE, -1)); // no overflow
+ expectEquals(-1, $opt$Rem(Integer.MIN_VALUE, Integer.MAX_VALUE));
+ expectEquals(Integer.MAX_VALUE, $opt$Rem(Integer.MAX_VALUE, Integer.MIN_VALUE));
+
+ expectEquals(0, $opt$Rem(0, 7));
+ expectEquals(0, $opt$Rem(0, Integer.MAX_VALUE));
+ expectEquals(0, $opt$Rem(0, Integer.MIN_VALUE));
+
+ expectDivisionByZero(0);
+ expectDivisionByZero(1);
+ expectDivisionByZero(5);
+ expectDivisionByZero(Integer.MAX_VALUE);
+ expectDivisionByZero(Integer.MIN_VALUE);
+ }
+
+ private static void remLong() {
+ expectEquals(2L, $opt$RemConst(6L));
+ expectEquals(2L, $opt$Rem(6L, 4L));
+ expectEquals(2L, $opt$Rem(6L, -4L));
+ expectEquals(0L, $opt$Rem(6L, 3L));
+ expectEquals(0L, $opt$Rem(6L, -3L));
+ expectEquals(0L, $opt$Rem(6L, 1L));
+ expectEquals(0L, $opt$Rem(6L, -1L));
+ expectEquals(-1L, $opt$Rem(-7L, 3L));
+ expectEquals(-1L, $opt$Rem(-7L, -3L));
+ expectEquals(0L, $opt$Rem(6L, 6L));
+ expectEquals(0L, $opt$Rem(-6L, -6L));
+ expectEquals(7L, $opt$Rem(7L, 9L));
+ expectEquals(7L, $opt$Rem(7L, -9L));
+ expectEquals(-7L, $opt$Rem(-7L, 9L));
+ expectEquals(-7L, $opt$Rem(-7L, -9L));
+
+ expectEquals(0L, $opt$Rem(Integer.MAX_VALUE, 1L));
+ expectEquals(0L, $opt$Rem(Integer.MAX_VALUE, -1L));
+ expectEquals(0L, $opt$Rem(Integer.MIN_VALUE, 1L));
+ expectEquals(0L, $opt$Rem(Integer.MIN_VALUE, -1L)); // no overflow
+ expectEquals(-1L, $opt$Rem(Integer.MIN_VALUE, Integer.MAX_VALUE));
+ expectEquals(Integer.MAX_VALUE, $opt$Rem(Integer.MAX_VALUE, Integer.MIN_VALUE));
+
+ expectEquals(0L, $opt$Rem(0L, 7L));
+ expectEquals(0L, $opt$Rem(0L, Integer.MAX_VALUE));
+ expectEquals(0L, $opt$Rem(0L, Integer.MIN_VALUE));
+
+ expectDivisionByZero(0L);
+ expectDivisionByZero(1L);
+ expectDivisionByZero(5L);
+ expectDivisionByZero(Integer.MAX_VALUE);
+ expectDivisionByZero(Integer.MIN_VALUE);
+ }
+
+ static int $opt$Rem(int a, int b) {
+ return a % b;
+ }
+
+ static int $opt$RemZero(int a) {
+ return a % 0;
+ }
+
+ // Modulo by literals != 0 should not generate checks.
+ static int $opt$RemConst(int a) {
+ return a % 4;
+ }
+
+ static long $opt$RemConst(long a) {
+ return a % 4L;
+ }
+
+ static long $opt$Rem(long a, long b) {
+ return a % b;
+ }
+
+ static long $opt$RemZero(long a) {
+ return a % 0L;
+ }
+}
diff --git a/test/703-floating-point-div/expected.txt b/test/703-floating-point-div/expected.txt
new file mode 100644
index 0000000000..76f5a5a5aa
--- /dev/null
+++ b/test/703-floating-point-div/expected.txt
@@ -0,0 +1 @@
+Done!
diff --git a/test/703-floating-point-div/info.txt b/test/703-floating-point-div/info.txt
new file mode 100644
index 0000000000..418b831350
--- /dev/null
+++ b/test/703-floating-point-div/info.txt
@@ -0,0 +1 @@
+Simple tests to check floating point division.
diff --git a/test/703-floating-point-div/src/Main.java b/test/703-floating-point-div/src/Main.java
new file mode 100644
index 0000000000..9990a545f4
--- /dev/null
+++ b/test/703-floating-point-div/src/Main.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+
+ static double dPi = Math.PI;
+ static float fPi = (float)Math.PI;
+
+ public static void expectEquals(long expected, long result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void expectEquals(int expected, int result) {
+ if (expected != result) {
+ throw new Error("Expected: " + expected + ", found: " + result);
+ }
+ }
+
+ public static void divDoubleTest() {
+ double d1 = 0x1.0p1023;
+ double d2 = -2.0;
+ double d3 = 0.0;
+ double d4 = Double.MIN_NORMAL;
+ double d5 = Double.POSITIVE_INFINITY;
+ double d6 = Double.NEGATIVE_INFINITY;
+ double d7 = -0.0;
+ double d8 = Double.MAX_VALUE;
+ double d9 = Double.MIN_VALUE;
+ double d0 = Double.NaN;
+
+ expectEquals(Double.doubleToRawLongBits(dPi/d1), 0x1921fb54442d18L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d2), 0xbff921fb54442d18L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d3), 0x7ff0000000000000L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d4), 0x7fe921fb54442d18L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d5), 0x0L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d6), 0x8000000000000000L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d7), 0xfff0000000000000L);
+
+ expectEquals(Double.doubleToRawLongBits(dPi/d8), 0xc90fdaa22168cL);
+ expectEquals(Double.doubleToRawLongBits(dPi/d9), 0x7ff0000000000000L);
+ expectEquals(Double.doubleToRawLongBits(dPi/d0), 0x7ff8000000000000L);
+ }
+
+ public static void divFloatTest() {
+ float f1 = 0x1.0p127f;
+ float f2 = -2.0f;
+ float f3 = 0.0f;
+ float f4 = Float.MIN_NORMAL;
+ float f5 = Float.POSITIVE_INFINITY;
+ float f6 = Float.NEGATIVE_INFINITY;
+ float f7 = -0.0f;
+ float f8 = Float.MAX_VALUE;
+ float f9 = Float.MIN_VALUE;
+ float f0 = Float.NaN;
+
+ expectEquals(Float.floatToRawIntBits(fPi/f1), 0xc90fdb);
+ expectEquals(Float.floatToRawIntBits(fPi/f2), 0xbfc90fdb);
+ expectEquals(Float.floatToRawIntBits(fPi/f3), 0x7f800000);
+ expectEquals(Float.floatToRawIntBits(fPi/f4), 0x7f490fdb);
+ expectEquals(Float.floatToRawIntBits(fPi/f5), 0x0);
+ expectEquals(Float.floatToRawIntBits(fPi/f6), 0x80000000);
+ expectEquals(Float.floatToRawIntBits(fPi/f7), 0xff800000);
+
+ expectEquals(Float.floatToRawIntBits(fPi/f8), 0x6487ee);
+ expectEquals(Float.floatToRawIntBits(fPi/f9), 0x7f800000);
+ expectEquals(Float.floatToRawIntBits(fPi/f0), 0x7fc00000);
+ }
+
+ public static void main(String[] args) {
+ divDoubleTest();
+ divFloatTest();
+ System.out.println("Done!");
+ }
+
+}
diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt
index 4002fbf7a5..1b813bf0c8 100644
--- a/test/800-smali/expected.txt
+++ b/test/800-smali/expected.txt
@@ -1,3 +1,6 @@
b/17790197
+b/17978759
FloatBadArgReg
+negLong
+sameFieldNames
Done!
diff --git a/test/800-smali/smali/b_17978759.smali b/test/800-smali/smali/b_17978759.smali
new file mode 100644
index 0000000000..07bcae5bb4
--- /dev/null
+++ b/test/800-smali/smali/b_17978759.smali
@@ -0,0 +1,28 @@
+.class public LB17978759;
+.super Ljava/lang/Object;
+
+ .method public constructor <init>()V
+ .registers 1
+ invoke-direct {p0}, Ljava/lang/Object;-><init>()V
+ return-void
+ .end method
+
+ .method public test()V
+ .registers 2
+
+ move-object v0, p0
+ # v0 and p0 alias
+ monitor-enter p0
+ # monitor-enter on p0
+ monitor-exit v0
+ # monitor-exit on v0, however, verifier doesn't track this and so this is
+ # a warning. Verifier will still think p0 is locked.
+
+ move-object v0, p0
+ # v0 will now appear locked.
+ monitor-enter v0
+ # Attempt to lock v0 twice is a verifier failure.
+ monitor-exit v0
+
+ return-void
+ .end method
diff --git a/test/800-smali/smali/negLong.smali b/test/800-smali/smali/negLong.smali
new file mode 100755
index 0000000000..29d416e066
--- /dev/null
+++ b/test/800-smali/smali/negLong.smali
@@ -0,0 +1,186 @@
+.class public LnegLong;
+.super Ljava/lang/Object;
+.source "negLong.java"
+# static fields
+.field public static final N:I = 0x64
+.field public static i:I
+# direct methods
+.method static constructor <clinit>()V
+ .registers 1
+ .prologue
+ .line 5
+ const/16 v0, 0x44da
+ sput v0, LnegLong;->i:I
+ return-void
+.end method
+.method public constructor <init>()V
+ .registers 1
+ .prologue
+ .line 1
+ invoke-direct {p0}, Ljava/lang/Object;-><init>()V
+ return-void
+.end method
+.method public static checkSum1([S)J
+ .registers 7
+ .prologue
+ .line 14
+ array-length v3, p0
+ .line 15
+ const-wide/16 v0, 0x0
+ .line 16
+ const/4 v2, 0x0
+ :goto_4
+ if-ge v2, v3, :cond_d
+ .line 17
+ aget-short v4, p0, v2
+ int-to-long v4, v4
+ add-long/2addr v0, v4
+ .line 16
+ add-int/lit8 v2, v2, 0x1
+ goto :goto_4
+ .line 18
+ :cond_d
+ return-wide v0
+.end method
+.method public static init1([SS)V
+ .registers 4
+ .prologue
+ .line 8
+ array-length v1, p0
+ .line 9
+ const/4 v0, 0x0
+ :goto_2
+ if-ge v0, v1, :cond_9
+ .line 10
+ aput-short p1, p0, v0
+ .line 9
+ add-int/lit8 v0, v0, 0x1
+ goto :goto_2
+ .line 11
+ :cond_9
+ return-void
+.end method
+.method public static main([Ljava/lang/String;)V
+ .registers 6
+ .prologue
+ .line 50
+ invoke-static {}, LnegLong;->negLong()J
+ move-result-wide v0
+ .line 51
+ sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
+ new-instance v3, Ljava/lang/StringBuilder;
+ invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
+ const-string v4, "nbp ztw p = "
+ invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
+ move-result-object v3
+ invoke-virtual {v3, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
+ move-result-object v0
+ invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
+ move-result-object v0
+ invoke-virtual {v2, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
+ .line 52
+ return-void
+.end method
+.method public static negLong()J
+ .registers 17
+ .prologue
+ .line 23
+ const-wide v1, -0x4c4a1f4aa9b1db83L
+ .line 24
+ const v7, -0x3f727efa
+ .line 25
+ const/16 v4, -0x284b
+ const v3, 0xdc01
+ .line 26
+ const/16 v0, 0x64
+ new-array v8, v0, [S
+ .line 28
+ const/16 v0, 0x1c60
+ invoke-static {v8, v0}, LnegLong;->init1([SS)V
+ .line 29
+ const/4 v0, 0x2
+ move v6, v0
+ :goto_18
+ const/16 v0, 0x56
+ if-ge v6, v0, :cond_64
+ .line 30
+ const/4 v0, 0x1
+ move v5, v0
+ move v0, v3
+ move-wide v15, v1
+ move-wide v2, v15
+ :goto_21
+ if-ge v5, v6, :cond_5d
+ .line 31
+ int-to-float v0, v4
+ neg-float v1, v7
+ add-float/2addr v0, v1
+ float-to-int v1, v0
+ .line 32
+ const/4 v0, 0x1
+ move v4, v1
+ move-wide v15, v2
+ move-wide v1, v15
+ .line 33
+ :goto_2b
+ add-int/lit8 v3, v0, 0x1
+ const/16 v0, 0x1b
+ if-ge v3, v0, :cond_3a
+ .line 35
+ int-to-long v9, v5
+ mul-long v0, v9, v1
+ neg-long v1, v0
+ .line 38
+ sget v0, LnegLong;->i:I
+ move v4, v0
+ move v0, v3
+ goto :goto_2b
+ .line 40
+ :cond_3a
+ aget-short v0, v8, v6
+ int-to-double v9, v0
+ long-to-double v11, v1
+ const-wide v13, 0x403f9851eb851eb8L
+ sub-double/2addr v11, v13
+ add-double/2addr v9, v11
+ double-to-int v0, v9
+ int-to-short v0, v0
+ aput-short v0, v8, v6
+ .line 41
+ const/4 v0, 0x2
+ :goto_4a
+ const/16 v9, 0x43
+ if-ge v0, v9, :cond_56
+ .line 42
+ neg-long v9, v1
+ const-wide/16 v11, 0x1
+ or-long/2addr v9, v11
+ add-long/2addr v1, v9
+ .line 41
+ add-int/lit8 v0, v0, 0x1
+ goto :goto_4a
+ .line 30
+ :cond_56
+ add-int/lit8 v0, v5, 0x1
+ move v5, v0
+ move v0, v3
+ move-wide v15, v1
+ move-wide v2, v15
+ goto :goto_21
+ .line 29
+ :cond_5d
+ add-int/lit8 v1, v6, 0x1
+ move v6, v1
+ move-wide v15, v2
+ move-wide v1, v15
+ move v3, v0
+ goto :goto_18
+ .line 45
+ :cond_64
+ invoke-static {v8}, LnegLong;->checkSum1([S)J
+ move-result-wide v0
+ int-to-long v2, v3
+ add-long/2addr v0, v2
+ .line 46
+ return-wide v0
+.end method
diff --git a/test/800-smali/smali/sameFieldNames.smali b/test/800-smali/smali/sameFieldNames.smali
new file mode 100644
index 0000000000..107161b538
--- /dev/null
+++ b/test/800-smali/smali/sameFieldNames.smali
@@ -0,0 +1,64 @@
+.class public LsameFieldNames;
+.super Ljava/lang/Object;
+
+# Test multiple fields with the same name and different types.
+# (Invalid in Java language but valid in bytecode.)
+.field static public a:D
+.field static public a:S
+.field static public a:J
+.field static public a:F
+.field static public a:Z
+.field static public a:I
+.field static public a:B
+.field static public a:C
+.field static public a:Ljava/lang/Integer;
+.field static public a:Ljava/lang/Long;
+.field static public a:Ljava/lang/Float;
+.field static public a:Ljava/lang/Double;
+.field static public a:Ljava/lang/Boolean;
+.field static public a:Ljava/lang/Void;
+.field static public a:Ljava/lang/Short;
+.field static public a:Ljava/lang/Char;
+.field static public a:Ljava/lang/Byte;
+
+# Add some more fields to stress test the sorting for offset assignment.
+.field static public b:C
+.field static public c:J
+.field static public d:C
+.field static public e:B
+.field static public f:C
+.field static public g:J
+.field static public h:C
+.field static public i:J
+.field static public j:I
+.field static public k:J
+.field static public l:J
+.field static public m:I
+.field static public n:J
+.field static public o:I
+.field static public p:Ljava/lang/Integer;
+.field static public q:I
+.field static public r:J
+.field static public s:I
+.field static public t:Ljava/lang/Integer;
+.field static public u:I
+.field static public v:J
+.field static public w:I
+.field static public x:Ljava/lang/Integer;
+.field static public y:I
+.field static public z:Ljava/lang/Integer;
+
+.method public static getInt()I
+ .locals 2
+ const/4 v0, 2
+ sput v0, LsameFieldNames;->a:I
+ sget-object v1, LsameFieldNames;->a:Ljava/lang/Integer;
+ const/4 v1, 0
+ if-nez v1, :fail
+ const/4 v0, 7
+ :ret
+ return v0
+ :fail
+ const/4 v0, 0
+ goto :ret
+.end method
diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java
index c86470ce67..3a0f8eaee6 100644
--- a/test/800-smali/src/Main.java
+++ b/test/800-smali/src/Main.java
@@ -15,6 +15,7 @@
*/
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.LinkedList;
import java.util.List;
@@ -49,8 +50,11 @@ public class Main {
testCases = new LinkedList<TestCase>();
testCases.add(new TestCase("b/17790197", "B17790197", "getInt", null, null, 100));
+ testCases.add(new TestCase("b/17978759", "B17978759", "test", null, new VerifyError(), null));
testCases.add(new TestCase("FloatBadArgReg", "FloatBadArgReg", "getInt",
new Object[]{100}, null, 100));
+ testCases.add(new TestCase("negLong", "negLong", "negLong", null, null, 122142L));
+ testCases.add(new TestCase("sameFieldNames", "sameFieldNames", "getInt", null, null, 7));
}
public void runTests() {
@@ -65,47 +69,59 @@ public class Main {
}
private void runTest(TestCase tc) throws Exception {
- Class<?> c = Class.forName(tc.testClass);
-
- Method[] methods = c.getDeclaredMethods();
-
- // For simplicity we assume that test methods are not overloaded. So searching by name
- // will give us the method we need to run.
- Method method = null;
- for (Method m : methods) {
- if (m.getName().equals(tc.testMethodName)) {
- method = m;
- break;
- }
- }
-
- if (method == null) {
- throw new IllegalArgumentException("Could not find test method " + tc.testMethodName +
- " in class " + tc.testClass + " for test " + tc.testName);
- }
-
Exception errorReturn = null;
try {
- Object retValue = method.invoke(null, tc.values);
- if (tc.expectedException != null) {
- errorReturn = new IllegalStateException("Expected an exception in test " +
- tc.testName);
+ Class<?> c = Class.forName(tc.testClass);
+
+ Method[] methods = c.getDeclaredMethods();
+
+ // For simplicity we assume that test methods are not overloaded. So searching by name
+ // will give us the method we need to run.
+ Method method = null;
+ for (Method m : methods) {
+ if (m.getName().equals(tc.testMethodName)) {
+ method = m;
+ break;
+ }
}
- if (tc.expectedReturn == null && retValue != null) {
- errorReturn = new IllegalStateException("Expected a null result in test " +
- tc.testName);
- } else if (tc.expectedReturn != null &&
- (retValue == null || !tc.expectedReturn.equals(retValue))) {
- errorReturn = new IllegalStateException("Expected return " + tc.expectedReturn +
- ", but got " + retValue);
+
+ if (method == null) {
+ errorReturn = new IllegalArgumentException("Could not find test method " +
+ tc.testMethodName + " in class " +
+ tc.testClass + " for test " +
+ tc.testName);
+ } else {
+ Object retValue;
+ if (Modifier.isStatic(method.getModifiers())) {
+ retValue = method.invoke(null, tc.values);
+ } else {
+ retValue = method.invoke(method.getDeclaringClass().newInstance(), tc.values);
+ }
+ if (tc.expectedException != null) {
+ errorReturn = new IllegalStateException("Expected an exception in test " +
+ tc.testName);
+ }
+ if (tc.expectedReturn == null && retValue != null) {
+ errorReturn = new IllegalStateException("Expected a null result in test " +
+ tc.testName);
+ } else if (tc.expectedReturn != null &&
+ (retValue == null || !tc.expectedReturn.equals(retValue))) {
+ errorReturn = new IllegalStateException("Expected return " +
+ tc.expectedReturn +
+ ", but got " + retValue);
+ } else {
+ // Expected result, do nothing.
+ }
}
- } catch (Exception exc) {
+ } catch (Throwable exc) {
if (tc.expectedException == null) {
errorReturn = new IllegalStateException("Did not expect exception", exc);
} else if (!tc.expectedException.getClass().equals(exc.getClass())) {
errorReturn = new IllegalStateException("Expected " +
- tc.expectedException.getClass().getName() +
- ", but got " + exc.getClass(), exc);
+ tc.expectedException.getClass().getName() +
+ ", but got " + exc.getClass(), exc);
+ } else {
+ // Expected exception, do nothing.
}
} finally {
if (errorReturn != null) {
diff --git a/test/Android.libarttest.mk b/test/Android.libarttest.mk
index 55de1f3f35..c9c04757ba 100644
--- a/test/Android.libarttest.mk
+++ b/test/Android.libarttest.mk
@@ -24,6 +24,7 @@ LIBARTTEST_COMMON_SRC_FILES := \
004-ReferenceMap/stack_walk_refmap_jni.cc \
004-StackWalk/stack_walk_jni.cc \
004-UnsafeTest/unsafe_test.cc \
+ 051-thread/thread_test.cc \
116-nodex2oat/nodex2oat.cc \
117-nopatchoat/nopatchoat.cc \
118-noimage-dex2oat/noimage-dex2oat.cc
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 0efd71b5a1..0f58234a34 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -279,6 +279,7 @@ TEST_ART_BROKEN_NDEBUG_TESTS := \
004-SignalTest \
004-StackWalk \
004-UnsafeTest \
+ 051-thread \
115-native-bridge \
116-nodex2oat \
117-nopatchoat \
@@ -294,8 +295,7 @@ endif
TEST_ART_BROKEN_NDEBUG_TESTS :=
# Known broken tests for the default compiler (Quick).
-TEST_ART_BROKEN_DEFAULT_RUN_TESTS := \
- 412-new-array
+TEST_ART_BROKEN_DEFAULT_RUN_TESTS :=
ifneq (,$(filter default,$(COMPILER_TYPES)))
ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
@@ -307,35 +307,163 @@ TEST_ART_BROKEN_DEFAULT_RUN_TESTS :=
# Known broken tests for the arm64 optimizing compiler backend.
TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS := \
+ 001-HelloWorld \
+ 002-sleep \
003-omnibus-opcodes \
+ 004-InterfaceTest \
+ 004-JniTest \
+ 004-NativeAllocations \
+ 004-ReferenceMap \
+ 004-SignalTest \
+ 004-StackWalk \
+ 004-UnsafeTest \
+ 005-annotations \
006-args \
+ 007-count10 \
+ 008-exceptions \
+ 009-instanceof \
+ 010-instance \
011-array-copy \
+ 013-math2 \
+ 014-math3 \
+ 016-intern \
+ 017-float \
018-stack-overflow \
+ 019-wrong-array-type \
+ 020-string \
+ 021-string2 \
+ 022-interface \
+ 023-many-interfaces \
+ 024-illegal-access \
+ 025-access-controller \
+ 026-access \
+ 028-array-write \
+ 029-assert \
+ 030-bad-finalizer \
+ 031-class-attributes \
+ 032-concrete-sub \
+ 033-class-init-deadlock \
+ 034-call-null \
+ 035-enum \
036-finalizer \
+ 037-inherit \
+ 038-inner-null \
+ 039-join-main \
+ 040-miranda \
+ 042-new-instance \
+ 043-privates \
044-proxy \
+ 045-reflect-array \
+ 046-reflect \
+ 047-returns \
+ 049-show-object \
+ 050-sync-test \
+ 051-thread \
+ 052-verifier-fun \
+ 054-uncaught \
+ 055-enum-performance \
+ 056-const-string-jumbo \
+ 058-enum-order \
+ 061-out-of-memory \
+ 062-character-encodings \
+ 063-process-manager \
+ 064-field-access \
+ 065-mismatched-implements \
+ 066-mismatched-super \
+ 067-preemptive-unpark \
+ 068-classloader \
+ 069-field-type \
070-nio-buffer \
+ 071-dexfile \
072-precise-gc \
+ 074-gc-thrash \
+ 075-verification-error \
+ 076-boolean-put \
+ 077-method-override \
+ 078-polymorphic-virtual \
+ 079-phantom \
+ 080-oom-throw \
+ 081-hot-exceptions \
082-inline-execute \
083-compiler-regressions \
+ 084-class-init \
+ 085-old-style-inner-class \
+ 086-null-super \
+ 087-gc-after-link \
+ 088-monitor-verification \
+ 090-loop-formation \
+ 092-locale \
093-serialization \
+ 094-pattern \
096-array-copy-concurrent-gc \
+ 097-duplicate-method \
+ 098-ddmc \
100-reflect2 \
+ 101-fibonacci \
+ 102-concurrent-gc \
+ 103-string-append \
+ 104-growth-limit \
+ 105-invoke \
106-exceptions2 \
107-int-math2 \
+ 108-check-cast \
+ 109-suspend-check \
+ 110-field-access \
+ 111-unresolvable-exception \
+ 112-double-math \
+ 113-multidex \
+ 114-ParallelGC \
+ 117-nopatchoat \
+ 118-noimage-dex2oat \
+ 119-noimage-patchoat \
+ 120-hashcode \
121-modifiers \
+ 121-simple-suspend-check \
122-npe \
123-compiler-regressions-mt \
+ 124-missing-classes \
+ 125-gc-and-classloading \
+ 126-miranda-multidex \
+ 201-built-in-exception-detail-messages \
+ 202-thread-oome \
+ 300-package-override \
+ 301-abstract-protected \
+ 303-verification-stress \
+ 304-method-tracing \
+ 401-optimizing-compiler \
+ 402-optimizing-control-flow \
+ 403-optimizing-long \
+ 404-optimizing-allocator \
405-optimizing-long-allocator \
+ 406-fields \
407-arrays \
+ 409-materialized-condition \
410-floats \
411-optimizing-arith \
412-new-array \
413-regalloc-regression \
- 414-static-fields \
414-optimizing-arith-sub \
+ 414-static-fields \
415-optimizing-arith-neg \
+ 416-optimizing-arith-not \
417-optimizing-arith-div \
+ 418-const-string \
+ 419-long-parameter \
+ 420-const-class \
+ 421-exceptions \
+ 421-large-frame \
+ 422-instanceof \
+ 422-type-conversion \
+ 423-invoke-interface \
+ 424-checkcast \
+ 426-monitor \
+ 427-bitwise \
+ 427-bounds \
+ 428-optimizing-arith-rem \
700-LoadArgRegs \
+ 701-easy-div-rem \
+ 702-LargeBranchOffset \
+ 703-floating-point-div \
800-smali
ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
diff --git a/test/etc/default-build b/test/etc/default-build
index 3369dc653c..ab859ec9f4 100755
--- a/test/etc/default-build
+++ b/test/etc/default-build
@@ -49,4 +49,6 @@ if [ -d src-ex ]; then
fi
fi
-zip $TEST_NAME.jar classes.dex
+if [ ${NEED_DEX} = "true" ]; then
+ zip $TEST_NAME.jar classes.dex
+fi
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 39f28c877a..d2cd8ab995 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -35,10 +35,14 @@ PATCHOAT=""
PREBUILD="y"
QUIET="n"
RELOCATE="y"
+SECONDARY_DEX=""
+TIME_OUT="y"
+TIME_OUT_VALUE=5m
USE_GDB="n"
USE_JVM="n"
VERIFY="y"
ZYGOTE=""
+DEX_VERIFY=""
while true; do
if [ "x$1" = "x--quiet" ]; then
@@ -92,12 +96,17 @@ while true; do
elif [ "x$1" = "x--no-image" ]; then
HAVE_IMAGE="n"
shift
+ elif [ "x$1" = "x--secondary" ]; then
+ SECONDARY_DEX=":$DEX_LOCATION/$TEST_NAME-ex.jar"
+ shift
elif [ "x$1" = "x--debug" ]; then
DEBUGGER="y"
+ TIME_OUT="n"
shift
elif [ "x$1" = "x--gdb" ]; then
USE_GDB="y"
DEV_MODE="y"
+ TIME_OUT="n"
shift
elif [ "x$1" = "x--zygote" ]; then
ZYGOTE="-Xzygote"
@@ -176,7 +185,6 @@ if [ "$ZYGOTE" = "" ]; then
fi
if [ "$VERIFY" = "y" ]; then
- DEX_VERIFY=""
JVM_VERIFY_ARG="-Xverify:all"
msg "Performing verification"
else
@@ -234,7 +242,12 @@ fi
if [ "$INTERPRETER" = "y" ]; then
INT_OPTS="-Xint"
- COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=interpret-only"
+ if [ "$VERIFY" = "y" ] ; then
+ COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=interpret-only"
+ else
+ COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=verify-none"
+ DEX_VERIFY="${DEX_VERIFY} -Xverify:none"
+ fi
fi
JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
@@ -279,6 +292,7 @@ fi
dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \
$GDB_ARGS \
$FLAGS \
+ $DEX_VERIFY \
-XXlib:$LIB \
$PATCHOAT \
$DEX2OAT \
@@ -287,7 +301,7 @@ dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \
$INT_OPTS \
$DEBUGGER_OPTS \
$DALVIKVM_BOOT_OPT \
- -cp $DEX_LOCATION/$TEST_NAME.jar $MAIN"
+ -cp $DEX_LOCATION/$TEST_NAME.jar$SECONDARY_DEX $MAIN"
if [ "$HOST" = "n" ]; then
@@ -305,6 +319,14 @@ if [ "$HOST" = "n" ]; then
adb push $TEST_NAME-ex.jar $DEX_LOCATION >/dev/null 2>&1
fi
+ LD_LIBRARY_PATH=
+ if [ "$ANDROID_ROOT" != "/system" ]; then
+ # Current default installation is dalvikvm 64bits and dex2oat 32bits,
+ # so we can only use LD_LIBRARY_PATH when testing on a local
+ # installation.
+ LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY
+ fi
+
# Create a script with the command. The command can get longer than the longest
# allowed adb command and there is no way to get the exit status from a adb shell
# command.
@@ -312,7 +334,7 @@ if [ "$HOST" = "n" ]; then
export ANDROID_DATA=$DEX_LOCATION && \
export DEX_LOCATION=$DEX_LOCATION && \
export ANDROID_ROOT=$ANDROID_ROOT && \
- export LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY && \
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
$mkdir_cmdline && \
$dex2oat_cmdline && \
$dalvikvm_cmdline"
diff --git a/test/run-test b/test/run-test
index b43668d0e8..843714b949 100755
--- a/test/run-test
+++ b/test/run-test
@@ -501,6 +501,8 @@ if ! ulimit -S "$file_size_limit"; then
fi
good="no"
+good_build="yes"
+good_run="yes"
if [ "$dev_mode" = "yes" ]; then
"./${build}" 2>&1
build_exit="$?"
@@ -548,7 +550,15 @@ else
if [ "$build_exit" = '0' ]; then
echo "${test_dir}: running..." 1>&2
"./${run}" $run_args "$@" >"$output" 2>&1
+ run_exit="$?"
+ if [ "$run_exit" != "0" ]; then
+ echo "run exit status: $run_exit" 1>&2
+ good_run="no"
+ else
+ good_run="yes"
+ fi
else
+ good_build="no"
cp "$build_output" "$output"
echo "Failed to build in tmpdir=${tmp_dir} from oldwd=${oldwd} and cwd=`pwd`" >> "$output"
echo "Non-canonical tmpdir was ${noncanonical_tmp_dir}" >> "$output"
@@ -561,9 +571,11 @@ else
fi
./$check_cmd "$expected" "$output"
if [ "$?" = "0" ]; then
- # output == expected
- good="yes"
- echo "${test_dir}: succeeded!" 1>&2
+ if [ "$good_build" = "no" -o "$good_run" = "yes" ]; then
+ # output == expected
+ good="yes"
+ echo "${test_dir}: succeeded!" 1>&2
+ fi
fi
fi