summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/004-SignalTest/signaltest.cc2
-rw-r--r--test/134-reg-promotion/expected.txt0
-rw-r--r--test/134-reg-promotion/info.txt4
-rw-r--r--test/134-reg-promotion/smali/Test.smali38
-rw-r--r--test/134-reg-promotion/src/Main.java42
-rw-r--r--test/449-checker-bce/src/Main.java23
-rw-r--r--test/454-get-vreg/expected.txt0
-rw-r--r--test/454-get-vreg/get_vreg_jni.cc122
-rw-r--r--test/454-get-vreg/info.txt1
-rw-r--r--test/454-get-vreg/src/Main.java53
-rw-r--r--test/455-set-vreg/expected.txt0
-rw-r--r--test/455-set-vreg/info.txt1
-rw-r--r--test/455-set-vreg/set_vreg_jni.cc95
-rw-r--r--test/455-set-vreg/src/Main.java73
-rw-r--r--test/Android.libarttest.mk4
-rw-r--r--test/Android.run-test.mk32
-rwxr-xr-xtest/etc/run-test-jar16
-rwxr-xr-xtest/run-all-tests5
-rwxr-xr-xtest/run-test5
19 files changed, 505 insertions, 11 deletions
diff --git a/test/004-SignalTest/signaltest.cc b/test/004-SignalTest/signaltest.cc
index 31371f6d22..876d27ec2e 100644
--- a/test/004-SignalTest/signaltest.cc
+++ b/test/004-SignalTest/signaltest.cc
@@ -65,6 +65,8 @@ static void signalhandler(int sig ATTRIBUTE_UNUSED, siginfo_t* info ATTRIBUTE_UN
#elif defined(__i386__) || defined(__x86_64__)
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
uc->CTX_EIP += 3;
+#else
+ UNUSED(context);
#endif
}
diff --git a/test/134-reg-promotion/expected.txt b/test/134-reg-promotion/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/134-reg-promotion/expected.txt
diff --git a/test/134-reg-promotion/info.txt b/test/134-reg-promotion/info.txt
new file mode 100644
index 0000000000..6eff7eb832
--- /dev/null
+++ b/test/134-reg-promotion/info.txt
@@ -0,0 +1,4 @@
+Test that a vreg value that was defined by a const 0 and is used is both ref
+and float operations is flushed to all home location.
+
+See: b/19417710, b/7250540 & b.android.com/147187
diff --git a/test/134-reg-promotion/smali/Test.smali b/test/134-reg-promotion/smali/Test.smali
new file mode 100644
index 0000000000..6a35c45cd7
--- /dev/null
+++ b/test/134-reg-promotion/smali/Test.smali
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2015 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 LTest;
+
+.super Ljava/lang/Object;
+
+.method public static run()V
+ .registers 3
+ new-instance v2, Ljava/lang/String;
+ invoke-direct {v2}, Ljava/lang/String;-><init>()V
+ const/4 v0, 0
+ move v1, v0
+ :start
+ invoke-static {}, LMain;->blowup()V
+ if-ne v1, v0, :end
+ const/4 v2, 1
+ invoke-static {v2}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
+ move v2, v0
+ # The call makes v2 float type.
+ invoke-static {v2}, Ljava/lang/Float;->isNaN(F)Z
+ const/4 v1, 1
+ goto :start
+ :end
+ return-void
+.end method
diff --git a/test/134-reg-promotion/src/Main.java b/test/134-reg-promotion/src/Main.java
new file mode 100644
index 0000000000..d45ec661d3
--- /dev/null
+++ b/test/134-reg-promotion/src/Main.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 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 char [][] holder;
+ static boolean sawOome;
+
+ static void blowup() {
+ try {
+ for (int i = 0; i < holder.length; ++i) {
+ holder[i] = new char[1024 * 1024];
+ }
+ } catch (OutOfMemoryError oome) {
+ sawOome = true;
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ Class<?> c = Class.forName("Test");
+ Method m = c.getMethod("run", (Class[]) null);
+ for (int i = 0; i < 10; i++) {
+ holder = new char[128 * 1024][];
+ m.invoke(null, (Object[]) null);
+ holder = null;
+ }
+ }
+}
diff --git a/test/449-checker-bce/src/Main.java b/test/449-checker-bce/src/Main.java
index 9391533411..30aa870acb 100644
--- a/test/449-checker-bce/src/Main.java
+++ b/test/449-checker-bce/src/Main.java
@@ -314,6 +314,29 @@ public class Main {
array[10] = 1; // Bounds check can't be eliminated.
}
+
+ static byte readData() {
+ return 1;
+ }
+
+ // CHECK-START: void Main.circularBufferProducer() BCE (before)
+ // CHECK: BoundsCheck
+ // CHECK: ArraySet
+
+ // CHECK-START: void Main.circularBufferProducer() BCE (after)
+ // CHECK-NOT: BoundsCheck
+ // CHECK: ArraySet
+
+ static void circularBufferProducer() {
+ byte[] array = new byte[4096];
+ int i = 0;
+ while (true) {
+ array[i & (array.length - 1)] = readData();
+ i++;
+ }
+ }
+
+
// CHECK-START: void Main.pyramid1(int[]) BCE (before)
// CHECK: BoundsCheck
// CHECK: ArraySet
diff --git a/test/454-get-vreg/expected.txt b/test/454-get-vreg/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/454-get-vreg/expected.txt
diff --git a/test/454-get-vreg/get_vreg_jni.cc b/test/454-get-vreg/get_vreg_jni.cc
new file mode 100644
index 0000000000..937d2fee76
--- /dev/null
+++ b/test/454-get-vreg/get_vreg_jni.cc
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2015 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 "arch/context.h"
+#include "jni.h"
+#include "mirror/art_method-inl.h"
+#include "scoped_thread_state_change.h"
+#include "stack.h"
+#include "thread.h"
+
+namespace art {
+
+namespace {
+
+class TestVisitor : public StackVisitor {
+ public:
+ TestVisitor(Thread* thread, Context* context, mirror::Object* this_value)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ : StackVisitor(thread, context), this_value_(this_value), found_method_index_(0) {}
+
+ bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ mirror::ArtMethod* m = GetMethod();
+ std::string m_name(m->GetName());
+
+ if (m_name.compare("testSimpleVReg") == 0) {
+ found_method_index_ = 1;
+ uint32_t value = 0;
+
+ CHECK(GetVReg(m, 0, kIntVReg, &value));
+ CHECK_EQ(value, 42u);
+
+ bool success = GetVReg(m, 1, kIntVReg, &value);
+ if (m->IsOptimized(sizeof(void*))) CHECK(!success);
+
+ success = GetVReg(m, 2, kIntVReg, &value);
+ if (m->IsOptimized(sizeof(void*))) CHECK(!success);
+
+ CHECK(GetVReg(m, 3, kReferenceVReg, &value));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value), this_value_);
+
+ CHECK(GetVReg(m, 4, kIntVReg, &value));
+ CHECK_EQ(value, 1u);
+
+ CHECK(GetVReg(m, 5, kFloatVReg, &value));
+ uint32_t cast = bit_cast<float, uint32_t>(1.0f);
+ CHECK_EQ(value, cast);
+
+ CHECK(GetVReg(m, 6, kIntVReg, &value));
+ CHECK_EQ(value, 2u);
+
+ CHECK(GetVReg(m, 7, kIntVReg, &value));
+ CHECK_EQ(value, true);
+
+ CHECK(GetVReg(m, 8, kIntVReg, &value));
+ CHECK_EQ(value, 3u);
+
+ CHECK(GetVReg(m, 9, kIntVReg, &value));
+ CHECK_EQ(value, static_cast<uint32_t>('c'));
+ } else if (m_name.compare("testPairVReg") == 0) {
+ found_method_index_ = 2;
+ uint64_t value = 0;
+ CHECK(GetVRegPair(m, 0, kLongLoVReg, kLongHiVReg, &value));
+ CHECK_EQ(value, 42u);
+
+ bool success = GetVRegPair(m, 2, kLongLoVReg, kLongHiVReg, &value);
+ if (m->IsOptimized(sizeof(void*))) CHECK(!success);
+
+ success = GetVRegPair(m, 4, kLongLoVReg, kLongHiVReg, &value);
+ if (m->IsOptimized(sizeof(void*))) CHECK(!success);
+
+ uint32_t value32 = 0;
+ CHECK(GetVReg(m, 6, kReferenceVReg, &value32));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value32), this_value_);
+
+ CHECK(GetVRegPair(m, 7, kLongLoVReg, kLongHiVReg, &value));
+ CHECK_EQ(static_cast<int64_t>(value), std::numeric_limits<int64_t>::min());
+
+ CHECK(GetVRegPair(m, 9, kLongLoVReg, kLongHiVReg, &value));
+ CHECK_EQ(static_cast<int64_t>(value), std::numeric_limits<int64_t>::max());
+
+ CHECK(GetVRegPair(m, 11, kLongLoVReg, kLongHiVReg, &value));
+ CHECK_EQ(value, 0u);
+
+ CHECK(GetVRegPair(m, 13, kDoubleLoVReg, kDoubleHiVReg, &value));
+ uint64_t cast = bit_cast<double, uint64_t>(2.0);
+ CHECK_EQ(value, cast);
+ }
+
+ return true;
+ }
+
+ mirror::Object* this_value_;
+
+ // Value returned to Java to ensure the methods testSimpleVReg and testPairVReg
+ // have been found and tested.
+ jint found_method_index_;
+};
+
+extern "C" JNIEXPORT jint JNICALL Java_Main_doNativeCall(JNIEnv*, jobject value) {
+ ScopedObjectAccess soa(Thread::Current());
+ std::unique_ptr<Context> context(Context::Create());
+ TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object*>(value));
+ visitor.WalkStack();
+ return visitor.found_method_index_;
+}
+
+} // namespace
+
+} // namespace art
diff --git a/test/454-get-vreg/info.txt b/test/454-get-vreg/info.txt
new file mode 100644
index 0000000000..20df0b5129
--- /dev/null
+++ b/test/454-get-vreg/info.txt
@@ -0,0 +1 @@
+Tests for inspecting DEX registers in a Java method.
diff --git a/test/454-get-vreg/src/Main.java b/test/454-get-vreg/src/Main.java
new file mode 100644
index 0000000000..df07d441a8
--- /dev/null
+++ b/test/454-get-vreg/src/Main.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 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 Main() {
+ }
+
+ int testSimpleVReg(int a, float f, short s, boolean z, byte b, char c) {
+ int e = doCall();
+ int g = doNativeCall();
+ return e + g;
+ }
+
+ long testPairVReg(long a, long b, long c, double e) {
+ long f = doCall();
+ long g = doNativeCall();
+ return f + g;
+ }
+
+ native int doNativeCall();
+
+ int doCall() {
+ return 42;
+ }
+
+ static {
+ System.loadLibrary("arttest");
+ }
+
+ public static void main(String[] args) {
+ Main rm = new Main();
+ if (rm.testSimpleVReg(1, 1.0f, (short)2, true, (byte)3, 'c') != 43) {
+ throw new Error("Expected 43");
+ }
+
+ if (rm.testPairVReg(Long.MIN_VALUE, Long.MAX_VALUE, 0, 2.0) != 44) {
+ throw new Error("Expected 44");
+ }
+ }
+}
diff --git a/test/455-set-vreg/expected.txt b/test/455-set-vreg/expected.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/455-set-vreg/expected.txt
diff --git a/test/455-set-vreg/info.txt b/test/455-set-vreg/info.txt
new file mode 100644
index 0000000000..e8c57b579c
--- /dev/null
+++ b/test/455-set-vreg/info.txt
@@ -0,0 +1 @@
+Tests for setting DEX registers in a Java method.
diff --git a/test/455-set-vreg/set_vreg_jni.cc b/test/455-set-vreg/set_vreg_jni.cc
new file mode 100644
index 0000000000..24d783264d
--- /dev/null
+++ b/test/455-set-vreg/set_vreg_jni.cc
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 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 "arch/context.h"
+#include "jni.h"
+#include "mirror/art_method-inl.h"
+#include "scoped_thread_state_change.h"
+#include "stack.h"
+#include "thread.h"
+
+namespace art {
+
+namespace {
+
+class TestVisitor : public StackVisitor {
+ public:
+ TestVisitor(Thread* thread, Context* context, mirror::Object* this_value)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ : StackVisitor(thread, context), this_value_(this_value) {}
+
+ bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ mirror::ArtMethod* m = GetMethod();
+ std::string m_name(m->GetName());
+
+ if (m_name.compare("testIntVReg") == 0) {
+ uint32_t value = 0;
+ CHECK(GetVReg(m, 1, kReferenceVReg, &value));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value), this_value_);
+
+ CHECK(SetVReg(m, 2, 5, kIntVReg));
+ CHECK(SetVReg(m, 3, 4, kIntVReg));
+ CHECK(SetVReg(m, 4, 3, kIntVReg));
+ CHECK(SetVReg(m, 5, 2, kIntVReg));
+ CHECK(SetVReg(m, 6, 1, kIntVReg));
+ } else if (m_name.compare("testLongVReg") == 0) {
+ uint32_t value = 0;
+ CHECK(GetVReg(m, 3, kReferenceVReg, &value));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value), this_value_);
+
+ CHECK(SetVRegPair(m, 4, std::numeric_limits<int64_t>::max(), kLongLoVReg, kLongHiVReg));
+ CHECK(SetVRegPair(m, 6, 4, kLongLoVReg, kLongHiVReg));
+ CHECK(SetVRegPair(m, 8, 3, kLongLoVReg, kLongHiVReg));
+ CHECK(SetVRegPair(m, 10, 2, kLongLoVReg, kLongHiVReg));
+ CHECK(SetVRegPair(m, 12, 1, kLongLoVReg, kLongHiVReg));
+ } else if (m_name.compare("testFloatVReg") == 0) {
+ uint32_t value = 0;
+ CHECK(GetVReg(m, 1, kReferenceVReg, &value));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value), this_value_);
+
+ CHECK(SetVReg(m, 2, bit_cast<float, uint32_t>(5.0f), kFloatVReg));
+ CHECK(SetVReg(m, 3, bit_cast<float, uint32_t>(4.0f), kFloatVReg));
+ CHECK(SetVReg(m, 4, bit_cast<float, uint32_t>(3.0f), kFloatVReg));
+ CHECK(SetVReg(m, 5, bit_cast<float, uint32_t>(2.0f), kFloatVReg));
+ CHECK(SetVReg(m, 6, bit_cast<float, uint32_t>(1.0f), kFloatVReg));
+ } else if (m_name.compare("testDoubleVReg") == 0) {
+ uint32_t value = 0;
+ CHECK(GetVReg(m, 3, kReferenceVReg, &value));
+ CHECK_EQ(reinterpret_cast<mirror::Object*>(value), this_value_);
+
+ CHECK(SetVRegPair(m, 4, bit_cast<double, uint64_t>(5.0), kDoubleLoVReg, kDoubleHiVReg));
+ CHECK(SetVRegPair(m, 6, bit_cast<double, uint64_t>(4.0), kDoubleLoVReg, kDoubleHiVReg));
+ CHECK(SetVRegPair(m, 8, bit_cast<double, uint64_t>(3.0), kDoubleLoVReg, kDoubleHiVReg));
+ CHECK(SetVRegPair(m, 10, bit_cast<double, uint64_t>(2.0), kDoubleLoVReg, kDoubleHiVReg));
+ CHECK(SetVRegPair(m, 12, bit_cast<double, uint64_t>(1.0), kDoubleLoVReg, kDoubleHiVReg));
+ }
+
+ return true;
+ }
+
+ mirror::Object* this_value_;
+};
+
+extern "C" JNIEXPORT void JNICALL Java_Main_doNativeCallSetVReg(JNIEnv*, jobject value) {
+ ScopedObjectAccess soa(Thread::Current());
+ std::unique_ptr<Context> context(Context::Create());
+ TestVisitor visitor(soa.Self(), context.get(), soa.Decode<mirror::Object*>(value));
+ visitor.WalkStack();
+}
+
+} // namespace
+
+} // namespace art
diff --git a/test/455-set-vreg/src/Main.java b/test/455-set-vreg/src/Main.java
new file mode 100644
index 0000000000..2172d9212d
--- /dev/null
+++ b/test/455-set-vreg/src/Main.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2015 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 Main() {
+ }
+
+ int testIntVReg(int a, int b, int c, int d, int e) {
+ doNativeCallSetVReg();
+ return a - b - c - d - e;
+ }
+
+ long testLongVReg(long a, long b, long c, long d, long e) {
+ doNativeCallSetVReg();
+ return a - b - c - d - e;
+ }
+
+ float testFloatVReg(float a, float b, float c, float d, float e) {
+ doNativeCallSetVReg();
+ return a - b - c - d - e;
+ }
+
+ double testDoubleVReg(double a, double b, double c, double d, double e) {
+ doNativeCallSetVReg();
+ return a - b - c - d - e;
+ }
+
+ native void doNativeCallSetVReg();
+
+ static {
+ System.loadLibrary("arttest");
+ }
+
+ public static void main(String[] args) {
+ Main rm = new Main();
+ int intExpected = 5 - 4 - 3 - 2 - 1;
+ int intResult = rm.testIntVReg(0, 0, 0, 0, 0);
+ if (intResult != intExpected) {
+ throw new Error("Expected " + intExpected + ", got " + intResult);
+ }
+
+ long longExpected = Long.MAX_VALUE - 4 - 3 - 2 - 1;
+ long longResult = rm.testLongVReg(0, 0, 0, 0, 0);
+ if (longResult != longExpected) {
+ throw new Error("Expected " + longExpected + ", got " + longResult);
+ }
+
+ float floatExpected = 5.0f - 4.0f - 3.0f - 2.0f - 1.0f;
+ float floatResult = rm.testFloatVReg(0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ if (floatResult != floatExpected) {
+ throw new Error("Expected " + floatExpected + ", got " + floatResult);
+ }
+
+ double doubleExpected = 5.0 - 4.0 - 3.0 - 2.0 - 1.0;
+ double doubleResult = rm.testDoubleVReg(0.0, 0.0, 0.0, 0.0, 0.0);
+ if (doubleResult != doubleExpected) {
+ throw new Error("Expected " + doubleExpected + ", got " + doubleResult);
+ }
+ }
+}
diff --git a/test/Android.libarttest.mk b/test/Android.libarttest.mk
index e64df5c32a..75c5d72f18 100644
--- a/test/Android.libarttest.mk
+++ b/test/Android.libarttest.mk
@@ -27,7 +27,9 @@ LIBARTTEST_COMMON_SRC_FILES := \
051-thread/thread_test.cc \
116-nodex2oat/nodex2oat.cc \
117-nopatchoat/nopatchoat.cc \
- 118-noimage-dex2oat/noimage-dex2oat.cc
+ 118-noimage-dex2oat/noimage-dex2oat.cc \
+ 454-get-vreg/get_vreg_jni.cc \
+ 455-set-vreg/set_vreg_jni.cc
ART_TARGET_LIBARTTEST_$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so
ifdef TARGET_2ND_ARCH
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 8e4b46b10c..10c422e86a 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -84,6 +84,9 @@ endif
ifeq ($(ART_TEST_INTERPRETER),true)
COMPILER_TYPES += interpreter
endif
+ifeq ($(ART_TEST_JIT),true)
+ COMPILER_TYPES += jit
+endif
ifeq ($(ART_TEST_OPTIMIZING),true)
COMPILER_TYPES += optimizing
endif
@@ -301,6 +304,8 @@ TEST_ART_BROKEN_NDEBUG_TESTS := \
118-noimage-dex2oat \
119-noimage-patchoat \
131-structural-change \
+ 454-get-vreg \
+ 455-set-vreg \
ifneq (,$(filter ndebug,$(RUN_TYPES)))
ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \
@@ -434,7 +439,7 @@ endif
# Create a rule to build and run a tests following the form:
# test-art-{1: host or target}-run-test-{2: debug ndebug}-{3: prebuild no-prebuild no-dex2oat}-
-# {4: interpreter default optimizing}-{5: relocate no-relocate relocate-no-patchoat}-
+# {4: interpreter default optimizing jit}-{5: relocate no-relocate relocate-no-patchoat}-
# {6: trace or no-trace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}-
# {9: no-image image picimage}-{10: pictest nopictest}-{11: test name}{12: 32 or 64}
define define-test-art-run-test
@@ -497,7 +502,12 @@ define define-test-art-run-test
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEFAULT_RULES
run_test_options += --quick
else
- $$(error found $(4) expected $(COMPILER_TYPES))
+ ifeq ($(4),jit)
+ test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JIT_RULES
+ run_test_options += --jit
+ else
+ $$(error found $(4) expected $(COMPILER_TYPES))
+ endif
endif
endif
endif
@@ -561,32 +571,38 @@ define define-test-art-run-test
endif
endif
endif
+ ifeq ($(4),jit)
+ # Use interpreter image for JIT.
+ image_suffix := interpreter
+ else
+ image_suffix := $(4)
+ endif
ifeq ($(9),no-image)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES
run_test_options += --no-image
# Add the core dependency. This is required for pre-building.
ifeq ($(1),host)
- prereq_rule += $(HOST_CORE_IMAGE_$(4)_no-pic_$(12))
+ prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_$(12))
else
- prereq_rule += $(TARGET_CORE_IMAGE_$(4)_no-pic_$(12))
+ prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_no-pic_$(12))
endif
else
ifeq ($(9),image)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_IMAGE_RULES
# Add the core dependency.
ifeq ($(1),host)
- prereq_rule += $(HOST_CORE_IMAGE_$(4)_no-pic_$(12))
+ prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_$(12))
else
- prereq_rule += $(TARGET_CORE_IMAGE_$(4)_no-pic_$(12))
+ prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_no-pic_$(12))
endif
else
ifeq ($(9),picimage)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
run_test_options += --pic-image
ifeq ($(1),host)
- prereq_rule += $(HOST_CORE_IMAGE_$(4)_pic_$(12))
+ prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_pic_$(12))
else
- prereq_rule += $(TARGET_CORE_IMAGE_$(4)_pic_$(12))
+ prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_pic_$(12))
endif
else
$$(error found $(9) expected $(IMAGE_TYPES))
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index f64756b5de..7a2ad1c321 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -26,6 +26,7 @@ GDB_SERVER="gdbserver"
HAVE_IMAGE="y"
HOST="n"
INTERPRETER="n"
+JIT="n"
INVOKE_WITH=""
ISA=x86
LIBRARY_DIRECTORY="lib"
@@ -127,6 +128,9 @@ while true; do
elif [ "x$1" = "x--interpreter" ]; then
INTERPRETER="y"
shift
+ elif [ "x$1" = "x--jit" ]; then
+ JIT="y"
+ shift
elif [ "x$1" = "x--jvm" ]; then
USE_JVM="y"
shift
@@ -260,6 +264,16 @@ if [ "$INTERPRETER" = "y" ]; then
fi
fi
+if [ "$JIT" = "y" ]; then
+ INT_OPTS="-Xjit"
+ 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"
if [ "$RELOCATE" = "y" ]; then
@@ -347,8 +361,8 @@ if [ "$HOST" = "n" ]; then
export ANDROID_DATA=$DEX_LOCATION && \
export DEX_LOCATION=$DEX_LOCATION && \
export ANDROID_ROOT=$ANDROID_ROOT && \
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
$mkdir_cmdline && \
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
$dex2oat_cmdline && \
$dalvikvm_cmdline"
diff --git a/test/run-all-tests b/test/run-all-tests
index 318a0de17e..d0b3cf9abe 100755
--- a/test/run-all-tests
+++ b/test/run-all-tests
@@ -53,6 +53,9 @@ while true; do
elif [ "x$1" = "x--interpreter" ]; then
run_args="${run_args} --interpreter"
shift
+ elif [ "x$1" = "x--jit" ]; then
+ run_args="${run_args} --jit"
+ shift
elif [ "x$1" = "x--no-verify" ]; then
run_args="${run_args} --no-verify"
shift
@@ -126,7 +129,7 @@ if [ "$usage" = "yes" ]; then
echo " $prog [options] Run all tests with the given options."
echo " Options are all passed to run-test; refer to that for " \
"further documentation:"
- echo " --debug --dev --host --interpreter --jvm --no-optimize"
+ echo " --debug --dev --host --interpreter --jit --jvm --no-optimize"
echo " --no-verify -O --update --valgrind --zygote --64 --relocate"
echo " --prebuild --always-clean --gcstress --gcverify --trace"
echo " --no-patchoat --no-dex2oat"
diff --git a/test/run-test b/test/run-test
index 8c47663390..52f5e0c401 100755
--- a/test/run-test
+++ b/test/run-test
@@ -193,6 +193,10 @@ while true; do
run_args="${run_args} --interpreter"
image_suffix="-interpreter"
shift
+ elif [ "x$1" = "x--jit" ]; then
+ run_args="${run_args} --jit"
+ image_suffix="-interpreter"
+ shift
elif [ "x$1" = "x--optimizing" ]; then
run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing"
image_suffix="-optimizing"
@@ -430,6 +434,7 @@ if [ "$usage" = "yes" ]; then
echo " --gdb Run under gdb; incompatible with some tests."
echo " --build-only Build test files only (off by default)."
echo " --interpreter Enable interpreter only mode (off by default)."
+ echo " --jit Enable jit (off by default)."
echo " --optimizing Enable optimizing compiler (off by default)."
echo " --quick Use Quick compiler (default)."
echo " --no-verify Turn off verification (on by default)."