Merge "art: Make calling convention immune to SIRT structure change"
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index ba54e04..551b03c 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -84,6 +84,7 @@
     else
       LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
     endif
+    LOCAL_LDLIBS += -lpthread
   endif
 
   ifeq ($$(art_ndebug_or_debug),ndebug)
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 62916e3..da0b500 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -176,6 +176,7 @@
         # GCC host compiled tests fail with this linked, presumably due to destructors that run.
         LOCAL_STATIC_LIBRARIES += libgtest_host
     endif
+    LOCAL_LDLIBS += -lpthread -ldl
     include $(BUILD_HOST_EXECUTABLE)
     art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
     ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe)
diff --git a/compiler/dex/quick/x86/fp_x86.cc b/compiler/dex/quick/x86/fp_x86.cc
index ec4d9db..3fb9012 100644
--- a/compiler/dex/quick/x86/fp_x86.cc
+++ b/compiler/dex/quick/x86/fp_x86.cc
@@ -146,6 +146,11 @@
     if (lo_info != nullptr && lo_info->is_temp) {
       // Calling FlushSpecificReg because it will only write back VR if it is dirty.
       FlushSpecificReg(lo_info);
+      // ResetDef for low/high to prevent NullifyRange from removing stores.
+      ResetDef(rl_src.reg.GetLowReg());
+      if (rl_src.reg.GetLowReg() != rl_src.reg.GetHighReg() && GetRegInfo(rl_src.reg.GetHighReg()) != nullptr) {
+        ResetDef(rl_src.reg.GetHighReg());
+      }
     } else {
       // It must have been register promoted if it is not a temp but is still in physical
       // register. Since we need it to be in memory to convert, we place it there now.
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 20e720b..024f830 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -968,6 +968,18 @@
   gRegistry->DisposeObject(object_id, reference_count);
 }
 
+static JDWP::JdwpTypeTag GetTypeTag(mirror::Class* klass)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  DCHECK(klass != nullptr);
+  if (klass->IsArrayClass()) {
+    return JDWP::TT_ARRAY;
+  } else if (klass->IsInterface()) {
+    return JDWP::TT_INTERFACE;
+  } else {
+    return JDWP::TT_CLASS;
+  }
+}
+
 JDWP::JdwpError Dbg::GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply) {
   JDWP::JdwpError status;
   mirror::Class* c = DecodeClass(class_id, status);
@@ -975,7 +987,8 @@
     return status;
   }
 
-  expandBufAdd1(pReply, c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS);
+  JDWP::JdwpTypeTag type_tag = GetTypeTag(c);
+  expandBufAdd1(pReply, type_tag);
   expandBufAddRefTypeId(pReply, class_id);
   return JDWP::ERR_NONE;
 }
@@ -1049,14 +1062,7 @@
     return JDWP::ERR_INVALID_OBJECT;
   }
 
-  JDWP::JdwpTypeTag type_tag;
-  if (o->GetClass()->IsArrayClass()) {
-    type_tag = JDWP::TT_ARRAY;
-  } else if (o->GetClass()->IsInterface()) {
-    type_tag = JDWP::TT_INTERFACE;
-  } else {
-    type_tag = JDWP::TT_CLASS;
-  }
+  JDWP::JdwpTypeTag type_tag = GetTypeTag(o->GetClass());
   JDWP::RefTypeId type_id = gRegistry->AddRefType(o->GetClass());
 
   expandBufAdd1(pReply, type_tag);
@@ -1309,7 +1315,7 @@
     memset(&location, 0, sizeof(location));
   } else {
     mirror::Class* c = m->GetDeclaringClass();
-    location.type_tag = c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS;
+    location.type_tag = GetTypeTag(c);
     location.class_id = gRegistry->AddRefType(c);
     location.method_id = ToMethodId(m);
     location.dex_pc = (m->IsNative() || m->IsProxyMethod()) ? static_cast<uint64_t>(-1) : dex_pc;
@@ -2481,7 +2487,7 @@
   // debuggers seem to like that.  There might be some advantage to honesty,
   // since the class may not yet be verified.
   int state = JDWP::CS_VERIFIED | JDWP::CS_PREPARED;
-  JDWP::JdwpTypeTag tag = c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS;
+  JDWP::JdwpTypeTag tag = GetTypeTag(c);
   gJdwpState->PostClassPrepare(tag, gRegistry->Add(c),
                                ClassHelper(c).GetDescriptor(), state);
 }
diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc
index 8fccd6d..7546245 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -551,6 +551,20 @@
       uint32_t arg[5];
       GetArgs(arg);
       switch (Opcode()) {
+        case FILLED_NEW_ARRAY:
+        {
+          const int32_t a = VRegA_35c();
+          os << opcode << " {";
+          for (int i = 0; i < a; ++i) {
+            if (i > 0) {
+              os << ", ";
+            }
+            os << "v" << arg[i];
+          }
+          os << "}, type@" << VRegB_35c();
+        }
+        break;
+
         case INVOKE_VIRTUAL:
         case INVOKE_SUPER:
         case INVOKE_DIRECT:
diff --git a/test/Android.mk b/test/Android.mk
index da5b35f..bb6c437 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -168,7 +168,13 @@
 endef
 
 # Expand all tests.
-$(foreach test, $(wildcard $(LOCAL_PATH)/[0-9]*), $(eval $(call declare-make-art-run-test,$(notdir $(test)))))
+TEST_ART_RUN_TESTS := $(wildcard $(LOCAL_PATH)/[0-9]*)
+TEST_ART_RUN_TESTS := $(subst $(LOCAL_PATH)/,, $(TEST_ART_RUN_TESTS))
+TEST_ART_TIMING_SENSITIVE_RUN_TESTS := 055-enum-performance
+ifdef dist_goal # disable timing sensitive tests on "dist" builds.
+  $(foreach test, $(TEST_ART_TIMING_SENSITIVE_RUN_TESTS), $(eval TEST_ART_RUN_TESTS := $(filter-out $(test), $(TEST_ART_RUN_TESTS))))
+endif
+$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call declare-make-art-run-test,$(test))))
 
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := tests
diff --git a/tools/art b/tools/art
index aa53a39..c9c0d4f 100755
--- a/tools/art
+++ b/tools/art
@@ -46,12 +46,15 @@
 PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
 ANDROID_BUILD_TOP="$(cd "${PROG_DIR}/../../../../" ; pwd -P)/"
 ANDROID_HOST_OUT=$PROG_DIR/..
+ANDROID_DATA=$PWD/android-data$$
 
-mkdir -p /tmp/android-data/dalvik-cache
-ANDROID_DATA=/tmp/android-data \
+mkdir -p $ANDROID_DATA/dalvik-cache
+ANDROID_DATA=$ANDROID_DATA \
   ANDROID_ROOT=$ANDROID_HOST_OUT \
   LD_LIBRARY_PATH=$ANDROID_HOST_OUT/lib \
-  exec $invoke_with $ANDROID_HOST_OUT/bin/dalvikvm $lib \
-    -Xbootclasspath:$ANDROID_HOST_OUT/core-hostdex.jar \
+  $invoke_with $ANDROID_HOST_OUT/bin/dalvikvm $lib \
     -Ximage:$ANDROID_HOST_OUT/framework/core.art \
      "$@"
+EXIT_STATUS=$?
+rm -rf $ANDROID_DATA
+exit $EXIT_STATUS