OSDN Git Service

Merge "MIPS64: Check for MSA presence in each MSA instruction"
authorAart Bik <ajcbik@google.com>
Fri, 24 Mar 2017 17:29:03 +0000 (17:29 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Fri, 24 Mar 2017 17:29:04 +0000 (17:29 +0000)
39 files changed:
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_writer.cc
compiler/optimizing/code_generator_x86.cc
compiler/optimizing/code_generator_x86.h
compiler/optimizing/code_generator_x86_64.cc
compiler/optimizing/code_generator_x86_64.h
compiler/optimizing/graph_visualizer.cc
compiler/optimizing/intrinsics_mips.cc
compiler/optimizing/intrinsics_mips64.cc
compiler/optimizing/locations.h
compiler/optimizing/nodes.cc
compiler/optimizing/nodes.h
compiler/optimizing/register_allocation_resolver.cc
compiler/optimizing/register_allocator_graph_color.cc
compiler/optimizing/register_allocator_linear_scan.cc
compiler/optimizing/sharpening.cc
compiler/optimizing/ssa_liveness_analysis.cc
compiler/optimizing/ssa_liveness_analysis.h
disassembler/disassembler_x86.cc
runtime/class_linker.cc
runtime/class_linker.h
runtime/mirror/dex_cache.h
runtime/transaction_test.cc
test.py [new file with mode: 0755]
test/051-thread/expected.txt
test/051-thread/src/Main.java
test/159-app-image-fields/expected.txt [new file with mode: 0644]
test/159-app-image-fields/info.txt [new file with mode: 0644]
test/159-app-image-fields/profile [new file with mode: 0644]
test/159-app-image-fields/run [new file with mode: 0644]
test/159-app-image-fields/src/AAA/Base.java [new file with mode: 0644]
test/159-app-image-fields/src/AAA/Derived.java [new file with mode: 0644]
test/159-app-image-fields/src/Main.java [new file with mode: 0644]
test/527-checker-array-access-split/src/Main.java
test/Android.run-test.mk
test/knownfailures.json
test/run-test
test/testrunner/testrunner.py

index aefdb54..d156644 100644 (file)
@@ -714,7 +714,8 @@ void ImageWriter::ComputeLazyFieldsForImageClasses() {
   class_linker->VisitClassesWithoutClassesLock(&visitor);
 }
 
-static bool IsBootClassLoaderClass(mirror::Class* klass) REQUIRES_SHARED(Locks::mutator_lock_) {
+static bool IsBootClassLoaderClass(ObjPtr<mirror::Class> klass)
+    REQUIRES_SHARED(Locks::mutator_lock_) {
   return klass->GetClassLoader() == nullptr;
 }
 
@@ -722,33 +723,33 @@ bool ImageWriter::IsBootClassLoaderNonImageClass(mirror::Class* klass) {
   return IsBootClassLoaderClass(klass) && !IsInBootImage(klass);
 }
 
-bool ImageWriter::PruneAppImageClass(mirror::Class* klass) {
+bool ImageWriter::PruneAppImageClass(ObjPtr<mirror::Class> klass) {
   bool early_exit = false;
   std::unordered_set<mirror::Class*> visited;
   return PruneAppImageClassInternal(klass, &early_exit, &visited);
 }
 
 bool ImageWriter::PruneAppImageClassInternal(
-    mirror::Class* klass,
+    ObjPtr<mirror::Class> klass,
     bool* early_exit,
     std::unordered_set<mirror::Class*>* visited) {
   DCHECK(early_exit != nullptr);
   DCHECK(visited != nullptr);
   DCHECK(compile_app_image_);
-  if (klass == nullptr || IsInBootImage(klass)) {
+  if (klass == nullptr || IsInBootImage(klass.Ptr())) {
     return false;
   }
-  auto found = prune_class_memo_.find(klass);
+  auto found = prune_class_memo_.find(klass.Ptr());
   if (found != prune_class_memo_.end()) {
     // Already computed, return the found value.
     return found->second;
   }
   // Circular dependencies, return false but do not store the result in the memoization table.
-  if (visited->find(klass) != visited->end()) {
+  if (visited->find(klass.Ptr()) != visited->end()) {
     *early_exit = true;
     return false;
   }
-  visited->emplace(klass);
+  visited->emplace(klass.Ptr());
   bool result = IsBootClassLoaderClass(klass);
   std::string temp;
   // Prune if not an image class, this handles any broken sets of image classes such as having a
@@ -812,20 +813,20 @@ bool ImageWriter::PruneAppImageClassInternal(
         dex_file_oat_index_map_.find(dex_cache->GetDexFile()) == dex_file_oat_index_map_.end();
   }
   // Erase the element we stored earlier since we are exiting the function.
-  auto it = visited->find(klass);
+  auto it = visited->find(klass.Ptr());
   DCHECK(it != visited->end());
   visited->erase(it);
   // Only store result if it is true or none of the calls early exited due to circular
   // dependencies. If visited is empty then we are the root caller, in this case the cycle was in
   // a child call and we can remember the result.
   if (result == true || !my_early_exit || visited->empty()) {
-    prune_class_memo_[klass] = result;
+    prune_class_memo_[klass.Ptr()] = result;
   }
   *early_exit |= my_early_exit;
   return result;
 }
 
-bool ImageWriter::KeepClass(Class* klass) {
+bool ImageWriter::KeepClass(ObjPtr<mirror::Class> klass) {
   if (klass == nullptr) {
     return false;
   }
@@ -896,15 +897,27 @@ class ImageWriter::PruneClassLoaderClassesVisitor : public ClassLoaderVisitor {
         Runtime::Current()->GetClassLinker()->ClassTableForClassLoader(class_loader);
     class_table->Visit(classes_visitor);
     removed_class_count_ += classes_visitor.Prune();
+
+    // Record app image class loader. The fake boot class loader should not get registered
+    // and we should end up with only one class loader for an app and none for boot image.
+    if (class_loader != nullptr && class_table != nullptr) {
+      DCHECK(class_loader_ == nullptr);
+      class_loader_ = class_loader;
+    }
   }
 
   size_t GetRemovedClassCount() const {
     return removed_class_count_;
   }
 
+  ObjPtr<mirror::ClassLoader> GetClassLoader() const REQUIRES_SHARED(Locks::mutator_lock_) {
+    return class_loader_;
+  }
+
  private:
   ImageWriter* const image_writer_;
   size_t removed_class_count_;
+  ObjPtr<mirror::ClassLoader> class_loader_;
 };
 
 void ImageWriter::VisitClassLoaders(ClassLoaderVisitor* visitor) {
@@ -913,70 +926,150 @@ void ImageWriter::VisitClassLoaders(ClassLoaderVisitor* visitor) {
   Runtime::Current()->GetClassLinker()->VisitClassLoaders(visitor);
 }
 
+void ImageWriter::PruneAndPreloadDexCache(ObjPtr<mirror::DexCache> dex_cache,
+                                          ObjPtr<mirror::ClassLoader> class_loader) {
+  // To ensure deterministic contents of the hash-based arrays, each slot shall contain
+  // the candidate with the lowest index. As we're processing entries in increasing index
+  // order, this means trying to look up the entry for the current index if the slot is
+  // empty or if it contains a higher index.
+
+  Runtime* runtime = Runtime::Current();
+  ClassLinker* class_linker = runtime->GetClassLinker();
+  ArtMethod* resolution_method = runtime->GetResolutionMethod();
+  const DexFile& dex_file = *dex_cache->GetDexFile();
+  // Prune methods.
+  ArtMethod** resolved_methods = dex_cache->GetResolvedMethods();
+  for (size_t i = 0, num = dex_cache->NumResolvedMethods(); i != num; ++i) {
+    ArtMethod* method =
+        mirror::DexCache::GetElementPtrSize(resolved_methods, i, target_ptr_size_);
+    DCHECK(method != nullptr) << "Expected resolution method instead of null method";
+    mirror::Class* declaring_class = method->GetDeclaringClass();
+    // Copied methods may be held live by a class which was not an image class but have a
+    // declaring class which is an image class. Set it to the resolution method to be safe and
+    // prevent dangling pointers.
+    if (method->IsCopied() || !KeepClass(declaring_class)) {
+      mirror::DexCache::SetElementPtrSize(resolved_methods,
+                                          i,
+                                          resolution_method,
+                                          target_ptr_size_);
+    } else if (kIsDebugBuild) {
+      // Check that the class is still in the classes table.
+      ReaderMutexLock mu(Thread::Current(), *Locks::classlinker_classes_lock_);
+      CHECK(class_linker->ClassInClassTable(declaring_class)) << "Class "
+          << Class::PrettyClass(declaring_class) << " not in class linker table";
+    }
+  }
+  // Prune fields and make the contents of the field array deterministic.
+  mirror::FieldDexCacheType* resolved_fields = dex_cache->GetResolvedFields();
+  dex::TypeIndex last_class_idx;  // Initialized to invalid index.
+  ObjPtr<mirror::Class> last_class = nullptr;
+  for (size_t i = 0, end = dex_file.NumFieldIds(); i < end; ++i) {
+    uint32_t slot_idx = dex_cache->FieldSlotIndex(i);
+    auto pair = mirror::DexCache::GetNativePairPtrSize(resolved_fields, slot_idx, target_ptr_size_);
+    uint32_t stored_index = pair.index;
+    ArtField* field = pair.object;
+    if (field != nullptr && i > stored_index) {
+      continue;  // Already checked.
+    }
+    // Check if the referenced class is in the image. Note that we want to check the referenced
+    // class rather than the declaring class to preserve the semantics, i.e. using a FieldId
+    // results in resolving the referenced class and that can for example throw OOME.
+    const DexFile::FieldId& field_id = dex_file.GetFieldId(i);
+    if (field_id.class_idx_ != last_class_idx) {
+      last_class_idx = field_id.class_idx_;
+      last_class = class_linker->LookupResolvedType(
+          dex_file, last_class_idx, dex_cache, class_loader);
+      if (last_class != nullptr && !KeepClass(last_class)) {
+        last_class = nullptr;
+      }
+    }
+    if (field == nullptr || i < stored_index) {
+      if (last_class != nullptr) {
+        const char* name = dex_file.StringDataByIdx(field_id.name_idx_);
+        const char* type = dex_file.StringByTypeIdx(field_id.type_idx_);
+        field = mirror::Class::FindField(Thread::Current(), last_class, name, type);
+        if (field != nullptr) {
+          // If the referenced class is in the image, the defining class must also be there.
+          DCHECK(KeepClass(field->GetDeclaringClass()));
+          dex_cache->SetResolvedField(i, field, target_ptr_size_);
+        }
+      }
+    } else {
+      DCHECK_EQ(i, stored_index);
+      if (last_class == nullptr) {
+        dex_cache->ClearResolvedField(stored_index, target_ptr_size_);
+      }
+    }
+  }
+  // Prune types and make the contents of the type array deterministic.
+  // This is done after fields and methods as their lookup can touch the types array.
+  for (size_t i = 0, end = dex_cache->GetDexFile()->NumTypeIds(); i < end; ++i) {
+    dex::TypeIndex type_idx(i);
+    uint32_t slot_idx = dex_cache->TypeSlotIndex(type_idx);
+    mirror::TypeDexCachePair pair =
+        dex_cache->GetResolvedTypes()[slot_idx].load(std::memory_order_relaxed);
+    uint32_t stored_index = pair.index;
+    ObjPtr<mirror::Class> klass = pair.object.Read();
+    if (klass == nullptr || i < stored_index) {
+      klass = class_linker->LookupResolvedType(dex_file, type_idx, dex_cache, class_loader);
+      if (klass != nullptr) {
+        DCHECK_EQ(dex_cache->GetResolvedType(type_idx), klass);
+        stored_index = i;  // For correct clearing below if not keeping the `klass`.
+      }
+    } else if (i == stored_index && !KeepClass(klass)) {
+      dex_cache->ClearResolvedType(dex::TypeIndex(stored_index));
+    }
+  }
+  // Strings do not need pruning, but the contents of the string array must be deterministic.
+  for (size_t i = 0, end = dex_cache->GetDexFile()->NumStringIds(); i < end; ++i) {
+    dex::StringIndex string_idx(i);
+    uint32_t slot_idx = dex_cache->StringSlotIndex(string_idx);
+    mirror::StringDexCachePair pair =
+        dex_cache->GetStrings()[slot_idx].load(std::memory_order_relaxed);
+    uint32_t stored_index = pair.index;
+    ObjPtr<mirror::String> string = pair.object.Read();
+    if (string == nullptr || i < stored_index) {
+      string = class_linker->LookupString(dex_file, string_idx, dex_cache);
+      DCHECK(string == nullptr || dex_cache->GetResolvedString(string_idx) == string);
+    }
+  }
+}
+
 void ImageWriter::PruneNonImageClasses() {
   Runtime* runtime = Runtime::Current();
   ClassLinker* class_linker = runtime->GetClassLinker();
   Thread* self = Thread::Current();
+  ScopedAssertNoThreadSuspension sa(__FUNCTION__);
 
   // Clear class table strong roots so that dex caches can get pruned. We require pruning the class
   // path dex caches.
   class_linker->ClearClassTableStrongRoots();
 
   // Remove the undesired classes from the class roots.
+  ObjPtr<mirror::ClassLoader> class_loader;
   {
     PruneClassLoaderClassesVisitor class_loader_visitor(this);
     VisitClassLoaders(&class_loader_visitor);
     VLOG(compiler) << "Pruned " << class_loader_visitor.GetRemovedClassCount() << " classes";
+    class_loader = class_loader_visitor.GetClassLoader();
+    DCHECK_EQ(class_loader != nullptr, compile_app_image_);
   }
 
   // Clear references to removed classes from the DexCaches.
-  ArtMethod* resolution_method = runtime->GetResolutionMethod();
-
-  ScopedAssertNoThreadSuspension sa(__FUNCTION__);
-  ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_);  // For ClassInClassTable
-  ReaderMutexLock mu2(self, *Locks::dex_lock_);
-  for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) {
-    if (self->IsJWeakCleared(data.weak_root)) {
-      continue;
-    }
-    ObjPtr<mirror::DexCache> dex_cache = self->DecodeJObject(data.weak_root)->AsDexCache();
-    for (size_t i = 0; i < dex_cache->NumResolvedTypes(); i++) {
-      mirror::TypeDexCachePair pair =
-          dex_cache->GetResolvedTypes()[i].load(std::memory_order_relaxed);
-      mirror::Class* klass = pair.object.Read();
-      if (klass != nullptr && !KeepClass(klass)) {
-        dex_cache->ClearResolvedType(dex::TypeIndex(pair.index));
-      }
-    }
-    ArtMethod** resolved_methods = dex_cache->GetResolvedMethods();
-    for (size_t i = 0, num = dex_cache->NumResolvedMethods(); i != num; ++i) {
-      ArtMethod* method =
-          mirror::DexCache::GetElementPtrSize(resolved_methods, i, target_ptr_size_);
-      DCHECK(method != nullptr) << "Expected resolution method instead of null method";
-      mirror::Class* declaring_class = method->GetDeclaringClass();
-      // Copied methods may be held live by a class which was not an image class but have a
-      // declaring class which is an image class. Set it to the resolution method to be safe and
-      // prevent dangling pointers.
-      if (method->IsCopied() || !KeepClass(declaring_class)) {
-        mirror::DexCache::SetElementPtrSize(resolved_methods,
-                                            i,
-                                            resolution_method,
-                                            target_ptr_size_);
-      } else {
-        // Check that the class is still in the classes table.
-        DCHECK(class_linker->ClassInClassTable(declaring_class)) << "Class "
-            << Class::PrettyClass(declaring_class) << " not in class linker table";
-      }
-    }
-    mirror::FieldDexCacheType* resolved_fields = dex_cache->GetResolvedFields();
-    for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) {
-      auto pair = mirror::DexCache::GetNativePairPtrSize(resolved_fields, i, target_ptr_size_);
-      ArtField* field = pair.object;
-      if (field != nullptr && !KeepClass(field->GetDeclaringClass().Ptr())) {
-        dex_cache->ClearResolvedField(pair.index, target_ptr_size_);
+  std::vector<ObjPtr<mirror::DexCache>> dex_caches;
+  {
+    ReaderMutexLock mu2(self, *Locks::dex_lock_);
+    dex_caches.reserve(class_linker->GetDexCachesData().size());
+    for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) {
+      if (self->IsJWeakCleared(data.weak_root)) {
+        continue;
       }
+      dex_caches.push_back(self->DecodeJObject(data.weak_root)->AsDexCache());
     }
   }
+  for (ObjPtr<mirror::DexCache> dex_cache : dex_caches) {
+    PruneAndPreloadDexCache(dex_cache, class_loader);
+  }
 
   // Drop the array class cache in the ClassLinker, as these are roots holding those classes live.
   class_linker->DropFindArrayClassCache();
index bdc7146..16aff61 100644 (file)
@@ -376,7 +376,7 @@ class ImageWriter FINAL {
   }
 
   // Returns true if the class was in the original requested image classes list.
-  bool KeepClass(mirror::Class* klass) REQUIRES_SHARED(Locks::mutator_lock_);
+  bool KeepClass(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Debug aid that list of requested image classes.
   void DumpImageClasses();
@@ -391,6 +391,12 @@ class ImageWriter FINAL {
   // Remove unwanted classes from various roots.
   void PruneNonImageClasses() REQUIRES_SHARED(Locks::mutator_lock_);
 
+  // Remove unwanted classes from the DexCache roots and preload deterministic DexCache contents.
+  void PruneAndPreloadDexCache(ObjPtr<mirror::DexCache> dex_cache,
+                               ObjPtr<mirror::ClassLoader> class_loader)
+      REQUIRES_SHARED(Locks::mutator_lock_)
+      REQUIRES(!Locks::classlinker_classes_lock_);
+
   // Verify unwanted classes removed.
   void CheckNonImageClassesRemoved() REQUIRES_SHARED(Locks::mutator_lock_);
   static void CheckNonImageClassesRemovedCallback(mirror::Object* obj, void* arg)
@@ -473,11 +479,11 @@ class ImageWriter FINAL {
   // we also cannot have any classes which refer to these boot class loader non image classes.
   // PruneAppImageClass also prunes if klass depends on a non-image class according to the compiler
   // driver.
-  bool PruneAppImageClass(mirror::Class* klass)
+  bool PruneAppImageClass(ObjPtr<mirror::Class> klass)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // early_exit is true if we had a cyclic dependency anywhere down the chain.
-  bool PruneAppImageClassInternal(mirror::Class* klass,
+  bool PruneAppImageClassInternal(ObjPtr<mirror::Class> klass,
                                   bool* early_exit,
                                   std::unordered_set<mirror::Class*>* visited)
       REQUIRES_SHARED(Locks::mutator_lock_);
index 8e25aa3..105db1d 100644 (file)
@@ -1440,12 +1440,10 @@ class OatWriter::WriteCodeMethodVisitor : public OatDexMethodVisitor {
 
   mirror::String* GetTargetString(const LinkerPatch& patch) REQUIRES_SHARED(Locks::mutator_lock_) {
     ScopedObjectAccessUnchecked soa(Thread::Current());
-    StackHandleScope<1> hs(soa.Self());
     ClassLinker* linker = Runtime::Current()->GetClassLinker();
-    Handle<mirror::DexCache> dex_cache(hs.NewHandle(GetDexCache(patch.TargetStringDexFile())));
     mirror::String* string = linker->LookupString(*patch.TargetStringDexFile(),
                                                   patch.TargetStringIndex(),
-                                                  dex_cache);
+                                                  GetDexCache(patch.TargetStringDexFile()));
     DCHECK(string != nullptr);
     DCHECK(writer_->HasBootImage() ||
            Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(string));
index 0b50619..4db4796 100644 (file)
@@ -183,10 +183,13 @@ class SuspendCheckSlowPathX86 : public SlowPathCode {
       : SlowPathCode(instruction), successor_(successor) {}
 
   void EmitNativeCode(CodeGenerator* codegen) OVERRIDE {
+    LocationSummary* locations = instruction_->GetLocations();
     CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen);
     __ Bind(GetEntryLabel());
+    SaveLiveRegisters(codegen, locations);  // only saves full width XMM for SIMD
     x86_codegen->InvokeRuntime(kQuickTestSuspend, instruction_, instruction_->GetDexPc(), this);
     CheckEntrypointTypes<kQuickTestSuspend, void, void>();
+    RestoreLiveRegisters(codegen, locations);  // only saves full width XMM for SIMD
     if (successor_ == nullptr) {
       __ jmp(GetReturnLabel());
     } else {
@@ -963,12 +966,20 @@ size_t CodeGeneratorX86::RestoreCoreRegister(size_t stack_index, uint32_t reg_id
 }
 
 size_t CodeGeneratorX86::SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) {
-  __ movsd(Address(ESP, stack_index), XmmRegister(reg_id));
+  if (GetGraph()->HasSIMD()) {
+    __ movups(Address(ESP, stack_index), XmmRegister(reg_id));
+  } else {
+    __ movsd(Address(ESP, stack_index), XmmRegister(reg_id));
+  }
   return GetFloatingPointSpillSlotSize();
 }
 
 size_t CodeGeneratorX86::RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) {
-  __ movsd(XmmRegister(reg_id), Address(ESP, stack_index));
+  if (GetGraph()->HasSIMD()) {
+    __ movups(XmmRegister(reg_id), Address(ESP, stack_index));
+  } else {
+    __ movsd(XmmRegister(reg_id), Address(ESP, stack_index));
+  }
   return GetFloatingPointSpillSlotSize();
 }
 
@@ -5699,7 +5710,11 @@ void InstructionCodeGeneratorX86::VisitParallelMove(HParallelMove* instruction)
 void LocationsBuilderX86::VisitSuspendCheck(HSuspendCheck* instruction) {
   LocationSummary* locations =
       new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCallOnSlowPath);
-  locations->SetCustomSlowPathCallerSaves(RegisterSet::Empty());  // No caller-save registers.
+  // In suspend check slow path, usually there are no caller-save registers at all.
+  // If SIMD instructions are present, however, we force spilling all live SIMD
+  // registers in full width (since the runtime only saves/restores lower part).
+  locations->SetCustomSlowPathCallerSaves(
+      GetGraph()->HasSIMD() ? RegisterSet::AllFpu() : RegisterSet::Empty());
 }
 
 void InstructionCodeGeneratorX86::VisitSuspendCheck(HSuspendCheck* instruction) {
@@ -5802,9 +5817,11 @@ void ParallelMoveResolverX86::EmitMove(size_t index) {
       __ movd(destination.AsRegisterPairHigh<Register>(), src_reg);
     } else if (destination.IsStackSlot()) {
       __ movss(Address(ESP, destination.GetStackIndex()), source.AsFpuRegister<XmmRegister>());
-    } else {
-      DCHECK(destination.IsDoubleStackSlot());
+    } else if (destination.IsDoubleStackSlot()) {
       __ movsd(Address(ESP, destination.GetStackIndex()), source.AsFpuRegister<XmmRegister>());
+    } else {
+      DCHECK(destination.IsSIMDStackSlot());
+      __ movups(Address(ESP, destination.GetStackIndex()), source.AsFpuRegister<XmmRegister>());
     }
   } else if (source.IsStackSlot()) {
     if (destination.IsRegister()) {
@@ -5826,6 +5843,9 @@ void ParallelMoveResolverX86::EmitMove(size_t index) {
       DCHECK(destination.IsDoubleStackSlot()) << destination;
       MoveMemoryToMemory64(destination.GetStackIndex(), source.GetStackIndex());
     }
+  } else if (source.IsSIMDStackSlot()) {
+    DCHECK(destination.IsFpuRegister());
+    __ movups(destination.AsFpuRegister<XmmRegister>(), Address(ESP, source.GetStackIndex()));
   } else if (source.IsConstant()) {
     HConstant* constant = source.GetConstant();
     if (constant->IsIntConstant() || constant->IsNullConstant()) {
index 65ee383..ca3a9ea 100644 (file)
@@ -348,8 +348,9 @@ class CodeGeneratorX86 : public CodeGenerator {
   }
 
   size_t GetFloatingPointSpillSlotSize() const OVERRIDE {
-    // 8 bytes == 2 words for each spill.
-    return 2 * kX86WordSize;
+    return GetGraph()->HasSIMD()
+        ? 4 * kX86WordSize   // 16 bytes == 4 words for each spill
+        : 2 * kX86WordSize;  //  8 bytes == 2 words for each spill
   }
 
   HGraphVisitor* GetLocationBuilder() OVERRIDE {
index 08f1adf..2ffc398 100644 (file)
@@ -140,10 +140,13 @@ class SuspendCheckSlowPathX86_64 : public SlowPathCode {
       : SlowPathCode(instruction), successor_(successor) {}
 
   void EmitNativeCode(CodeGenerator* codegen) OVERRIDE {
+    LocationSummary* locations = instruction_->GetLocations();
     CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen);
     __ Bind(GetEntryLabel());
+    SaveLiveRegisters(codegen, locations);  // only saves full width XMM for SIMD
     x86_64_codegen->InvokeRuntime(kQuickTestSuspend, instruction_, instruction_->GetDexPc(), this);
     CheckEntrypointTypes<kQuickTestSuspend, void, void>();
+    RestoreLiveRegisters(codegen, locations);  // only saves full width XMM for SIMD
     if (successor_ == nullptr) {
       __ jmp(GetReturnLabel());
     } else {
@@ -1158,13 +1161,21 @@ size_t CodeGeneratorX86_64::RestoreCoreRegister(size_t stack_index, uint32_t reg
 }
 
 size_t CodeGeneratorX86_64::SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) {
-  __ movsd(Address(CpuRegister(RSP), stack_index), XmmRegister(reg_id));
-  return kX86_64WordSize;
+  if (GetGraph()->HasSIMD()) {
+    __ movups(Address(CpuRegister(RSP), stack_index), XmmRegister(reg_id));
+  } else {
+    __ movsd(Address(CpuRegister(RSP), stack_index), XmmRegister(reg_id));
+  }
+  return GetFloatingPointSpillSlotSize();
 }
 
 size_t CodeGeneratorX86_64::RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) {
-  __ movsd(XmmRegister(reg_id), Address(CpuRegister(RSP), stack_index));
-  return kX86_64WordSize;
+  if (GetGraph()->HasSIMD()) {
+    __ movups(XmmRegister(reg_id), Address(CpuRegister(RSP), stack_index));
+  } else {
+    __ movsd(XmmRegister(reg_id), Address(CpuRegister(RSP), stack_index));
+  }
+  return GetFloatingPointSpillSlotSize();
 }
 
 void CodeGeneratorX86_64::InvokeRuntime(QuickEntrypointEnum entrypoint,
@@ -5152,7 +5163,11 @@ void InstructionCodeGeneratorX86_64::VisitParallelMove(HParallelMove* instructio
 void LocationsBuilderX86_64::VisitSuspendCheck(HSuspendCheck* instruction) {
   LocationSummary* locations =
       new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCallOnSlowPath);
-  locations->SetCustomSlowPathCallerSaves(RegisterSet::Empty());  // No caller-save registers.
+  // In suspend check slow path, usually there are no caller-save registers at all.
+  // If SIMD instructions are present, however, we force spilling all live SIMD
+  // registers in full width (since the runtime only saves/restores lower part).
+  locations->SetCustomSlowPathCallerSaves(
+      GetGraph()->HasSIMD() ? RegisterSet::AllFpu() : RegisterSet::Empty());
 }
 
 void InstructionCodeGeneratorX86_64::VisitSuspendCheck(HSuspendCheck* instruction) {
@@ -5241,6 +5256,10 @@ void ParallelMoveResolverX86_64::EmitMove(size_t index) {
       __ movq(CpuRegister(TMP), Address(CpuRegister(RSP), source.GetStackIndex()));
       __ movq(Address(CpuRegister(RSP), destination.GetStackIndex()), CpuRegister(TMP));
     }
+  } else if (source.IsSIMDStackSlot()) {
+    DCHECK(destination.IsFpuRegister());
+    __ movups(destination.AsFpuRegister<XmmRegister>(),
+              Address(CpuRegister(RSP), source.GetStackIndex()));
   } else if (source.IsConstant()) {
     HConstant* constant = source.GetConstant();
     if (constant->IsIntConstant() || constant->IsNullConstant()) {
@@ -5291,10 +5310,13 @@ void ParallelMoveResolverX86_64::EmitMove(size_t index) {
     } else if (destination.IsStackSlot()) {
       __ movss(Address(CpuRegister(RSP), destination.GetStackIndex()),
                source.AsFpuRegister<XmmRegister>());
-    } else {
-      DCHECK(destination.IsDoubleStackSlot()) << destination;
+    } else if (destination.IsDoubleStackSlot()) {
       __ movsd(Address(CpuRegister(RSP), destination.GetStackIndex()),
                source.AsFpuRegister<XmmRegister>());
+    } else {
+       DCHECK(destination.IsSIMDStackSlot());
+      __ movups(Address(CpuRegister(RSP), destination.GetStackIndex()),
+                source.AsFpuRegister<XmmRegister>());
     }
   }
 }
index 376c3ce..c8336da 100644 (file)
@@ -326,7 +326,9 @@ class CodeGeneratorX86_64 : public CodeGenerator {
   }
 
   size_t GetFloatingPointSpillSlotSize() const OVERRIDE {
-    return kX86_64WordSize;
+    return GetGraph()->HasSIMD()
+        ? 2 * kX86_64WordSize   // 16 bytes == 2 x86_64 words for each spill
+        : 1 * kX86_64WordSize;  //  8 bytes == 1 x86_64 words for each spill
   }
 
   HGraphVisitor* GetLocationBuilder() OVERRIDE {
index 2bf5c53..0dfae11 100644 (file)
@@ -322,9 +322,11 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
       codegen_.DumpCoreRegister(stream, location.high());
     } else if (location.IsUnallocated()) {
       stream << "unallocated";
-    } else {
-      DCHECK(location.IsDoubleStackSlot());
+    } else if (location.IsDoubleStackSlot()) {
       stream << "2x" << location.GetStackIndex() << "(sp)";
+    } else {
+      DCHECK(location.IsSIMDStackSlot());
+      stream << "4x" << location.GetStackIndex() << "(sp)";
     }
   }
 
index ba006ed..bf85b19 100644 (file)
@@ -2559,7 +2559,7 @@ void IntrinsicCodeGeneratorMIPS::VisitMathRoundFloat(HInvoke* invoke) {
 // void java.lang.String.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
 void IntrinsicLocationsBuilderMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke) {
   LocationSummary* locations = new (arena_) LocationSummary(invoke,
-                                                            LocationSummary::kCallOnMainOnly,
+                                                            LocationSummary::kNoCall,
                                                             kIntrinsified);
   locations->SetInAt(0, Location::RequiresRegister());
   locations->SetInAt(1, Location::RequiresRegister());
@@ -2567,17 +2567,9 @@ void IntrinsicLocationsBuilderMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke)
   locations->SetInAt(3, Location::RequiresRegister());
   locations->SetInAt(4, Location::RequiresRegister());
 
-  // We will call memcpy() to do the actual work. Allocate the temporary
-  // registers to use the correct input registers, and output register.
-  // memcpy() uses the normal MIPS calling convention.
-  InvokeRuntimeCallingConvention calling_convention;
-
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(2)));
-
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimInt);
-  locations->AddTemp(Location::RegisterLocation(outLocation.AsRegister<Register>()));
+  locations->AddTemp(Location::RequiresRegister());
+  locations->AddTemp(Location::RequiresRegister());
+  locations->AddTemp(Location::RequiresRegister());
 }
 
 void IntrinsicCodeGeneratorMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke) {
@@ -2596,16 +2588,11 @@ void IntrinsicCodeGeneratorMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke) {
   Register dstBegin = locations->InAt(4).AsRegister<Register>();
 
   Register dstPtr = locations->GetTemp(0).AsRegister<Register>();
-  DCHECK_EQ(dstPtr, A0);
   Register srcPtr = locations->GetTemp(1).AsRegister<Register>();
-  DCHECK_EQ(srcPtr, A1);
   Register numChrs = locations->GetTemp(2).AsRegister<Register>();
-  DCHECK_EQ(numChrs, A2);
-
-  Register dstReturn = locations->GetTemp(3).AsRegister<Register>();
-  DCHECK_EQ(dstReturn, V0);
 
   MipsLabel done;
+  MipsLabel loop;
 
   // Location of data in char array buffer.
   const uint32_t data_offset = mirror::Array::DataOffset(char_size).Uint32Value();
@@ -2634,7 +2621,7 @@ void IntrinsicCodeGeneratorMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke) {
     __ LoadFromOffset(kLoadWord, TMP, srcObj, count_offset);
     __ Sll(TMP, TMP, 31);
 
-    // If string is uncompressed, use memcpy() path.
+    // If string is uncompressed, use uncompressed path.
     __ Bnez(TMP, &uncompressed_copy);
 
     // Copy loop for compressed src, copying 1 character (8-bit) to (16-bit) at a time.
@@ -2660,10 +2647,13 @@ void IntrinsicCodeGeneratorMIPS::VisitStringGetCharsNoCheck(HInvoke* invoke) {
     __ Addu(srcPtr, srcPtr, AT);
   }
 
-  // Calculate number of bytes to copy from number of characters.
-  __ Sll(numChrs, numChrs, char_shift);
-
-  codegen_->InvokeRuntime(kQuickMemcpy, invoke, invoke->GetDexPc(), nullptr);
+  __ Bind(&loop);
+  __ Lh(AT, srcPtr, 0);
+  __ Addiu(numChrs, numChrs, -1);
+  __ Addiu(srcPtr, srcPtr, char_size);
+  __ Sh(AT, dstPtr, 0);
+  __ Addiu(dstPtr, dstPtr, char_size);
+  __ Bnez(numChrs, &loop);
 
   __ Bind(&done);
 }
index 21c5074..1ee89cf 100644 (file)
@@ -1895,7 +1895,7 @@ void IntrinsicCodeGeneratorMIPS64::VisitDoubleIsInfinite(HInvoke* invoke) {
 // void java.lang.String.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
 void IntrinsicLocationsBuilderMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
   LocationSummary* locations = new (arena_) LocationSummary(invoke,
-                                                            LocationSummary::kCallOnMainOnly,
+                                                            LocationSummary::kNoCall,
                                                             kIntrinsified);
   locations->SetInAt(0, Location::RequiresRegister());
   locations->SetInAt(1, Location::RequiresRegister());
@@ -1903,17 +1903,9 @@ void IntrinsicLocationsBuilderMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke
   locations->SetInAt(3, Location::RequiresRegister());
   locations->SetInAt(4, Location::RequiresRegister());
 
-  // We will call memcpy() to do the actual work. Allocate the temporary
-  // registers to use the correct input registers, and output register.
-  // memcpy() uses the normal MIPS calling conventions.
-  InvokeRuntimeCallingConvention calling_convention;
-
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(0)));
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(1)));
-  locations->AddTemp(Location::RegisterLocation(calling_convention.GetRegisterAt(2)));
-
-  Location outLocation = calling_convention.GetReturnLocation(Primitive::kPrimLong);
-  locations->AddTemp(Location::RegisterLocation(outLocation.AsRegister<GpuRegister>()));
+  locations->AddTemp(Location::RequiresRegister());
+  locations->AddTemp(Location::RequiresRegister());
+  locations->AddTemp(Location::RequiresRegister());
 }
 
 void IntrinsicCodeGeneratorMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
@@ -1932,16 +1924,11 @@ void IntrinsicCodeGeneratorMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
   GpuRegister dstBegin = locations->InAt(4).AsRegister<GpuRegister>();
 
   GpuRegister dstPtr = locations->GetTemp(0).AsRegister<GpuRegister>();
-  DCHECK_EQ(dstPtr, A0);
   GpuRegister srcPtr = locations->GetTemp(1).AsRegister<GpuRegister>();
-  DCHECK_EQ(srcPtr, A1);
   GpuRegister numChrs = locations->GetTemp(2).AsRegister<GpuRegister>();
-  DCHECK_EQ(numChrs, A2);
-
-  GpuRegister dstReturn = locations->GetTemp(3).AsRegister<GpuRegister>();
-  DCHECK_EQ(dstReturn, V0);
 
   Mips64Label done;
+  Mips64Label loop;
 
   // Location of data in char array buffer.
   const uint32_t data_offset = mirror::Array::DataOffset(char_size).Uint32Value();
@@ -1965,7 +1952,7 @@ void IntrinsicCodeGeneratorMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
     __ LoadFromOffset(kLoadWord, TMP, srcObj, count_offset);
     __ Dext(TMP, TMP, 0, 1);
 
-    // If string is uncompressed, use memcpy() path.
+    // If string is uncompressed, use uncompressed path.
     __ Bnezc(TMP, &uncompressed_copy);
 
     // Copy loop for compressed src, copying 1 character (8-bit) to (16-bit) at a time.
@@ -1986,10 +1973,13 @@ void IntrinsicCodeGeneratorMIPS64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
   __ Daddiu(srcPtr, srcObj, value_offset);
   __ Dlsa(srcPtr, srcBegin, srcPtr, char_shift);
 
-  // Calculate number of bytes to copy from number of characters.
-  __ Dsll(numChrs, numChrs, char_shift);
-
-  codegen_->InvokeRuntime(kQuickMemcpy, invoke, invoke->GetDexPc(), nullptr);
+  __ Bind(&loop);
+  __ Lh(AT, srcPtr, 0);
+  __ Daddiu(numChrs, numChrs, -1);
+  __ Daddiu(srcPtr, srcPtr, char_size);
+  __ Sh(AT, dstPtr, 0);
+  __ Daddiu(dstPtr, dstPtr, char_size);
+  __ Bnezc(numChrs, &loop);
 
   __ Bind(&done);
 }
index 091b58a..6f0dbce 100644 (file)
@@ -69,11 +69,13 @@ class Location : public ValueObject {
     // We do not use the value 9 because it conflicts with kLocationConstantMask.
     kDoNotUse9 = 9,
 
+    kSIMDStackSlot = 10,  // 128bit stack slot. TODO: generalize with encoded #bytes?
+
     // Unallocated location represents a location that is not fixed and can be
     // allocated by a register allocator.  Each unallocated location has
     // a policy that specifies what kind of location is suitable. Payload
     // contains register allocation policy.
-    kUnallocated = 10,
+    kUnallocated = 11,
   };
 
   Location() : ValueObject(), value_(kInvalid) {
@@ -82,6 +84,7 @@ class Location : public ValueObject {
     static_assert((kUnallocated & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kStackSlot & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kDoubleStackSlot & kLocationConstantMask) != kConstant, "TagError");
+    static_assert((kSIMDStackSlot & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kRegister & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kFpuRegister & kLocationConstantMask) != kConstant, "TagError");
     static_assert((kRegisterPair & kLocationConstantMask) != kConstant, "TagError");
@@ -266,8 +269,20 @@ class Location : public ValueObject {
     return GetKind() == kDoubleStackSlot;
   }
 
+  static Location SIMDStackSlot(intptr_t stack_index) {
+    uintptr_t payload = EncodeStackIndex(stack_index);
+    Location loc(kSIMDStackSlot, payload);
+    // Ensure that sign is preserved.
+    DCHECK_EQ(loc.GetStackIndex(), stack_index);
+    return loc;
+  }
+
+  bool IsSIMDStackSlot() const {
+    return GetKind() == kSIMDStackSlot;
+  }
+
   intptr_t GetStackIndex() const {
-    DCHECK(IsStackSlot() || IsDoubleStackSlot());
+    DCHECK(IsStackSlot() || IsDoubleStackSlot() || IsSIMDStackSlot());
     // Decode stack index manually to preserve sign.
     return GetPayload() - kStackIndexBias;
   }
@@ -315,6 +330,7 @@ class Location : public ValueObject {
       case kRegister: return "R";
       case kStackSlot: return "S";
       case kDoubleStackSlot: return "DS";
+      case kSIMDStackSlot: return "SIMD";
       case kUnallocated: return "U";
       case kConstant: return "C";
       case kFpuRegister: return "F";
@@ -417,6 +433,7 @@ std::ostream& operator<<(std::ostream& os, const Location::Policy& rhs);
 class RegisterSet : public ValueObject {
  public:
   static RegisterSet Empty() { return RegisterSet(); }
+  static RegisterSet AllFpu() { return RegisterSet(0, -1); }
 
   void Add(Location loc) {
     if (loc.IsRegister()) {
@@ -462,6 +479,7 @@ class RegisterSet : public ValueObject {
 
  private:
   RegisterSet() : core_registers_(0), floating_point_registers_(0) {}
+  RegisterSet(uint32_t core, uint32_t fp) : core_registers_(core), floating_point_registers_(fp) {}
 
   uint32_t core_registers_;
   uint32_t floating_point_registers_;
index 020e446..ec706e6 100644 (file)
@@ -2046,6 +2046,9 @@ HInstruction* HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) {
   if (HasTryCatch()) {
     outer_graph->SetHasTryCatch(true);
   }
+  if (HasSIMD()) {
+    outer_graph->SetHasSIMD(true);
+  }
 
   HInstruction* return_value = nullptr;
   if (GetBlocks().size() == 3) {
index 542b218..6881d8f 100644 (file)
@@ -323,6 +323,7 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {
         temporaries_vreg_slots_(0),
         has_bounds_checks_(false),
         has_try_catch_(false),
+        has_simd_(false),
         has_loops_(false),
         has_irreducible_loops_(false),
         debuggable_(debuggable),
@@ -560,6 +561,9 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {
   bool HasTryCatch() const { return has_try_catch_; }
   void SetHasTryCatch(bool value) { has_try_catch_ = value; }
 
+  bool HasSIMD() const { return has_simd_; }
+  void SetHasSIMD(bool value) { has_simd_ = value; }
+
   bool HasLoops() const { return has_loops_; }
   void SetHasLoops(bool value) { has_loops_ = value; }
 
@@ -652,6 +656,11 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {
   // false positives.
   bool has_try_catch_;
 
+  // Flag whether SIMD instructions appear in the graph. If true, the
+  // code generators may have to be more careful spilling the wider
+  // contents of SIMD registers.
+  bool has_simd_;
+
   // Flag whether there are any loops in the graph. We can skip loop
   // optimization if it's false. It's only best effort to keep it up
   // to date in the presence of code elimination so there might be false
index 8a9c1cc..c6a0b6a 100644 (file)
@@ -299,11 +299,14 @@ void RegisterAllocationResolver::ConnectSiblings(LiveInterval* interval) {
       // Currently, we spill unconditionnally the current method in the code generators.
       && !interval->GetDefinedBy()->IsCurrentMethod()) {
     // We spill eagerly, so move must be at definition.
-    InsertMoveAfter(interval->GetDefinedBy(),
-                    interval->ToLocation(),
-                    interval->NeedsTwoSpillSlots()
-                        ? Location::DoubleStackSlot(interval->GetParent()->GetSpillSlot())
-                        : Location::StackSlot(interval->GetParent()->GetSpillSlot()));
+    Location loc;
+    switch (interval->NumberOfSpillSlotsNeeded()) {
+      case 1: loc = Location::StackSlot(interval->GetParent()->GetSpillSlot()); break;
+      case 2: loc = Location::DoubleStackSlot(interval->GetParent()->GetSpillSlot()); break;
+      case 4: loc = Location::SIMDStackSlot(interval->GetParent()->GetSpillSlot()); break;
+      default: LOG(FATAL) << "Unexpected number of spill slots"; UNREACHABLE();
+    }
+    InsertMoveAfter(interval->GetDefinedBy(), interval->ToLocation(), loc);
   }
   UsePosition* use = current->GetFirstUse();
   EnvUsePosition* env_use = current->GetFirstEnvironmentUse();
@@ -459,9 +462,12 @@ void RegisterAllocationResolver::ConnectSplitSiblings(LiveInterval* interval,
       location_source = defined_by->GetLocations()->Out();
     } else {
       DCHECK(defined_by->IsCurrentMethod());
-      location_source = parent->NeedsTwoSpillSlots()
-          ? Location::DoubleStackSlot(parent->GetSpillSlot())
-          : Location::StackSlot(parent->GetSpillSlot());
+      switch (parent->NumberOfSpillSlotsNeeded()) {
+        case 1: location_source = Location::StackSlot(parent->GetSpillSlot()); break;
+        case 2: location_source = Location::DoubleStackSlot(parent->GetSpillSlot()); break;
+        case 4: location_source = Location::SIMDStackSlot(parent->GetSpillSlot()); break;
+        default: LOG(FATAL) << "Unexpected number of spill slots"; UNREACHABLE();
+      }
     }
   } else {
     DCHECK(source != nullptr);
@@ -492,7 +498,8 @@ static bool IsValidDestination(Location destination) {
       || destination.IsFpuRegister()
       || destination.IsFpuRegisterPair()
       || destination.IsStackSlot()
-      || destination.IsDoubleStackSlot();
+      || destination.IsDoubleStackSlot()
+      || destination.IsSIMDStackSlot();
 }
 
 void RegisterAllocationResolver::AddMove(HParallelMove* move,
index 9064f86..87f709f 100644 (file)
@@ -1029,7 +1029,7 @@ void RegisterAllocatorGraphColor::AllocateSpillSlotForCatchPhi(HInstruction* ins
       interval->SetSpillSlot(previous_phi->GetLiveInterval()->GetSpillSlot());
     } else {
       interval->SetSpillSlot(catch_phi_spill_slot_counter_);
-      catch_phi_spill_slot_counter_ += interval->NeedsTwoSpillSlots() ? 2 : 1;
+      catch_phi_spill_slot_counter_ += interval->NumberOfSpillSlotsNeeded();
     }
   }
 }
@@ -1996,43 +1996,48 @@ void RegisterAllocatorGraphColor::ColorSpillSlots(ArenaVector<LiveInterval*>* in
     bool is_interval_beginning;
     size_t position;
     std::tie(position, is_interval_beginning, parent_interval) = *it;
-
-    bool needs_two_slots = parent_interval->NeedsTwoSpillSlots();
+    size_t number_of_spill_slots_needed = parent_interval->NumberOfSpillSlotsNeeded();
 
     if (is_interval_beginning) {
       DCHECK(!parent_interval->HasSpillSlot());
       DCHECK_EQ(position, parent_interval->GetStart());
 
-      // Find a free stack slot.
+      // Find first available free stack slot(s).
       size_t slot = 0;
-      for (; taken.IsBitSet(slot) || (needs_two_slots && taken.IsBitSet(slot + 1)); ++slot) {
-        // Skip taken slots.
+      for (; ; ++slot) {
+        bool found = true;
+        for (size_t s = slot, u = slot + number_of_spill_slots_needed; s < u; s++) {
+          if (taken.IsBitSet(s)) {
+            found = false;
+            break;  // failure
+          }
+        }
+        if (found) {
+          break;  // success
+        }
       }
+
       parent_interval->SetSpillSlot(slot);
 
-      *num_stack_slots_used = std::max(*num_stack_slots_used,
-                                       needs_two_slots ? slot + 1 : slot + 2);
-      if (needs_two_slots && *num_stack_slots_used % 2 != 0) {
+      *num_stack_slots_used = std::max(*num_stack_slots_used, slot + number_of_spill_slots_needed);
+      if (number_of_spill_slots_needed > 1 && *num_stack_slots_used % 2 != 0) {
         // The parallel move resolver requires that there be an even number of spill slots
         // allocated for pair value types.
         ++(*num_stack_slots_used);
       }
 
-      taken.SetBit(slot);
-      if (needs_two_slots) {
-        taken.SetBit(slot + 1);
+      for (size_t s = slot, u = slot + number_of_spill_slots_needed; s < u; s++) {
+        taken.SetBit(s);
       }
     } else {
       DCHECK_EQ(position, parent_interval->GetLastSibling()->GetEnd());
       DCHECK(parent_interval->HasSpillSlot());
 
-      // Free up the stack slot used by this interval.
+      // Free up the stack slot(s) used by this interval.
       size_t slot = parent_interval->GetSpillSlot();
-      DCHECK(taken.IsBitSet(slot));
-      DCHECK(!needs_two_slots || taken.IsBitSet(slot + 1));
-      taken.ClearBit(slot);
-      if (needs_two_slots) {
-        taken.ClearBit(slot + 1);
+      for (size_t s = slot, u = slot + number_of_spill_slots_needed; s < u; s++) {
+        DCHECK(taken.IsBitSet(s));
+        taken.ClearBit(s);
       }
     }
   }
index 6354e76..ab8d540 100644 (file)
@@ -1125,36 +1125,31 @@ void RegisterAllocatorLinearScan::AllocateSpillSlotFor(LiveInterval* interval) {
       LOG(FATAL) << "Unexpected type for interval " << interval->GetType();
   }
 
-  // Find an available spill slot.
+  // Find first available spill slots.
+  size_t number_of_spill_slots_needed = parent->NumberOfSpillSlotsNeeded();
   size_t slot = 0;
   for (size_t e = spill_slots->size(); slot < e; ++slot) {
-    if ((*spill_slots)[slot] <= parent->GetStart()) {
-      if (!parent->NeedsTwoSpillSlots()) {
-        // One spill slot is sufficient.
-        break;
-      }
-      if (slot == e - 1 || (*spill_slots)[slot + 1] <= parent->GetStart()) {
-        // Two spill slots are available.
+    bool found = true;
+    for (size_t s = slot, u = std::min(slot + number_of_spill_slots_needed, e); s < u; s++) {
+      if ((*spill_slots)[s] > parent->GetStart()) {
+        found = false;  // failure
         break;
       }
     }
+    if (found) {
+      break;  // success
+    }
   }
 
+  // Need new spill slots?
+  size_t upper = slot + number_of_spill_slots_needed;
+  if (upper > spill_slots->size()) {
+    spill_slots->resize(upper);
+  }
+  // Set slots to end.
   size_t end = interval->GetLastSibling()->GetEnd();
-  if (parent->NeedsTwoSpillSlots()) {
-    if (slot + 2u > spill_slots->size()) {
-      // We need a new spill slot.
-      spill_slots->resize(slot + 2u, end);
-    }
-    (*spill_slots)[slot] = end;
-    (*spill_slots)[slot + 1] = end;
-  } else {
-    if (slot == spill_slots->size()) {
-      // We need a new spill slot.
-      spill_slots->push_back(end);
-    } else {
-      (*spill_slots)[slot] = end;
-    }
+  for (size_t s = slot; s < upper; s++) {
+    (*spill_slots)[s] = end;
   }
 
   // Note that the exact spill slot location will be computed when we resolve,
@@ -1180,7 +1175,7 @@ void RegisterAllocatorLinearScan::AllocateSpillSlotForCatchPhi(HPhi* phi) {
     // TODO: Reuse spill slots when intervals of phis from different catch
     //       blocks do not overlap.
     interval->SetSpillSlot(catch_phi_spill_slots_);
-    catch_phi_spill_slots_ += interval->NeedsTwoSpillSlots() ? 2 : 1;
+    catch_phi_spill_slots_ += interval->NumberOfSpillSlotsNeeded();
   }
 }
 
index 7bd38c7..eedaf6e 100644 (file)
@@ -259,7 +259,7 @@ void HSharpening::ProcessLoadString(HLoadString* load_string) {
     } else if (runtime->UseJitCompilation()) {
       // TODO: Make sure we don't set the "compile PIC" flag for JIT as that's bogus.
       // DCHECK(!codegen_->GetCompilerOptions().GetCompilePic());
-      string = class_linker->LookupString(dex_file, string_index, dex_cache);
+      string = class_linker->LookupString(dex_file, string_index, dex_cache.Get());
       if (string != nullptr) {
         if (runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
           desired_load_kind = HLoadString::LoadKind::kBootImageAddress;
@@ -271,7 +271,7 @@ void HSharpening::ProcessLoadString(HLoadString* load_string) {
       }
     } else {
       // AOT app compilation. Try to lookup the string without allocating if not found.
-      string = class_linker->LookupString(dex_file, string_index, dex_cache);
+      string = class_linker->LookupString(dex_file, string_index, dex_cache.Get());
       if (string != nullptr &&
           runtime->GetHeap()->ObjectIsInBootImageSpace(string) &&
           !codegen_->GetCompilerOptions().GetCompilePic()) {
index e8e12e1..36ee5a9 100644 (file)
@@ -469,8 +469,10 @@ bool LiveInterval::SameRegisterKind(Location other) const {
   }
 }
 
-bool LiveInterval::NeedsTwoSpillSlots() const {
-  return type_ == Primitive::kPrimLong || type_ == Primitive::kPrimDouble;
+size_t LiveInterval::NumberOfSpillSlotsNeeded() const {
+  // TODO: detect vector operation.
+  // Return number of needed spill slots based on type.
+  return (type_ == Primitive::kPrimLong || type_ == Primitive::kPrimDouble) ? 2 : 1;
 }
 
 Location LiveInterval::ToLocation() const {
@@ -494,10 +496,11 @@ Location LiveInterval::ToLocation() const {
     if (defined_by->IsConstant()) {
       return defined_by->GetLocations()->Out();
     } else if (GetParent()->HasSpillSlot()) {
-      if (NeedsTwoSpillSlots()) {
-        return Location::DoubleStackSlot(GetParent()->GetSpillSlot());
-      } else {
-        return Location::StackSlot(GetParent()->GetSpillSlot());
+      switch (NumberOfSpillSlotsNeeded()) {
+        case 1: return Location::StackSlot(GetParent()->GetSpillSlot());
+        case 2: return Location::DoubleStackSlot(GetParent()->GetSpillSlot());
+        case 4: return Location::SIMDStackSlot(GetParent()->GetSpillSlot());
+        default: LOG(FATAL) << "Unexpected number of spill slots"; UNREACHABLE();
       }
     } else {
       return Location();
index 340d0cc..e9dffc1 100644 (file)
@@ -762,9 +762,9 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> {
   // Returns kNoRegister otherwise.
   int FindHintAtDefinition() const;
 
-  // Returns whether the interval needs two (Dex virtual register size `kVRegSize`)
-  // slots for spilling.
-  bool NeedsTwoSpillSlots() const;
+  // Returns the number of required spilling slots (measured as a multiple of the
+  // Dex virtual register size `kVRegSize`).
+  size_t NumberOfSpillSlotsNeeded() const;
 
   bool IsFloatingPoint() const {
     return type_ == Primitive::kPrimFloat || type_ == Primitive::kPrimDouble;
index a289433..77ed3c6 100644 (file)
@@ -832,6 +832,24 @@ DISASSEMBLER_ENTRY(cmp,
         store = true;
         immediate_bytes = 1;
         break;
+      case 0x74:
+      case 0x75:
+      case 0x76:
+        if (prefix[2] == 0x66) {
+          src_reg_file = dst_reg_file = SSE;
+          prefix[2] = 0;  // clear prefix now it's served its purpose as part of the opcode
+        } else {
+          src_reg_file = dst_reg_file = MMX;
+        }
+        switch (*instr) {
+          case 0x74: opcode1 = "pcmpeqb"; break;
+          case 0x75: opcode1 = "pcmpeqw"; break;
+          case 0x76: opcode1 = "pcmpeqd"; break;
+        }
+        prefix[2] = 0;
+        has_modrm = true;
+        load = true;
+        break;
       case 0x7C:
         if (prefix[0] == 0xF2) {
           opcode1 = "haddps";
index fa87c8c..8162a82 100644 (file)
@@ -7821,7 +7821,7 @@ mirror::String* ClassLinker::ResolveString(const DexFile& dex_file,
 
 mirror::String* ClassLinker::LookupString(const DexFile& dex_file,
                                           dex::StringIndex string_idx,
-                                          Handle<mirror::DexCache> dex_cache) {
+                                          ObjPtr<mirror::DexCache> dex_cache) {
   DCHECK(dex_cache != nullptr);
   ObjPtr<mirror::String> resolved = dex_cache->GetResolvedString(string_idx);
   if (resolved != nullptr) {
index 6254acb..ef51d82 100644 (file)
@@ -247,7 +247,7 @@ class ClassLinker {
   // result in the DexCache if found. Return null if not found.
   mirror::String* LookupString(const DexFile& dex_file,
                                dex::StringIndex string_idx,
-                               Handle<mirror::DexCache> dex_cache)
+                               ObjPtr<mirror::DexCache> dex_cache)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Resolve a Type with the given index from the DexFile, storing the
index 48a9ecd..78b2e15 100644 (file)
@@ -426,6 +426,11 @@ class MANAGED DexCache FINAL : public Object {
                                    NativeDexCachePair<T> pair,
                                    PointerSize ptr_size);
 
+  uint32_t StringSlotIndex(dex::StringIndex string_idx) REQUIRES_SHARED(Locks::mutator_lock_);
+  uint32_t TypeSlotIndex(dex::TypeIndex type_idx) REQUIRES_SHARED(Locks::mutator_lock_);
+  uint32_t FieldSlotIndex(uint32_t field_idx) REQUIRES_SHARED(Locks::mutator_lock_);
+  uint32_t MethodTypeSlotIndex(uint32_t proto_idx) REQUIRES_SHARED(Locks::mutator_lock_);
+
  private:
   void Init(const DexFile* dex_file,
             ObjPtr<String> location,
@@ -457,11 +462,6 @@ class MANAGED DexCache FINAL : public Object {
   using ConversionPair32 = ConversionPair<uint32_t>;
   using ConversionPair64 = ConversionPair<uint64_t>;
 
-  uint32_t StringSlotIndex(dex::StringIndex string_idx) REQUIRES_SHARED(Locks::mutator_lock_);
-  uint32_t TypeSlotIndex(dex::TypeIndex type_idx) REQUIRES_SHARED(Locks::mutator_lock_);
-  uint32_t FieldSlotIndex(uint32_t field_idx) REQUIRES_SHARED(Locks::mutator_lock_);
-  uint32_t MethodTypeSlotIndex(uint32_t proto_idx) REQUIRES_SHARED(Locks::mutator_lock_);
-
   // Visit instance fields of the dex cache as well as its associated arrays.
   template <bool kVisitNativeRoots,
             VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags,
index 97c1228..9206292 100644 (file)
@@ -508,7 +508,7 @@ TEST_F(TransactionTest, ResolveString) {
   dex::StringIndex string_idx = dex_file->GetIndexForStringId(*string_id);
   ASSERT_TRUE(string_idx.IsValid());
   // String should only get resolved by the initializer.
-  EXPECT_TRUE(class_linker_->LookupString(*dex_file, string_idx, h_dex_cache) == nullptr);
+  EXPECT_TRUE(class_linker_->LookupString(*dex_file, string_idx, h_dex_cache.Get()) == nullptr);
   EXPECT_TRUE(h_dex_cache->GetResolvedString(string_idx) == nullptr);
   // Do the transaction, then roll back.
   Transaction transaction;
@@ -518,7 +518,7 @@ TEST_F(TransactionTest, ResolveString) {
   ASSERT_TRUE(h_klass->IsInitialized());
   // Make sure the string got resolved by the transaction.
   {
-    mirror::String* s = class_linker_->LookupString(*dex_file, string_idx, h_dex_cache);
+    mirror::String* s = class_linker_->LookupString(*dex_file, string_idx, h_dex_cache.Get());
     ASSERT_TRUE(s != nullptr);
     EXPECT_STREQ(s->ToModifiedUtf8().c_str(), kResolvedString);
     EXPECT_EQ(s, h_dex_cache->GetResolvedString(string_idx));
@@ -526,7 +526,7 @@ TEST_F(TransactionTest, ResolveString) {
   Runtime::Current()->ExitTransactionMode();
   transaction.Rollback();
   // Check that the string did not stay resolved.
-  EXPECT_TRUE(class_linker_->LookupString(*dex_file, string_idx, h_dex_cache) == nullptr);
+  EXPECT_TRUE(class_linker_->LookupString(*dex_file, string_idx, h_dex_cache.Get()) == nullptr);
   EXPECT_TRUE(h_dex_cache->GetResolvedString(string_idx) == nullptr);
   ASSERT_FALSE(h_klass->IsInitialized());
   ASSERT_FALSE(soa.Self()->IsExceptionPending());
diff --git a/test.py b/test.py
new file mode 100755 (executable)
index 0000000..414d779
--- /dev/null
+++ b/test.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# Copyright 2017, 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-test : To run run-test
+# --gtest : To run gtest
+# -j : Number of jobs
+# --host: for host tests
+# --target: for target tests
+# All the other arguments will be passed to the run-test testrunner.
+import sys
+import subprocess
+import os
+import argparse
+
+ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP', os.getcwd())
+
+parser = argparse.ArgumentParser()
+parser.add_argument('-j', default='', dest='n_threads')
+parser.add_argument('--run-test', '-r', action='store_true', dest='run_test')
+parser.add_argument('--gtest', '-g', action='store_true', dest='gtest')
+parser.add_argument('--target', action='store_true', dest='target')
+parser.add_argument('--host', action='store_true', dest='host')
+options, unknown = parser.parse_known_args()
+
+if options.run_test or not options.gtest:
+  testrunner = os.path.join('./',
+                          ANDROID_BUILD_TOP,
+                            'art/test/testrunner/testrunner.py')
+  run_test_args = []
+  for arg in sys.argv[1:]:
+    if arg == '--run-test' or arg == '--gtest' \
+    or arg == '-r' or arg == '-g':
+      continue
+    run_test_args.append(arg)
+
+  test_runner_cmd = [testrunner] + run_test_args
+  print test_runner_cmd
+  if subprocess.call(test_runner_cmd):
+    sys.exit(1)
+
+if options.gtest or not options.run_test:
+  build_target = ''
+  if options.host or not options.target:
+    build_target += ' test-art-host-gtest'
+  if options.target or not options.host:
+    build_target += ' test-art-target-gtest'
+
+  build_command = 'make'
+  build_command += ' -j' + str(options.n_threads)
+
+  build_command += ' -C ' + ANDROID_BUILD_TOP
+  build_command += ' ' + build_target
+  # Add 'dist' to avoid Jack issues b/36169180.
+  build_command += ' dist'
+
+  print build_command
+
+  if subprocess.call(build_command.split()):
+      sys.exit(1)
+
+sys.exit(0)
index c6cd4f8..3fc3492 100644 (file)
@@ -1,6 +1,6 @@
 JNI_OnLoad called
 thread test starting
-testThreadCapacity thread count: 512
+testThreadCapacity thread count: 128
 testThreadDaemons starting thread 'TestDaemonThread'
 testThreadDaemons @ Thread running
 testThreadDaemons @ Got expected setDaemon exception
index 2e26b22..82fc0d4 100644 (file)
@@ -35,8 +35,8 @@ public class Main {
      * Simple thread capacity test.
      */
     private static void testThreadCapacity() throws Exception {
-        TestCapacityThread[] threads = new TestCapacityThread[512];
-        for (int i = 0; i < 512; i++) {
+        TestCapacityThread[] threads = new TestCapacityThread[128];
+        for (int i = 0; i < threads.length; i++) {
             threads[i] = new TestCapacityThread();
         }
 
diff --git a/test/159-app-image-fields/expected.txt b/test/159-app-image-fields/expected.txt
new file mode 100644 (file)
index 0000000..f63e8e3
--- /dev/null
@@ -0,0 +1,3 @@
+Eating all memory.
+memoryWasAllocated = true
+match: true
diff --git a/test/159-app-image-fields/info.txt b/test/159-app-image-fields/info.txt
new file mode 100644 (file)
index 0000000..9b10078
--- /dev/null
@@ -0,0 +1,3 @@
+Regression test for erroneously storing an ArtField* in the app image DexCache
+when the class from the corresponding FieldId is not in the app image, only the
+declaring class is.
diff --git a/test/159-app-image-fields/profile b/test/159-app-image-fields/profile
new file mode 100644 (file)
index 0000000..4184fa2
--- /dev/null
@@ -0,0 +1,3 @@
+LAAA/Base;
+LMain;
+LFields;
diff --git a/test/159-app-image-fields/run b/test/159-app-image-fields/run
new file mode 100644 (file)
index 0000000..7cc107a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 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 a profile to put specific classes in the app image.
+# Also run the compiler with -j1 to ensure specific class verification order.
+exec ${RUN} $@ --profile -Xcompiler-option --compiler-filter=speed-profile \
+    -Xcompiler-option -j1
diff --git a/test/159-app-image-fields/src/AAA/Base.java b/test/159-app-image-fields/src/AAA/Base.java
new file mode 100644 (file)
index 0000000..41ee83a
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package AAA;
+
+class Base {
+    // The field is public but the class is package-private.
+    public static int value = 42;
+}
diff --git a/test/159-app-image-fields/src/AAA/Derived.java b/test/159-app-image-fields/src/AAA/Derived.java
new file mode 100644 (file)
index 0000000..f6045d5
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package AAA;
+
+public class Derived extends Base {
+    // Allows public access to Base.value (Base is package-private) referenced as Derived.value.
+}
diff --git a/test/159-app-image-fields/src/Main.java b/test/159-app-image-fields/src/Main.java
new file mode 100644 (file)
index 0000000..d06a502
--- /dev/null
@@ -0,0 +1,2156 @@
+/*
+ * Copyright (C) 2017 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 AAA.Derived;
+
+public class Main {
+    public static void main(String[] args) {
+        try {
+            // Make sure we resolve Fields before eating memory.
+            // (Making sure that the test passes in no-image configurations.)
+            Class.forName("Fields", false, Main.class.getClassLoader());
+            System.out.println("Eating all memory.");
+            Object memory = eatAllMemory();
+
+            // This test assumes that Derived is not yet resolved. In some configurations
+            // (notably interp-ac), Derived is already resolved by verifying Main at run
+            // time. Therefore we cannot assume that we get a certain `value` and need to
+            // simply check for consistency, i.e. `value == another_value`.
+            int value = 0;
+            try {
+                // If the ArtField* is erroneously left in the DexCache, this
+                // shall succeed despite the class Derived being unresolved so
+                // far. Otherwise, we shall throw OOME trying to resolve it.
+                value = Derived.value;
+            } catch (OutOfMemoryError e) {
+                value = -1;
+            }
+            Fields.clobberDexCache();
+            int another_value = 0;
+            try {
+                // Try again for comparison. Since the DexCache field array has been
+                // clobbered by Fields.clobberDexCache(), this shall throw OOME.
+                another_value = Derived.value;
+            } catch (OutOfMemoryError e) {
+                another_value = -1;
+            }
+            boolean memoryWasAllocated = (memory != null);
+            memory = null;
+            System.out.println("memoryWasAllocated = " + memoryWasAllocated);
+            System.out.println("match: " + (value == another_value));
+            if (value != another_value || (value != -1 && value != 42)) {
+                // Mismatch or unexpected value, print additional debugging information.
+                System.out.println("value: " + value);
+                System.out.println("another_value: " + another_value);
+            }
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
+
+    public static Object eatAllMemory() {
+      Object[] result = null;
+      int size = 1000000;
+      while (result == null && size != 0) {
+          try {
+              result = new Object[size];
+          } catch (OutOfMemoryError oome) {
+              size /= 2;
+          }
+      }
+      if (result != null) {
+          int index = 0;
+          while (index != result.length && size != 0) {
+              try {
+                  result[index] = new byte[size];
+                  ++index;
+              } catch (OutOfMemoryError oome) {
+                  size /= 2;
+              }
+          }
+      }
+      return result;
+  }
+}
+
+// The naming is deliberate to take into account two different situations:
+//   - eagerly preloading DexCache with the available candidate with the lowest index,
+//   - not preloading DexCache and relying on the verification to populate it.
+// This corresponds to new and old behavior, respectively.
+//
+// Eager preloading: "LFields;" is after "LAAA/Base;" and "LAAA/Derived;" so that
+// Derived.value takes priority over Fields.testField*.
+//
+// Relying on verifier: "LFields;" is before "LMain;" so that the class definition
+// of Fields precedes the definition of Main (this is not strictly required but the
+// tools look at lexicographic ordering when there is no inheritance relationship)
+// and the verification of Main is last and fills the DexCache with Derived.value.
+//
+class Fields {
+    public static int clobberDexCache() {
+        return 0
+                + testField0000
+                + testField0001
+                + testField0002
+                + testField0003
+                + testField0004
+                + testField0005
+                + testField0006
+                + testField0007
+                + testField0008
+                + testField0009
+                + testField0010
+                + testField0011
+                + testField0012
+                + testField0013
+                + testField0014
+                + testField0015
+                + testField0016
+                + testField0017
+                + testField0018
+                + testField0019
+                + testField0020
+                + testField0021
+                + testField0022
+                + testField0023
+                + testField0024
+                + testField0025
+                + testField0026
+                + testField0027
+                + testField0028
+                + testField0029
+                + testField0030
+                + testField0031
+                + testField0032
+                + testField0033
+                + testField0034
+                + testField0035
+                + testField0036
+                + testField0037
+                + testField0038
+                + testField0039
+                + testField0040
+                + testField0041
+                + testField0042
+                + testField0043
+                + testField0044
+                + testField0045
+                + testField0046
+                + testField0047
+                + testField0048
+                + testField0049
+                + testField0050
+                + testField0051
+                + testField0052
+                + testField0053
+                + testField0054
+                + testField0055
+                + testField0056
+                + testField0057
+                + testField0058
+                + testField0059
+                + testField0060
+                + testField0061
+                + testField0062
+                + testField0063
+                + testField0064
+                + testField0065
+                + testField0066
+                + testField0067
+                + testField0068
+                + testField0069
+                + testField0070
+                + testField0071
+                + testField0072
+                + testField0073
+                + testField0074
+                + testField0075
+                + testField0076
+                + testField0077
+                + testField0078
+                + testField0079
+                + testField0080
+                + testField0081
+                + testField0082
+                + testField0083
+                + testField0084
+                + testField0085
+                + testField0086
+                + testField0087
+                + testField0088
+                + testField0089
+                + testField0090
+                + testField0091
+                + testField0092
+                + testField0093
+                + testField0094
+                + testField0095
+                + testField0096
+                + testField0097
+                + testField0098
+                + testField0099
+                + testField0100
+                + testField0101
+                + testField0102
+                + testField0103
+                + testField0104
+                + testField0105
+                + testField0106
+                + testField0107
+                + testField0108
+                + testField0109
+                + testField0110
+                + testField0111
+                + testField0112
+                + testField0113
+                + testField0114
+                + testField0115
+                + testField0116
+                + testField0117
+                + testField0118
+                + testField0119
+                + testField0120
+                + testField0121
+                + testField0122
+                + testField0123
+                + testField0124
+                + testField0125
+                + testField0126
+                + testField0127
+                + testField0128
+                + testField0129
+                + testField0130
+                + testField0131
+                + testField0132
+                + testField0133
+                + testField0134
+                + testField0135
+                + testField0136
+                + testField0137
+                + testField0138
+                + testField0139
+                + testField0140
+                + testField0141
+                + testField0142
+                + testField0143
+                + testField0144
+                + testField0145
+                + testField0146
+                + testField0147
+                + testField0148
+                + testField0149
+                + testField0150
+                + testField0151
+                + testField0152
+                + testField0153
+                + testField0154
+                + testField0155
+                + testField0156
+                + testField0157
+                + testField0158
+                + testField0159
+                + testField0160
+                + testField0161
+                + testField0162
+                + testField0163
+                + testField0164
+                + testField0165
+                + testField0166
+                + testField0167
+                + testField0168
+                + testField0169
+                + testField0170
+                + testField0171
+                + testField0172
+                + testField0173
+                + testField0174
+                + testField0175
+                + testField0176
+                + testField0177
+                + testField0178
+                + testField0179
+                + testField0180
+                + testField0181
+                + testField0182
+                + testField0183
+                + testField0184
+                + testField0185
+                + testField0186
+                + testField0187
+                + testField0188
+                + testField0189
+                + testField0190
+                + testField0191
+                + testField0192
+                + testField0193
+                + testField0194
+                + testField0195
+                + testField0196
+                + testField0197
+                + testField0198
+                + testField0199
+                + testField0200
+                + testField0201
+                + testField0202
+                + testField0203
+                + testField0204
+                + testField0205
+                + testField0206
+                + testField0207
+                + testField0208
+                + testField0209
+                + testField0210
+                + testField0211
+                + testField0212
+                + testField0213
+                + testField0214
+                + testField0215
+                + testField0216
+                + testField0217
+                + testField0218
+                + testField0219
+                + testField0220
+                + testField0221
+                + testField0222
+                + testField0223
+                + testField0224
+                + testField0225
+                + testField0226
+                + testField0227
+                + testField0228
+                + testField0229
+                + testField0230
+                + testField0231
+                + testField0232
+                + testField0233
+                + testField0234
+                + testField0235
+                + testField0236
+                + testField0237
+                + testField0238
+                + testField0239
+                + testField0240
+                + testField0241
+                + testField0242
+                + testField0243
+                + testField0244
+                + testField0245
+                + testField0246
+                + testField0247
+                + testField0248
+                + testField0249
+                + testField0250
+                + testField0251
+                + testField0252
+                + testField0253
+                + testField0254
+                + testField0255
+                + testField0256
+                + testField0257
+                + testField0258
+                + testField0259
+                + testField0260
+                + testField0261
+                + testField0262
+                + testField0263
+                + testField0264
+                + testField0265
+                + testField0266
+                + testField0267
+                + testField0268
+                + testField0269
+                + testField0270
+                + testField0271
+                + testField0272
+                + testField0273
+                + testField0274
+                + testField0275
+                + testField0276
+                + testField0277
+                + testField0278
+                + testField0279
+                + testField0280
+                + testField0281
+                + testField0282
+                + testField0283
+                + testField0284
+                + testField0285
+                + testField0286
+                + testField0287
+                + testField0288
+                + testField0289
+                + testField0290
+                + testField0291
+                + testField0292
+                + testField0293
+                + testField0294
+                + testField0295
+                + testField0296
+                + testField0297
+                + testField0298
+                + testField0299
+                + testField0300
+                + testField0301
+                + testField0302
+                + testField0303
+                + testField0304
+                + testField0305
+                + testField0306
+                + testField0307
+                + testField0308
+                + testField0309
+                + testField0310
+                + testField0311
+                + testField0312
+                + testField0313
+                + testField0314
+                + testField0315
+                + testField0316
+                + testField0317
+                + testField0318
+                + testField0319
+                + testField0320
+                + testField0321
+                + testField0322
+                + testField0323
+                + testField0324
+                + testField0325
+                + testField0326
+                + testField0327
+                + testField0328
+                + testField0329
+                + testField0330
+                + testField0331
+                + testField0332
+                + testField0333
+                + testField0334
+                + testField0335
+                + testField0336
+                + testField0337
+                + testField0338
+                + testField0339
+                + testField0340
+                + testField0341
+                + testField0342
+                + testField0343
+                + testField0344
+                + testField0345
+                + testField0346
+                + testField0347
+                + testField0348
+                + testField0349
+                + testField0350
+                + testField0351
+                + testField0352
+                + testField0353
+                + testField0354
+                + testField0355
+                + testField0356
+                + testField0357
+                + testField0358
+                + testField0359
+                + testField0360
+                + testField0361
+                + testField0362
+                + testField0363
+                + testField0364
+                + testField0365
+                + testField0366
+                + testField0367
+                + testField0368
+                + testField0369
+                + testField0370
+                + testField0371
+                + testField0372
+                + testField0373
+                + testField0374
+                + testField0375
+                + testField0376
+                + testField0377
+                + testField0378
+                + testField0379
+                + testField0380
+                + testField0381
+                + testField0382
+                + testField0383
+                + testField0384
+                + testField0385
+                + testField0386
+                + testField0387
+                + testField0388
+                + testField0389
+                + testField0390
+                + testField0391
+                + testField0392
+                + testField0393
+                + testField0394
+                + testField0395
+                + testField0396
+                + testField0397
+                + testField0398
+                + testField0399
+                + testField0400
+                + testField0401
+                + testField0402
+                + testField0403
+                + testField0404
+                + testField0405
+                + testField0406
+                + testField0407
+                + testField0408
+                + testField0409
+                + testField0410
+                + testField0411
+                + testField0412
+                + testField0413
+                + testField0414
+                + testField0415
+                + testField0416
+                + testField0417
+                + testField0418
+                + testField0419
+                + testField0420
+                + testField0421
+                + testField0422
+                + testField0423
+                + testField0424
+                + testField0425
+                + testField0426
+                + testField0427
+                + testField0428
+                + testField0429
+                + testField0430
+                + testField0431
+                + testField0432
+                + testField0433
+                + testField0434
+                + testField0435
+                + testField0436
+                + testField0437
+                + testField0438
+                + testField0439
+                + testField0440
+                + testField0441
+                + testField0442
+                + testField0443
+                + testField0444
+                + testField0445
+                + testField0446
+                + testField0447
+                + testField0448
+                + testField0449
+                + testField0450
+                + testField0451
+                + testField0452
+                + testField0453
+                + testField0454
+                + testField0455
+                + testField0456
+                + testField0457
+                + testField0458
+                + testField0459
+                + testField0460
+                + testField0461
+                + testField0462
+                + testField0463
+                + testField0464
+                + testField0465
+                + testField0466
+                + testField0467
+                + testField0468
+                + testField0469
+                + testField0470
+                + testField0471
+                + testField0472
+                + testField0473
+                + testField0474
+                + testField0475
+                + testField0476
+                + testField0477
+                + testField0478
+                + testField0479
+                + testField0480
+                + testField0481
+                + testField0482
+                + testField0483
+                + testField0484
+                + testField0485
+                + testField0486
+                + testField0487
+                + testField0488
+                + testField0489
+                + testField0490
+                + testField0491
+                + testField0492
+                + testField0493
+                + testField0494
+                + testField0495
+                + testField0496
+                + testField0497
+                + testField0498
+                + testField0499
+                + testField0500
+                + testField0501
+                + testField0502
+                + testField0503
+                + testField0504
+                + testField0505
+                + testField0506
+                + testField0507
+                + testField0508
+                + testField0509
+                + testField0510
+                + testField0511
+                + testField0512
+                + testField0513
+                + testField0514
+                + testField0515
+                + testField0516
+                + testField0517
+                + testField0518
+                + testField0519
+                + testField0520
+                + testField0521
+                + testField0522
+                + testField0523
+                + testField0524
+                + testField0525
+                + testField0526
+                + testField0527
+                + testField0528
+                + testField0529
+                + testField0530
+                + testField0531
+                + testField0532
+                + testField0533
+                + testField0534
+                + testField0535
+                + testField0536
+                + testField0537
+                + testField0538
+                + testField0539
+                + testField0540
+                + testField0541
+                + testField0542
+                + testField0543
+                + testField0544
+                + testField0545
+                + testField0546
+                + testField0547
+                + testField0548
+                + testField0549
+                + testField0550
+                + testField0551
+                + testField0552
+                + testField0553
+                + testField0554
+                + testField0555
+                + testField0556
+                + testField0557
+                + testField0558
+                + testField0559
+                + testField0560
+                + testField0561
+                + testField0562
+                + testField0563
+                + testField0564
+                + testField0565
+                + testField0566
+                + testField0567
+                + testField0568
+                + testField0569
+                + testField0570
+                + testField0571
+                + testField0572
+                + testField0573
+                + testField0574
+                + testField0575
+                + testField0576
+                + testField0577
+                + testField0578
+                + testField0579
+                + testField0580
+                + testField0581
+                + testField0582
+                + testField0583
+                + testField0584
+                + testField0585
+                + testField0586
+                + testField0587
+                + testField0588
+                + testField0589
+                + testField0590
+                + testField0591
+                + testField0592
+                + testField0593
+                + testField0594
+                + testField0595
+                + testField0596
+                + testField0597
+                + testField0598
+                + testField0599
+                + testField0600
+                + testField0601
+                + testField0602
+                + testField0603
+                + testField0604
+                + testField0605
+                + testField0606
+                + testField0607
+                + testField0608
+                + testField0609
+                + testField0610
+                + testField0611
+                + testField0612
+                + testField0613
+                + testField0614
+                + testField0615
+                + testField0616
+                + testField0617
+                + testField0618
+                + testField0619
+                + testField0620
+                + testField0621
+                + testField0622
+                + testField0623
+                + testField0624
+                + testField0625
+                + testField0626
+                + testField0627
+                + testField0628
+                + testField0629
+                + testField0630
+                + testField0631
+                + testField0632
+                + testField0633
+                + testField0634
+                + testField0635
+                + testField0636
+                + testField0637
+                + testField0638
+                + testField0639
+                + testField0640
+                + testField0641
+                + testField0642
+                + testField0643
+                + testField0644
+                + testField0645
+                + testField0646
+                + testField0647
+                + testField0648
+                + testField0649
+                + testField0650
+                + testField0651
+                + testField0652
+                + testField0653
+                + testField0654
+                + testField0655
+                + testField0656
+                + testField0657
+                + testField0658
+                + testField0659
+                + testField0660
+                + testField0661
+                + testField0662
+                + testField0663
+                + testField0664
+                + testField0665
+                + testField0666
+                + testField0667
+                + testField0668
+                + testField0669
+                + testField0670
+                + testField0671
+                + testField0672
+                + testField0673
+                + testField0674
+                + testField0675
+                + testField0676
+                + testField0677
+                + testField0678
+                + testField0679
+                + testField0680
+                + testField0681
+                + testField0682
+                + testField0683
+                + testField0684
+                + testField0685
+                + testField0686
+                + testField0687
+                + testField0688
+                + testField0689
+                + testField0690
+                + testField0691
+                + testField0692
+                + testField0693
+                + testField0694
+                + testField0695
+                + testField0696
+                + testField0697
+                + testField0698
+                + testField0699
+                + testField0700
+                + testField0701
+                + testField0702
+                + testField0703
+                + testField0704
+                + testField0705
+                + testField0706
+                + testField0707
+                + testField0708
+                + testField0709
+                + testField0710
+                + testField0711
+                + testField0712
+                + testField0713
+                + testField0714
+                + testField0715
+                + testField0716
+                + testField0717
+                + testField0718
+                + testField0719
+                + testField0720
+                + testField0721
+                + testField0722
+                + testField0723
+                + testField0724
+                + testField0725
+                + testField0726
+                + testField0727
+                + testField0728
+                + testField0729
+                + testField0730
+                + testField0731
+                + testField0732
+                + testField0733
+                + testField0734
+                + testField0735
+                + testField0736
+                + testField0737
+                + testField0738
+                + testField0739
+                + testField0740
+                + testField0741
+                + testField0742
+                + testField0743
+                + testField0744
+                + testField0745
+                + testField0746
+                + testField0747
+                + testField0748
+                + testField0749
+                + testField0750
+                + testField0751
+                + testField0752
+                + testField0753
+                + testField0754
+                + testField0755
+                + testField0756
+                + testField0757
+                + testField0758
+                + testField0759
+                + testField0760
+                + testField0761
+                + testField0762
+                + testField0763
+                + testField0764
+                + testField0765
+                + testField0766
+                + testField0767
+                + testField0768
+                + testField0769
+                + testField0770
+                + testField0771
+                + testField0772
+                + testField0773
+                + testField0774
+                + testField0775
+                + testField0776
+                + testField0777
+                + testField0778
+                + testField0779
+                + testField0780
+                + testField0781
+                + testField0782
+                + testField0783
+                + testField0784
+                + testField0785
+                + testField0786
+                + testField0787
+                + testField0788
+                + testField0789
+                + testField0790
+                + testField0791
+                + testField0792
+                + testField0793
+                + testField0794
+                + testField0795
+                + testField0796
+                + testField0797
+                + testField0798
+                + testField0799
+                + testField0800
+                + testField0801
+                + testField0802
+                + testField0803
+                + testField0804
+                + testField0805
+                + testField0806
+                + testField0807
+                + testField0808
+                + testField0809
+                + testField0810
+                + testField0811
+                + testField0812
+                + testField0813
+                + testField0814
+                + testField0815
+                + testField0816
+                + testField0817
+                + testField0818
+                + testField0819
+                + testField0820
+                + testField0821
+                + testField0822
+                + testField0823
+                + testField0824
+                + testField0825
+                + testField0826
+                + testField0827
+                + testField0828
+                + testField0829
+                + testField0830
+                + testField0831
+                + testField0832
+                + testField0833
+                + testField0834
+                + testField0835
+                + testField0836
+                + testField0837
+                + testField0838
+                + testField0839
+                + testField0840
+                + testField0841
+                + testField0842
+                + testField0843
+                + testField0844
+                + testField0845
+                + testField0846
+                + testField0847
+                + testField0848
+                + testField0849
+                + testField0850
+                + testField0851
+                + testField0852
+                + testField0853
+                + testField0854
+                + testField0855
+                + testField0856
+                + testField0857
+                + testField0858
+                + testField0859
+                + testField0860
+                + testField0861
+                + testField0862
+                + testField0863
+                + testField0864
+                + testField0865
+                + testField0866
+                + testField0867
+                + testField0868
+                + testField0869
+                + testField0870
+                + testField0871
+                + testField0872
+                + testField0873
+                + testField0874
+                + testField0875
+                + testField0876
+                + testField0877
+                + testField0878
+                + testField0879
+                + testField0880
+                + testField0881
+                + testField0882
+                + testField0883
+                + testField0884
+                + testField0885
+                + testField0886
+                + testField0887
+                + testField0888
+                + testField0889
+                + testField0890
+                + testField0891
+                + testField0892
+                + testField0893
+                + testField0894
+                + testField0895
+                + testField0896
+                + testField0897
+                + testField0898
+                + testField0899
+                + testField0900
+                + testField0901
+                + testField0902
+                + testField0903
+                + testField0904
+                + testField0905
+                + testField0906
+                + testField0907
+                + testField0908
+                + testField0909
+                + testField0910
+                + testField0911
+                + testField0912
+                + testField0913
+                + testField0914
+                + testField0915
+                + testField0916
+                + testField0917
+                + testField0918
+                + testField0919
+                + testField0920
+                + testField0921
+                + testField0922
+                + testField0923
+                + testField0924
+                + testField0925
+                + testField0926
+                + testField0927
+                + testField0928
+                + testField0929
+                + testField0930
+                + testField0931
+                + testField0932
+                + testField0933
+                + testField0934
+                + testField0935
+                + testField0936
+                + testField0937
+                + testField0938
+                + testField0939
+                + testField0940
+                + testField0941
+                + testField0942
+                + testField0943
+                + testField0944
+                + testField0945
+                + testField0946
+                + testField0947
+                + testField0948
+                + testField0949
+                + testField0950
+                + testField0951
+                + testField0952
+                + testField0953
+                + testField0954
+                + testField0955
+                + testField0956
+                + testField0957
+                + testField0958
+                + testField0959
+                + testField0960
+                + testField0961
+                + testField0962
+                + testField0963
+                + testField0964
+                + testField0965
+                + testField0966
+                + testField0967
+                + testField0968
+                + testField0969
+                + testField0970
+                + testField0971
+                + testField0972
+                + testField0973
+                + testField0974
+                + testField0975
+                + testField0976
+                + testField0977
+                + testField0978
+                + testField0979
+                + testField0980
+                + testField0981
+                + testField0982
+                + testField0983
+                + testField0984
+                + testField0985
+                + testField0986
+                + testField0987
+                + testField0988
+                + testField0989
+                + testField0990
+                + testField0991
+                + testField0992
+                + testField0993
+                + testField0994
+                + testField0995
+                + testField0996
+                + testField0997
+                + testField0998
+                + testField0999
+                + testField1000
+                + testField1001
+                + testField1002
+                + testField1003
+                + testField1004
+                + testField1005
+                + testField1006
+                + testField1007
+                + testField1008
+                + testField1009
+                + testField1010
+                + testField1011
+                + testField1012
+                + testField1013
+                + testField1014
+                + testField1015
+                + testField1016
+                + testField1017
+                + testField1018
+                + testField1019
+                + testField1020
+                + testField1021
+                + testField1022
+                + testField1023
+                + 0;
+    }
+
+    private static int testField0000 = 0;
+    private static int testField0001 = 1;
+    private static int testField0002 = 2;
+    private static int testField0003 = 3;
+    private static int testField0004 = 4;
+    private static int testField0005 = 5;
+    private static int testField0006 = 6;
+    private static int testField0007 = 7;
+    private static int testField0008 = 8;
+    private static int testField0009 = 9;
+    private static int testField0010 = 10;
+    private static int testField0011 = 11;
+    private static int testField0012 = 12;
+    private static int testField0013 = 13;
+    private static int testField0014 = 14;
+    private static int testField0015 = 15;
+    private static int testField0016 = 16;
+    private static int testField0017 = 17;
+    private static int testField0018 = 18;
+    private static int testField0019 = 19;
+    private static int testField0020 = 20;
+    private static int testField0021 = 21;
+    private static int testField0022 = 22;
+    private static int testField0023 = 23;
+    private static int testField0024 = 24;
+    private static int testField0025 = 25;
+    private static int testField0026 = 26;
+    private static int testField0027 = 27;
+    private static int testField0028 = 28;
+    private static int testField0029 = 29;
+    private static int testField0030 = 30;
+    private static int testField0031 = 31;
+    private static int testField0032 = 32;
+    private static int testField0033 = 33;
+    private static int testField0034 = 34;
+    private static int testField0035 = 35;
+    private static int testField0036 = 36;
+    private static int testField0037 = 37;
+    private static int testField0038 = 38;
+    private static int testField0039 = 39;
+    private static int testField0040 = 40;
+    private static int testField0041 = 41;
+    private static int testField0042 = 42;
+    private static int testField0043 = 43;
+    private static int testField0044 = 44;
+    private static int testField0045 = 45;
+    private static int testField0046 = 46;
+    private static int testField0047 = 47;
+    private static int testField0048 = 48;
+    private static int testField0049 = 49;
+    private static int testField0050 = 50;
+    private static int testField0051 = 51;
+    private static int testField0052 = 52;
+    private static int testField0053 = 53;
+    private static int testField0054 = 54;
+    private static int testField0055 = 55;
+    private static int testField0056 = 56;
+    private static int testField0057 = 57;
+    private static int testField0058 = 58;
+    private static int testField0059 = 59;
+    private static int testField0060 = 60;
+    private static int testField0061 = 61;
+    private static int testField0062 = 62;
+    private static int testField0063 = 63;
+    private static int testField0064 = 64;
+    private static int testField0065 = 65;
+    private static int testField0066 = 66;
+    private static int testField0067 = 67;
+    private static int testField0068 = 68;
+    private static int testField0069 = 69;
+    private static int testField0070 = 70;
+    private static int testField0071 = 71;
+    private static int testField0072 = 72;
+    private static int testField0073 = 73;
+    private static int testField0074 = 74;
+    private static int testField0075 = 75;
+    private static int testField0076 = 76;
+    private static int testField0077 = 77;
+    private static int testField0078 = 78;
+    private static int testField0079 = 79;
+    private static int testField0080 = 80;
+    private static int testField0081 = 81;
+    private static int testField0082 = 82;
+    private static int testField0083 = 83;
+    private static int testField0084 = 84;
+    private static int testField0085 = 85;
+    private static int testField0086 = 86;
+    private static int testField0087 = 87;
+    private static int testField0088 = 88;
+    private static int testField0089 = 89;
+    private static int testField0090 = 90;
+    private static int testField0091 = 91;
+    private static int testField0092 = 92;
+    private static int testField0093 = 93;
+    private static int testField0094 = 94;
+    private static int testField0095 = 95;
+    private static int testField0096 = 96;
+    private static int testField0097 = 97;
+    private static int testField0098 = 98;
+    private static int testField0099 = 99;
+    private static int testField0100 = 100;
+    private static int testField0101 = 101;
+    private static int testField0102 = 102;
+    private static int testField0103 = 103;
+    private static int testField0104 = 104;
+    private static int testField0105 = 105;
+    private static int testField0106 = 106;
+    private static int testField0107 = 107;
+    private static int testField0108 = 108;
+    private static int testField0109 = 109;
+    private static int testField0110 = 110;
+    private static int testField0111 = 111;
+    private static int testField0112 = 112;
+    private static int testField0113 = 113;
+    private static int testField0114 = 114;
+    private static int testField0115 = 115;
+    private static int testField0116 = 116;
+    private static int testField0117 = 117;
+    private static int testField0118 = 118;
+    private static int testField0119 = 119;
+    private static int testField0120 = 120;
+    private static int testField0121 = 121;
+    private static int testField0122 = 122;
+    private static int testField0123 = 123;
+    private static int testField0124 = 124;
+    private static int testField0125 = 125;
+    private static int testField0126 = 126;
+    private static int testField0127 = 127;
+    private static int testField0128 = 128;
+    private static int testField0129 = 129;
+    private static int testField0130 = 130;
+    private static int testField0131 = 131;
+    private static int testField0132 = 132;
+    private static int testField0133 = 133;
+    private static int testField0134 = 134;
+    private static int testField0135 = 135;
+    private static int testField0136 = 136;
+    private static int testField0137 = 137;
+    private static int testField0138 = 138;
+    private static int testField0139 = 139;
+    private static int testField0140 = 140;
+    private static int testField0141 = 141;
+    private static int testField0142 = 142;
+    private static int testField0143 = 143;
+    private static int testField0144 = 144;
+    private static int testField0145 = 145;
+    private static int testField0146 = 146;
+    private static int testField0147 = 147;
+    private static int testField0148 = 148;
+    private static int testField0149 = 149;
+    private static int testField0150 = 150;
+    private static int testField0151 = 151;
+    private static int testField0152 = 152;
+    private static int testField0153 = 153;
+    private static int testField0154 = 154;
+    private static int testField0155 = 155;
+    private static int testField0156 = 156;
+    private static int testField0157 = 157;
+    private static int testField0158 = 158;
+    private static int testField0159 = 159;
+    private static int testField0160 = 160;
+    private static int testField0161 = 161;
+    private static int testField0162 = 162;
+    private static int testField0163 = 163;
+    private static int testField0164 = 164;
+    private static int testField0165 = 165;
+    private static int testField0166 = 166;
+    private static int testField0167 = 167;
+    private static int testField0168 = 168;
+    private static int testField0169 = 169;
+    private static int testField0170 = 170;
+    private static int testField0171 = 171;
+    private static int testField0172 = 172;
+    private static int testField0173 = 173;
+    private static int testField0174 = 174;
+    private static int testField0175 = 175;
+    private static int testField0176 = 176;
+    private static int testField0177 = 177;
+    private static int testField0178 = 178;
+    private static int testField0179 = 179;
+    private static int testField0180 = 180;
+    private static int testField0181 = 181;
+    private static int testField0182 = 182;
+    private static int testField0183 = 183;
+    private static int testField0184 = 184;
+    private static int testField0185 = 185;
+    private static int testField0186 = 186;
+    private static int testField0187 = 187;
+    private static int testField0188 = 188;
+    private static int testField0189 = 189;
+    private static int testField0190 = 190;
+    private static int testField0191 = 191;
+    private static int testField0192 = 192;
+    private static int testField0193 = 193;
+    private static int testField0194 = 194;
+    private static int testField0195 = 195;
+    private static int testField0196 = 196;
+    private static int testField0197 = 197;
+    private static int testField0198 = 198;
+    private static int testField0199 = 199;
+    private static int testField0200 = 200;
+    private static int testField0201 = 201;
+    private static int testField0202 = 202;
+    private static int testField0203 = 203;
+    private static int testField0204 = 204;
+    private static int testField0205 = 205;
+    private static int testField0206 = 206;
+    private static int testField0207 = 207;
+    private static int testField0208 = 208;
+    private static int testField0209 = 209;
+    private static int testField0210 = 210;
+    private static int testField0211 = 211;
+    private static int testField0212 = 212;
+    private static int testField0213 = 213;
+    private static int testField0214 = 214;
+    private static int testField0215 = 215;
+    private static int testField0216 = 216;
+    private static int testField0217 = 217;
+    private static int testField0218 = 218;
+    private static int testField0219 = 219;
+    private static int testField0220 = 220;
+    private static int testField0221 = 221;
+    private static int testField0222 = 222;
+    private static int testField0223 = 223;
+    private static int testField0224 = 224;
+    private static int testField0225 = 225;
+    private static int testField0226 = 226;
+    private static int testField0227 = 227;
+    private static int testField0228 = 228;
+    private static int testField0229 = 229;
+    private static int testField0230 = 230;
+    private static int testField0231 = 231;
+    private static int testField0232 = 232;
+    private static int testField0233 = 233;
+    private static int testField0234 = 234;
+    private static int testField0235 = 235;
+    private static int testField0236 = 236;
+    private static int testField0237 = 237;
+    private static int testField0238 = 238;
+    private static int testField0239 = 239;
+    private static int testField0240 = 240;
+    private static int testField0241 = 241;
+    private static int testField0242 = 242;
+    private static int testField0243 = 243;
+    private static int testField0244 = 244;
+    private static int testField0245 = 245;
+    private static int testField0246 = 246;
+    private static int testField0247 = 247;
+    private static int testField0248 = 248;
+    private static int testField0249 = 249;
+    private static int testField0250 = 250;
+    private static int testField0251 = 251;
+    private static int testField0252 = 252;
+    private static int testField0253 = 253;
+    private static int testField0254 = 254;
+    private static int testField0255 = 255;
+    private static int testField0256 = 256;
+    private static int testField0257 = 257;
+    private static int testField0258 = 258;
+    private static int testField0259 = 259;
+    private static int testField0260 = 260;
+    private static int testField0261 = 261;
+    private static int testField0262 = 262;
+    private static int testField0263 = 263;
+    private static int testField0264 = 264;
+    private static int testField0265 = 265;
+    private static int testField0266 = 266;
+    private static int testField0267 = 267;
+    private static int testField0268 = 268;
+    private static int testField0269 = 269;
+    private static int testField0270 = 270;
+    private static int testField0271 = 271;
+    private static int testField0272 = 272;
+    private static int testField0273 = 273;
+    private static int testField0274 = 274;
+    private static int testField0275 = 275;
+    private static int testField0276 = 276;
+    private static int testField0277 = 277;
+    private static int testField0278 = 278;
+    private static int testField0279 = 279;
+    private static int testField0280 = 280;
+    private static int testField0281 = 281;
+    private static int testField0282 = 282;
+    private static int testField0283 = 283;
+    private static int testField0284 = 284;
+    private static int testField0285 = 285;
+    private static int testField0286 = 286;
+    private static int testField0287 = 287;
+    private static int testField0288 = 288;
+    private static int testField0289 = 289;
+    private static int testField0290 = 290;
+    private static int testField0291 = 291;
+    private static int testField0292 = 292;
+    private static int testField0293 = 293;
+    private static int testField0294 = 294;
+    private static int testField0295 = 295;
+    private static int testField0296 = 296;
+    private static int testField0297 = 297;
+    private static int testField0298 = 298;
+    private static int testField0299 = 299;
+    private static int testField0300 = 300;
+    private static int testField0301 = 301;
+    private static int testField0302 = 302;
+    private static int testField0303 = 303;
+    private static int testField0304 = 304;
+    private static int testField0305 = 305;
+    private static int testField0306 = 306;
+    private static int testField0307 = 307;
+    private static int testField0308 = 308;
+    private static int testField0309 = 309;
+    private static int testField0310 = 310;
+    private static int testField0311 = 311;
+    private static int testField0312 = 312;
+    private static int testField0313 = 313;
+    private static int testField0314 = 314;
+    private static int testField0315 = 315;
+    private static int testField0316 = 316;
+    private static int testField0317 = 317;
+    private static int testField0318 = 318;
+    private static int testField0319 = 319;
+    private static int testField0320 = 320;
+    private static int testField0321 = 321;
+    private static int testField0322 = 322;
+    private static int testField0323 = 323;
+    private static int testField0324 = 324;
+    private static int testField0325 = 325;
+    private static int testField0326 = 326;
+    private static int testField0327 = 327;
+    private static int testField0328 = 328;
+    private static int testField0329 = 329;
+    private static int testField0330 = 330;
+    private static int testField0331 = 331;
+    private static int testField0332 = 332;
+    private static int testField0333 = 333;
+    private static int testField0334 = 334;
+    private static int testField0335 = 335;
+    private static int testField0336 = 336;
+    private static int testField0337 = 337;
+    private static int testField0338 = 338;
+    private static int testField0339 = 339;
+    private static int testField0340 = 340;
+    private static int testField0341 = 341;
+    private static int testField0342 = 342;
+    private static int testField0343 = 343;
+    private static int testField0344 = 344;
+    private static int testField0345 = 345;
+    private static int testField0346 = 346;
+    private static int testField0347 = 347;
+    private static int testField0348 = 348;
+    private static int testField0349 = 349;
+    private static int testField0350 = 350;
+    private static int testField0351 = 351;
+    private static int testField0352 = 352;
+    private static int testField0353 = 353;
+    private static int testField0354 = 354;
+    private static int testField0355 = 355;
+    private static int testField0356 = 356;
+    private static int testField0357 = 357;
+    private static int testField0358 = 358;
+    private static int testField0359 = 359;
+    private static int testField0360 = 360;
+    private static int testField0361 = 361;
+    private static int testField0362 = 362;
+    private static int testField0363 = 363;
+    private static int testField0364 = 364;
+    private static int testField0365 = 365;
+    private static int testField0366 = 366;
+    private static int testField0367 = 367;
+    private static int testField0368 = 368;
+    private static int testField0369 = 369;
+    private static int testField0370 = 370;
+    private static int testField0371 = 371;
+    private static int testField0372 = 372;
+    private static int testField0373 = 373;
+    private static int testField0374 = 374;
+    private static int testField0375 = 375;
+    private static int testField0376 = 376;
+    private static int testField0377 = 377;
+    private static int testField0378 = 378;
+    private static int testField0379 = 379;
+    private static int testField0380 = 380;
+    private static int testField0381 = 381;
+    private static int testField0382 = 382;
+    private static int testField0383 = 383;
+    private static int testField0384 = 384;
+    private static int testField0385 = 385;
+    private static int testField0386 = 386;
+    private static int testField0387 = 387;
+    private static int testField0388 = 388;
+    private static int testField0389 = 389;
+    private static int testField0390 = 390;
+    private static int testField0391 = 391;
+    private static int testField0392 = 392;
+    private static int testField0393 = 393;
+    private static int testField0394 = 394;
+    private static int testField0395 = 395;
+    private static int testField0396 = 396;
+    private static int testField0397 = 397;
+    private static int testField0398 = 398;
+    private static int testField0399 = 399;
+    private static int testField0400 = 400;
+    private static int testField0401 = 401;
+    private static int testField0402 = 402;
+    private static int testField0403 = 403;
+    private static int testField0404 = 404;
+    private static int testField0405 = 405;
+    private static int testField0406 = 406;
+    private static int testField0407 = 407;
+    private static int testField0408 = 408;
+    private static int testField0409 = 409;
+    private static int testField0410 = 410;
+    private static int testField0411 = 411;
+    private static int testField0412 = 412;
+    private static int testField0413 = 413;
+    private static int testField0414 = 414;
+    private static int testField0415 = 415;
+    private static int testField0416 = 416;
+    private static int testField0417 = 417;
+    private static int testField0418 = 418;
+    private static int testField0419 = 419;
+    private static int testField0420 = 420;
+    private static int testField0421 = 421;
+    private static int testField0422 = 422;
+    private static int testField0423 = 423;
+    private static int testField0424 = 424;
+    private static int testField0425 = 425;
+    private static int testField0426 = 426;
+    private static int testField0427 = 427;
+    private static int testField0428 = 428;
+    private static int testField0429 = 429;
+    private static int testField0430 = 430;
+    private static int testField0431 = 431;
+    private static int testField0432 = 432;
+    private static int testField0433 = 433;
+    private static int testField0434 = 434;
+    private static int testField0435 = 435;
+    private static int testField0436 = 436;
+    private static int testField0437 = 437;
+    private static int testField0438 = 438;
+    private static int testField0439 = 439;
+    private static int testField0440 = 440;
+    private static int testField0441 = 441;
+    private static int testField0442 = 442;
+    private static int testField0443 = 443;
+    private static int testField0444 = 444;
+    private static int testField0445 = 445;
+    private static int testField0446 = 446;
+    private static int testField0447 = 447;
+    private static int testField0448 = 448;
+    private static int testField0449 = 449;
+    private static int testField0450 = 450;
+    private static int testField0451 = 451;
+    private static int testField0452 = 452;
+    private static int testField0453 = 453;
+    private static int testField0454 = 454;
+    private static int testField0455 = 455;
+    private static int testField0456 = 456;
+    private static int testField0457 = 457;
+    private static int testField0458 = 458;
+    private static int testField0459 = 459;
+    private static int testField0460 = 460;
+    private static int testField0461 = 461;
+    private static int testField0462 = 462;
+    private static int testField0463 = 463;
+    private static int testField0464 = 464;
+    private static int testField0465 = 465;
+    private static int testField0466 = 466;
+    private static int testField0467 = 467;
+    private static int testField0468 = 468;
+    private static int testField0469 = 469;
+    private static int testField0470 = 470;
+    private static int testField0471 = 471;
+    private static int testField0472 = 472;
+    private static int testField0473 = 473;
+    private static int testField0474 = 474;
+    private static int testField0475 = 475;
+    private static int testField0476 = 476;
+    private static int testField0477 = 477;
+    private static int testField0478 = 478;
+    private static int testField0479 = 479;
+    private static int testField0480 = 480;
+    private static int testField0481 = 481;
+    private static int testField0482 = 482;
+    private static int testField0483 = 483;
+    private static int testField0484 = 484;
+    private static int testField0485 = 485;
+    private static int testField0486 = 486;
+    private static int testField0487 = 487;
+    private static int testField0488 = 488;
+    private static int testField0489 = 489;
+    private static int testField0490 = 490;
+    private static int testField0491 = 491;
+    private static int testField0492 = 492;
+    private static int testField0493 = 493;
+    private static int testField0494 = 494;
+    private static int testField0495 = 495;
+    private static int testField0496 = 496;
+    private static int testField0497 = 497;
+    private static int testField0498 = 498;
+    private static int testField0499 = 499;
+    private static int testField0500 = 500;
+    private static int testField0501 = 501;
+    private static int testField0502 = 502;
+    private static int testField0503 = 503;
+    private static int testField0504 = 504;
+    private static int testField0505 = 505;
+    private static int testField0506 = 506;
+    private static int testField0507 = 507;
+    private static int testField0508 = 508;
+    private static int testField0509 = 509;
+    private static int testField0510 = 510;
+    private static int testField0511 = 511;
+    private static int testField0512 = 512;
+    private static int testField0513 = 513;
+    private static int testField0514 = 514;
+    private static int testField0515 = 515;
+    private static int testField0516 = 516;
+    private static int testField0517 = 517;
+    private static int testField0518 = 518;
+    private static int testField0519 = 519;
+    private static int testField0520 = 520;
+    private static int testField0521 = 521;
+    private static int testField0522 = 522;
+    private static int testField0523 = 523;
+    private static int testField0524 = 524;
+    private static int testField0525 = 525;
+    private static int testField0526 = 526;
+    private static int testField0527 = 527;
+    private static int testField0528 = 528;
+    private static int testField0529 = 529;
+    private static int testField0530 = 530;
+    private static int testField0531 = 531;
+    private static int testField0532 = 532;
+    private static int testField0533 = 533;
+    private static int testField0534 = 534;
+    private static int testField0535 = 535;
+    private static int testField0536 = 536;
+    private static int testField0537 = 537;
+    private static int testField0538 = 538;
+    private static int testField0539 = 539;
+    private static int testField0540 = 540;
+    private static int testField0541 = 541;
+    private static int testField0542 = 542;
+    private static int testField0543 = 543;
+    private static int testField0544 = 544;
+    private static int testField0545 = 545;
+    private static int testField0546 = 546;
+    private static int testField0547 = 547;
+    private static int testField0548 = 548;
+    private static int testField0549 = 549;
+    private static int testField0550 = 550;
+    private static int testField0551 = 551;
+    private static int testField0552 = 552;
+    private static int testField0553 = 553;
+    private static int testField0554 = 554;
+    private static int testField0555 = 555;
+    private static int testField0556 = 556;
+    private static int testField0557 = 557;
+    private static int testField0558 = 558;
+    private static int testField0559 = 559;
+    private static int testField0560 = 560;
+    private static int testField0561 = 561;
+    private static int testField0562 = 562;
+    private static int testField0563 = 563;
+    private static int testField0564 = 564;
+    private static int testField0565 = 565;
+    private static int testField0566 = 566;
+    private static int testField0567 = 567;
+    private static int testField0568 = 568;
+    private static int testField0569 = 569;
+    private static int testField0570 = 570;
+    private static int testField0571 = 571;
+    private static int testField0572 = 572;
+    private static int testField0573 = 573;
+    private static int testField0574 = 574;
+    private static int testField0575 = 575;
+    private static int testField0576 = 576;
+    private static int testField0577 = 577;
+    private static int testField0578 = 578;
+    private static int testField0579 = 579;
+    private static int testField0580 = 580;
+    private static int testField0581 = 581;
+    private static int testField0582 = 582;
+    private static int testField0583 = 583;
+    private static int testField0584 = 584;
+    private static int testField0585 = 585;
+    private static int testField0586 = 586;
+    private static int testField0587 = 587;
+    private static int testField0588 = 588;
+    private static int testField0589 = 589;
+    private static int testField0590 = 590;
+    private static int testField0591 = 591;
+    private static int testField0592 = 592;
+    private static int testField0593 = 593;
+    private static int testField0594 = 594;
+    private static int testField0595 = 595;
+    private static int testField0596 = 596;
+    private static int testField0597 = 597;
+    private static int testField0598 = 598;
+    private static int testField0599 = 599;
+    private static int testField0600 = 600;
+    private static int testField0601 = 601;
+    private static int testField0602 = 602;
+    private static int testField0603 = 603;
+    private static int testField0604 = 604;
+    private static int testField0605 = 605;
+    private static int testField0606 = 606;
+    private static int testField0607 = 607;
+    private static int testField0608 = 608;
+    private static int testField0609 = 609;
+    private static int testField0610 = 610;
+    private static int testField0611 = 611;
+    private static int testField0612 = 612;
+    private static int testField0613 = 613;
+    private static int testField0614 = 614;
+    private static int testField0615 = 615;
+    private static int testField0616 = 616;
+    private static int testField0617 = 617;
+    private static int testField0618 = 618;
+    private static int testField0619 = 619;
+    private static int testField0620 = 620;
+    private static int testField0621 = 621;
+    private static int testField0622 = 622;
+    private static int testField0623 = 623;
+    private static int testField0624 = 624;
+    private static int testField0625 = 625;
+    private static int testField0626 = 626;
+    private static int testField0627 = 627;
+    private static int testField0628 = 628;
+    private static int testField0629 = 629;
+    private static int testField0630 = 630;
+    private static int testField0631 = 631;
+    private static int testField0632 = 632;
+    private static int testField0633 = 633;
+    private static int testField0634 = 634;
+    private static int testField0635 = 635;
+    private static int testField0636 = 636;
+    private static int testField0637 = 637;
+    private static int testField0638 = 638;
+    private static int testField0639 = 639;
+    private static int testField0640 = 640;
+    private static int testField0641 = 641;
+    private static int testField0642 = 642;
+    private static int testField0643 = 643;
+    private static int testField0644 = 644;
+    private static int testField0645 = 645;
+    private static int testField0646 = 646;
+    private static int testField0647 = 647;
+    private static int testField0648 = 648;
+    private static int testField0649 = 649;
+    private static int testField0650 = 650;
+    private static int testField0651 = 651;
+    private static int testField0652 = 652;
+    private static int testField0653 = 653;
+    private static int testField0654 = 654;
+    private static int testField0655 = 655;
+    private static int testField0656 = 656;
+    private static int testField0657 = 657;
+    private static int testField0658 = 658;
+    private static int testField0659 = 659;
+    private static int testField0660 = 660;
+    private static int testField0661 = 661;
+    private static int testField0662 = 662;
+    private static int testField0663 = 663;
+    private static int testField0664 = 664;
+    private static int testField0665 = 665;
+    private static int testField0666 = 666;
+    private static int testField0667 = 667;
+    private static int testField0668 = 668;
+    private static int testField0669 = 669;
+    private static int testField0670 = 670;
+    private static int testField0671 = 671;
+    private static int testField0672 = 672;
+    private static int testField0673 = 673;
+    private static int testField0674 = 674;
+    private static int testField0675 = 675;
+    private static int testField0676 = 676;
+    private static int testField0677 = 677;
+    private static int testField0678 = 678;
+    private static int testField0679 = 679;
+    private static int testField0680 = 680;
+    private static int testField0681 = 681;
+    private static int testField0682 = 682;
+    private static int testField0683 = 683;
+    private static int testField0684 = 684;
+    private static int testField0685 = 685;
+    private static int testField0686 = 686;
+    private static int testField0687 = 687;
+    private static int testField0688 = 688;
+    private static int testField0689 = 689;
+    private static int testField0690 = 690;
+    private static int testField0691 = 691;
+    private static int testField0692 = 692;
+    private static int testField0693 = 693;
+    private static int testField0694 = 694;
+    private static int testField0695 = 695;
+    private static int testField0696 = 696;
+    private static int testField0697 = 697;
+    private static int testField0698 = 698;
+    private static int testField0699 = 699;
+    private static int testField0700 = 700;
+    private static int testField0701 = 701;
+    private static int testField0702 = 702;
+    private static int testField0703 = 703;
+    private static int testField0704 = 704;
+    private static int testField0705 = 705;
+    private static int testField0706 = 706;
+    private static int testField0707 = 707;
+    private static int testField0708 = 708;
+    private static int testField0709 = 709;
+    private static int testField0710 = 710;
+    private static int testField0711 = 711;
+    private static int testField0712 = 712;
+    private static int testField0713 = 713;
+    private static int testField0714 = 714;
+    private static int testField0715 = 715;
+    private static int testField0716 = 716;
+    private static int testField0717 = 717;
+    private static int testField0718 = 718;
+    private static int testField0719 = 719;
+    private static int testField0720 = 720;
+    private static int testField0721 = 721;
+    private static int testField0722 = 722;
+    private static int testField0723 = 723;
+    private static int testField0724 = 724;
+    private static int testField0725 = 725;
+    private static int testField0726 = 726;
+    private static int testField0727 = 727;
+    private static int testField0728 = 728;
+    private static int testField0729 = 729;
+    private static int testField0730 = 730;
+    private static int testField0731 = 731;
+    private static int testField0732 = 732;
+    private static int testField0733 = 733;
+    private static int testField0734 = 734;
+    private static int testField0735 = 735;
+    private static int testField0736 = 736;
+    private static int testField0737 = 737;
+    private static int testField0738 = 738;
+    private static int testField0739 = 739;
+    private static int testField0740 = 740;
+    private static int testField0741 = 741;
+    private static int testField0742 = 742;
+    private static int testField0743 = 743;
+    private static int testField0744 = 744;
+    private static int testField0745 = 745;
+    private static int testField0746 = 746;
+    private static int testField0747 = 747;
+    private static int testField0748 = 748;
+    private static int testField0749 = 749;
+    private static int testField0750 = 750;
+    private static int testField0751 = 751;
+    private static int testField0752 = 752;
+    private static int testField0753 = 753;
+    private static int testField0754 = 754;
+    private static int testField0755 = 755;
+    private static int testField0756 = 756;
+    private static int testField0757 = 757;
+    private static int testField0758 = 758;
+    private static int testField0759 = 759;
+    private static int testField0760 = 760;
+    private static int testField0761 = 761;
+    private static int testField0762 = 762;
+    private static int testField0763 = 763;
+    private static int testField0764 = 764;
+    private static int testField0765 = 765;
+    private static int testField0766 = 766;
+    private static int testField0767 = 767;
+    private static int testField0768 = 768;
+    private static int testField0769 = 769;
+    private static int testField0770 = 770;
+    private static int testField0771 = 771;
+    private static int testField0772 = 772;
+    private static int testField0773 = 773;
+    private static int testField0774 = 774;
+    private static int testField0775 = 775;
+    private static int testField0776 = 776;
+    private static int testField0777 = 777;
+    private static int testField0778 = 778;
+    private static int testField0779 = 779;
+    private static int testField0780 = 780;
+    private static int testField0781 = 781;
+    private static int testField0782 = 782;
+    private static int testField0783 = 783;
+    private static int testField0784 = 784;
+    private static int testField0785 = 785;
+    private static int testField0786 = 786;
+    private static int testField0787 = 787;
+    private static int testField0788 = 788;
+    private static int testField0789 = 789;
+    private static int testField0790 = 790;
+    private static int testField0791 = 791;
+    private static int testField0792 = 792;
+    private static int testField0793 = 793;
+    private static int testField0794 = 794;
+    private static int testField0795 = 795;
+    private static int testField0796 = 796;
+    private static int testField0797 = 797;
+    private static int testField0798 = 798;
+    private static int testField0799 = 799;
+    private static int testField0800 = 800;
+    private static int testField0801 = 801;
+    private static int testField0802 = 802;
+    private static int testField0803 = 803;
+    private static int testField0804 = 804;
+    private static int testField0805 = 805;
+    private static int testField0806 = 806;
+    private static int testField0807 = 807;
+    private static int testField0808 = 808;
+    private static int testField0809 = 809;
+    private static int testField0810 = 810;
+    private static int testField0811 = 811;
+    private static int testField0812 = 812;
+    private static int testField0813 = 813;
+    private static int testField0814 = 814;
+    private static int testField0815 = 815;
+    private static int testField0816 = 816;
+    private static int testField0817 = 817;
+    private static int testField0818 = 818;
+    private static int testField0819 = 819;
+    private static int testField0820 = 820;
+    private static int testField0821 = 821;
+    private static int testField0822 = 822;
+    private static int testField0823 = 823;
+    private static int testField0824 = 824;
+    private static int testField0825 = 825;
+    private static int testField0826 = 826;
+    private static int testField0827 = 827;
+    private static int testField0828 = 828;
+    private static int testField0829 = 829;
+    private static int testField0830 = 830;
+    private static int testField0831 = 831;
+    private static int testField0832 = 832;
+    private static int testField0833 = 833;
+    private static int testField0834 = 834;
+    private static int testField0835 = 835;
+    private static int testField0836 = 836;
+    private static int testField0837 = 837;
+    private static int testField0838 = 838;
+    private static int testField0839 = 839;
+    private static int testField0840 = 840;
+    private static int testField0841 = 841;
+    private static int testField0842 = 842;
+    private static int testField0843 = 843;
+    private static int testField0844 = 844;
+    private static int testField0845 = 845;
+    private static int testField0846 = 846;
+    private static int testField0847 = 847;
+    private static int testField0848 = 848;
+    private static int testField0849 = 849;
+    private static int testField0850 = 850;
+    private static int testField0851 = 851;
+    private static int testField0852 = 852;
+    private static int testField0853 = 853;
+    private static int testField0854 = 854;
+    private static int testField0855 = 855;
+    private static int testField0856 = 856;
+    private static int testField0857 = 857;
+    private static int testField0858 = 858;
+    private static int testField0859 = 859;
+    private static int testField0860 = 860;
+    private static int testField0861 = 861;
+    private static int testField0862 = 862;
+    private static int testField0863 = 863;
+    private static int testField0864 = 864;
+    private static int testField0865 = 865;
+    private static int testField0866 = 866;
+    private static int testField0867 = 867;
+    private static int testField0868 = 868;
+    private static int testField0869 = 869;
+    private static int testField0870 = 870;
+    private static int testField0871 = 871;
+    private static int testField0872 = 872;
+    private static int testField0873 = 873;
+    private static int testField0874 = 874;
+    private static int testField0875 = 875;
+    private static int testField0876 = 876;
+    private static int testField0877 = 877;
+    private static int testField0878 = 878;
+    private static int testField0879 = 879;
+    private static int testField0880 = 880;
+    private static int testField0881 = 881;
+    private static int testField0882 = 882;
+    private static int testField0883 = 883;
+    private static int testField0884 = 884;
+    private static int testField0885 = 885;
+    private static int testField0886 = 886;
+    private static int testField0887 = 887;
+    private static int testField0888 = 888;
+    private static int testField0889 = 889;
+    private static int testField0890 = 890;
+    private static int testField0891 = 891;
+    private static int testField0892 = 892;
+    private static int testField0893 = 893;
+    private static int testField0894 = 894;
+    private static int testField0895 = 895;
+    private static int testField0896 = 896;
+    private static int testField0897 = 897;
+    private static int testField0898 = 898;
+    private static int testField0899 = 899;
+    private static int testField0900 = 900;
+    private static int testField0901 = 901;
+    private static int testField0902 = 902;
+    private static int testField0903 = 903;
+    private static int testField0904 = 904;
+    private static int testField0905 = 905;
+    private static int testField0906 = 906;
+    private static int testField0907 = 907;
+    private static int testField0908 = 908;
+    private static int testField0909 = 909;
+    private static int testField0910 = 910;
+    private static int testField0911 = 911;
+    private static int testField0912 = 912;
+    private static int testField0913 = 913;
+    private static int testField0914 = 914;
+    private static int testField0915 = 915;
+    private static int testField0916 = 916;
+    private static int testField0917 = 917;
+    private static int testField0918 = 918;
+    private static int testField0919 = 919;
+    private static int testField0920 = 920;
+    private static int testField0921 = 921;
+    private static int testField0922 = 922;
+    private static int testField0923 = 923;
+    private static int testField0924 = 924;
+    private static int testField0925 = 925;
+    private static int testField0926 = 926;
+    private static int testField0927 = 927;
+    private static int testField0928 = 928;
+    private static int testField0929 = 929;
+    private static int testField0930 = 930;
+    private static int testField0931 = 931;
+    private static int testField0932 = 932;
+    private static int testField0933 = 933;
+    private static int testField0934 = 934;
+    private static int testField0935 = 935;
+    private static int testField0936 = 936;
+    private static int testField0937 = 937;
+    private static int testField0938 = 938;
+    private static int testField0939 = 939;
+    private static int testField0940 = 940;
+    private static int testField0941 = 941;
+    private static int testField0942 = 942;
+    private static int testField0943 = 943;
+    private static int testField0944 = 944;
+    private static int testField0945 = 945;
+    private static int testField0946 = 946;
+    private static int testField0947 = 947;
+    private static int testField0948 = 948;
+    private static int testField0949 = 949;
+    private static int testField0950 = 950;
+    private static int testField0951 = 951;
+    private static int testField0952 = 952;
+    private static int testField0953 = 953;
+    private static int testField0954 = 954;
+    private static int testField0955 = 955;
+    private static int testField0956 = 956;
+    private static int testField0957 = 957;
+    private static int testField0958 = 958;
+    private static int testField0959 = 959;
+    private static int testField0960 = 960;
+    private static int testField0961 = 961;
+    private static int testField0962 = 962;
+    private static int testField0963 = 963;
+    private static int testField0964 = 964;
+    private static int testField0965 = 965;
+    private static int testField0966 = 966;
+    private static int testField0967 = 967;
+    private static int testField0968 = 968;
+    private static int testField0969 = 969;
+    private static int testField0970 = 970;
+    private static int testField0971 = 971;
+    private static int testField0972 = 972;
+    private static int testField0973 = 973;
+    private static int testField0974 = 974;
+    private static int testField0975 = 975;
+    private static int testField0976 = 976;
+    private static int testField0977 = 977;
+    private static int testField0978 = 978;
+    private static int testField0979 = 979;
+    private static int testField0980 = 980;
+    private static int testField0981 = 981;
+    private static int testField0982 = 982;
+    private static int testField0983 = 983;
+    private static int testField0984 = 984;
+    private static int testField0985 = 985;
+    private static int testField0986 = 986;
+    private static int testField0987 = 987;
+    private static int testField0988 = 988;
+    private static int testField0989 = 989;
+    private static int testField0990 = 990;
+    private static int testField0991 = 991;
+    private static int testField0992 = 992;
+    private static int testField0993 = 993;
+    private static int testField0994 = 994;
+    private static int testField0995 = 995;
+    private static int testField0996 = 996;
+    private static int testField0997 = 997;
+    private static int testField0998 = 998;
+    private static int testField0999 = 999;
+    private static int testField1000 = 1000;
+    private static int testField1001 = 1001;
+    private static int testField1002 = 1002;
+    private static int testField1003 = 1003;
+    private static int testField1004 = 1004;
+    private static int testField1005 = 1005;
+    private static int testField1006 = 1006;
+    private static int testField1007 = 1007;
+    private static int testField1008 = 1008;
+    private static int testField1009 = 1009;
+    private static int testField1010 = 1010;
+    private static int testField1011 = 1011;
+    private static int testField1012 = 1012;
+    private static int testField1013 = 1013;
+    private static int testField1014 = 1014;
+    private static int testField1015 = 1015;
+    private static int testField1016 = 1016;
+    private static int testField1017 = 1017;
+    private static int testField1018 = 1018;
+    private static int testField1019 = 1019;
+    private static int testField1020 = 1020;
+    private static int testField1021 = 1021;
+    private static int testField1022 = 1022;
+    private static int testField1023 = 1023;
+}
index 3de900a..a5caa7b 100644 (file)
@@ -327,17 +327,17 @@ public class Main {
   // check.
 
   /// CHECK-START-ARM64: int Main.canMergeAfterBCE1() instruction_simplifier_arm64 (before)
-  /// CHECK:             <<Const1:i\d+>>        IntConstant 1
+  /// CHECK:             <<Const7:i\d+>>        IntConstant 7
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
   /// CHECK:                                    If
   //  -------------- Loop
   /// CHECK:             <<ArrayGet:i\d+>>      ArrayGet [<<Array>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
-  /// CHECK:                                    ArraySet [<<Array>>,<<Index>>,<<Add>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
+  /// CHECK:                                    ArraySet [<<Array>>,<<Index>>,<<Div>>]
 
   /// CHECK-START-ARM64: int Main.canMergeAfterBCE1() instruction_simplifier_arm64 (after)
-  /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
+  /// CHECK-DAG:         <<Const7:i\d+>>        IntConstant 7
   /// CHECK-DAG:         <<DataOffset:i\d+>>    IntConstant 12
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
@@ -345,12 +345,12 @@ public class Main {
   //  -------------- Loop
   /// CHECK:             <<Address1:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-NEXT:        <<ArrayGet:i\d+>>      ArrayGet [<<Address1>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
   /// CHECK:             <<Address2:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
-  /// CHECK-NEXT:                               ArraySet [<<Address2>>,<<Index>>,<<Add>>]
+  /// CHECK-NEXT:                               ArraySet [<<Address2>>,<<Index>>,<<Div>>]
 
   /// CHECK-START-ARM64: int Main.canMergeAfterBCE1() GVN$after_arch (after)
-  /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
+  /// CHECK-DAG:         <<Const7:i\d+>>        IntConstant 7
   /// CHECK-DAG:         <<DataOffset:i\d+>>    IntConstant 12
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
@@ -358,23 +358,23 @@ public class Main {
   //  -------------- Loop
   /// CHECK:             <<Address:i\d+>>       IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK:             <<ArrayGet:i\d+>>      ArrayGet [<<Address>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
   /// CHECK-NOT:                                IntermediateAddress
-  /// CHECK:                                    ArraySet [<<Address>>,<<Index>>,<<Add>>]
+  /// CHECK:                                    ArraySet [<<Address>>,<<Index>>,<<Div>>]
 
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE1() instruction_simplifier_arm (before)
-  /// CHECK:             <<Const1:i\d+>>        IntConstant 1
+  /// CHECK:             <<Const7:i\d+>>        IntConstant 7
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
   /// CHECK:                                    If
   //  -------------- Loop
   /// CHECK:             <<ArrayGet:i\d+>>      ArrayGet [<<Array>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
-  /// CHECK:                                    ArraySet [<<Array>>,<<Index>>,<<Add>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
+  /// CHECK:                                    ArraySet [<<Array>>,<<Index>>,<<Div>>]
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE1() instruction_simplifier_arm (after)
-  /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
+  /// CHECK-DAG:         <<Const7:i\d+>>        IntConstant 7
   /// CHECK-DAG:         <<DataOffset:i\d+>>    IntConstant 12
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
@@ -382,12 +382,12 @@ public class Main {
   //  -------------- Loop
   /// CHECK:             <<Address1:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-NEXT:        <<ArrayGet:i\d+>>      ArrayGet [<<Address1>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
   /// CHECK:             <<Address2:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
-  /// CHECK-NEXT:                               ArraySet [<<Address2>>,<<Index>>,<<Add>>]
+  /// CHECK-NEXT:                               ArraySet [<<Address2>>,<<Index>>,<<Div>>]
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE1() GVN$after_arch (after)
-  /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
+  /// CHECK-DAG:         <<Const7:i\d+>>        IntConstant 7
   /// CHECK-DAG:         <<DataOffset:i\d+>>    IntConstant 12
   /// CHECK:             <<Array:l\d+>>         NewArray
   /// CHECK:             <<Index:i\d+>>         Phi
@@ -395,14 +395,14 @@ public class Main {
   //  -------------- Loop
   /// CHECK:             <<Address:i\d+>>       IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK:             <<ArrayGet:i\d+>>      ArrayGet [<<Address>>,<<Index>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGet>>,<<Const1>>]
+  /// CHECK:             <<Div:i\d+>>           Div [<<ArrayGet>>,<<Const7>>]
   /// CHECK-NOT:                                IntermediateAddress
-  /// CHECK:                                    ArraySet [<<Address>>,<<Index>>,<<Add>>]
+  /// CHECK:                                    ArraySet [<<Address>>,<<Index>>,<<Div>>]
 
   public static int canMergeAfterBCE1() {
-    int[] array = {0, 1, 2, 3};
+    int[] array = {0, 7, 14, 21};
     for (int i = 0; i < array.length; i++) {
-      array[i] = array[i] + 1;
+      array[i] = array[i] / 7;
     }
     return array[array.length - 1];
   }
@@ -421,8 +421,8 @@ public class Main {
   /// CHECK-DAG:         <<Index1:i\d+>>        Add [<<Index>>,<<Const1>>]
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Array>>,<<Index>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Array>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
-  /// CHECK:                                    ArraySet [<<Array>>,<<Index1>>,<<Add>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:                                    ArraySet [<<Array>>,<<Index1>>,<<Shl>>]
 
   // Note that we do not care that the `DataOffset` is `12`. But if we do not
   // specify it and any other `IntConstant` appears before that instruction,
@@ -441,9 +441,9 @@ public class Main {
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Address1>>,<<Index>>]
   /// CHECK-DAG:         <<Address2:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Address2>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
   /// CHECK:             <<Address3:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
-  /// CHECK:                                    ArraySet [<<Address3>>,<<Index1>>,<<Add>>]
+  /// CHECK:                                    ArraySet [<<Address3>>,<<Index1>>,<<Shl>>]
 
   /// CHECK-START-ARM64: int Main.canMergeAfterBCE2() GVN$after_arch (after)
   /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
@@ -456,8 +456,8 @@ public class Main {
   /// CHECK-DAG:         <<Address:i\d+>>       IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Address>>,<<Index>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Address>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
-  /// CHECK:                                    ArraySet [<<Address>>,<<Index1>>,<<Add>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:                                    ArraySet [<<Address>>,<<Index1>>,<<Shl>>]
 
   // There should be only one intermediate address computation in the loop.
 
@@ -475,8 +475,8 @@ public class Main {
   /// CHECK-DAG:         <<Index1:i\d+>>        Add [<<Index>>,<<Const1>>]
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Array>>,<<Index>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Array>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
-  /// CHECK:                                    ArraySet [<<Array>>,<<Index1>>,<<Add>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:                                    ArraySet [<<Array>>,<<Index1>>,<<Shl>>]
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE2() instruction_simplifier_arm (after)
   /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
@@ -490,9 +490,9 @@ public class Main {
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Address1>>,<<Index>>]
   /// CHECK-DAG:         <<Address2:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Address2>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
   /// CHECK:             <<Address3:i\d+>>      IntermediateAddress [<<Array>>,<<DataOffset>>]
-  /// CHECK:                                    ArraySet [<<Address3>>,<<Index1>>,<<Add>>]
+  /// CHECK:                                    ArraySet [<<Address3>>,<<Index1>>,<<Shl>>]
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE2() GVN$after_arch (after)
   /// CHECK-DAG:         <<Const1:i\d+>>        IntConstant 1
@@ -505,17 +505,17 @@ public class Main {
   /// CHECK-DAG:         <<Address:i\d+>>       IntermediateAddress [<<Array>>,<<DataOffset>>]
   /// CHECK-DAG:         <<ArrayGetI:i\d+>>     ArrayGet [<<Address>>,<<Index>>]
   /// CHECK-DAG:         <<ArrayGetI1:i\d+>>    ArrayGet [<<Address>>,<<Index1>>]
-  /// CHECK:             <<Add:i\d+>>           Add [<<ArrayGetI>>,<<ArrayGetI1>>]
-  /// CHECK:                                    ArraySet [<<Address>>,<<Index1>>,<<Add>>]
+  /// CHECK:             <<Shl:i\d+>>           Shl [<<ArrayGetI>>,<<ArrayGetI1>>]
+  /// CHECK:                                    ArraySet [<<Address>>,<<Index1>>,<<Shl>>]
 
   /// CHECK-START-ARM:   int Main.canMergeAfterBCE2() GVN$after_arch (after)
   /// CHECK:                                    IntermediateAddress
   /// CHECK-NOT:                                IntermediateAddress
 
   public static int canMergeAfterBCE2() {
-    int[] array = {0, 1, 2, 3};
+    int[] array = {64, 8, 4, 2 };
     for (int i = 0; i < array.length - 1; i++) {
-      array[i + 1] = array[i] + array[i + 1];
+      array[i + 1] = array[i] << array[i + 1];
     }
     return array[array.length - 1];
   }
@@ -571,8 +571,8 @@ public class Main {
     accrossGC(array, 0);
     assertIntEquals(125, array[0]);
 
-    assertIntEquals(4, canMergeAfterBCE1());
-    assertIntEquals(6, canMergeAfterBCE2());
+    assertIntEquals(3, canMergeAfterBCE1());
+    assertIntEquals(1048576, canMergeAfterBCE2());
 
     assertIntEquals(18, checkLongFloatDouble());
   }
index 2b57de6..703b911 100644 (file)
@@ -43,18 +43,6 @@ TEST_ART_RUN_TEST_DEPENDENCIES := \
 
 TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES := setup-jack-server
 
-ifeq ($(ART_TEST_DEBUG_GC),true)
-  ART_TEST_WITH_STRACE := true
-endif
-
-ifeq ($(ART_TEST_BISECTION),true)
-  # Need to keep rebuilding the test to bisection search it.
-  ART_TEST_RUN_TEST_NO_PREBUILD := true
-  ART_TEST_RUN_TEST_PREBUILD := false
-  # Bisection search writes to standard output.
-  ART_TEST_QUIET := false
-endif
-
 # Helper to create individual build targets for tests. Must be called with $(eval).
 # $(1): the test number
 define define-build-art-run-test
@@ -97,707 +85,11 @@ LOCAL_PICKUP_FILES := $(art_run_tests_install_dir)
 
 include $(BUILD_PHONY_PACKAGE)
 
-# Clear temp vars.
-art_run_tests_build_dir :=
-art_run_tests_install_dir :=
-define-build-art-run-test :=
-TEST_ART_RUN_TEST_BUILD_RULES :=
-
-########################################################################
-# General rules to build and run a run-test.
-
-TARGET_TYPES := host target
-PREBUILD_TYPES :=
-ifeq ($(ART_TEST_RUN_TEST_PREBUILD),true)
-  PREBUILD_TYPES += prebuild
-endif
-ifeq ($(ART_TEST_RUN_TEST_NO_PREBUILD),true)
-  PREBUILD_TYPES += no-prebuild
-endif
-ifeq ($(ART_TEST_RUN_TEST_NO_DEX2OAT),true)
-  PREBUILD_TYPES += no-dex2oat
-endif
-COMPILER_TYPES :=
-ifeq ($(ART_TEST_INTERPRETER_ACCESS_CHECKS),true)
-  COMPILER_TYPES += interp-ac
-endif
-ifeq ($(ART_TEST_INTERPRETER),true)
-  COMPILER_TYPES += interpreter
-endif
-ifeq ($(ART_TEST_JIT),true)
-  COMPILER_TYPES += jit
-endif
-OPTIMIZING_COMPILER_TYPES :=
-ifeq ($(ART_TEST_OPTIMIZING),true)
-  COMPILER_TYPES += optimizing
-  OPTIMIZING_COMPILER_TYPES += optimizing
-endif
-ifeq ($(ART_TEST_OPTIMIZING_GRAPH_COLOR),true)
-  COMPILER_TYPES += regalloc_gc
-  OPTIMIZING_COMPILER_TYPES += regalloc_gc
-endif
-RELOCATE_TYPES := no-relocate
-ifeq ($(ART_TEST_RUN_TEST_RELOCATE),true)
-  RELOCATE_TYPES += relocate
-endif
-ifeq ($(ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT),true)
-  RELOCATE_TYPES += relocate-npatchoat
-endif
-TRACE_TYPES := ntrace
-ifeq ($(ART_TEST_TRACE),true)
-  TRACE_TYPES += trace
-endif
-ifeq ($(ART_TEST_TRACE_STREAM),true)
-  TRACE_TYPES += stream
-endif
-GC_TYPES := cms
-ifeq ($(ART_TEST_GC_STRESS),true)
-  GC_TYPES += gcstress
-endif
-ifeq ($(ART_TEST_GC_VERIFY),true)
-  GC_TYPES += gcverify
-endif
-JNI_TYPES := checkjni
-ifeq ($(ART_TEST_JNI_FORCECOPY),true)
-  JNI_TYPES += forcecopy
-endif
-ifeq ($(ART_TEST_RUN_TEST_IMAGE),true)
-IMAGE_TYPES := picimage
-endif
-ifeq ($(ART_TEST_RUN_TEST_NO_IMAGE),true)
-  IMAGE_TYPES += no-image
-endif
-ifeq ($(ART_TEST_RUN_TEST_MULTI_IMAGE),true)
-  IMAGE_TYPES := multipicimage
-endif
-PICTEST_TYPES := npictest
-ifeq ($(ART_TEST_PIC_TEST),true)
-  PICTEST_TYPES += pictest
-endif
-RUN_TYPES :=
-ifeq ($(ART_TEST_RUN_TEST_DEBUG),true)
-  RUN_TYPES += debug
-endif
-ifeq ($(ART_TEST_RUN_TEST_NDEBUG),true)
-  RUN_TYPES += ndebug
-endif
-DEBUGGABLE_TYPES := ndebuggable
-ifeq ($(ART_TEST_RUN_TEST_DEBUGGABLE),true)
-DEBUGGABLE_TYPES += debuggable
-endif
-ADDRESS_SIZES_TARGET := $(ART_PHONY_TEST_TARGET_SUFFIX)
-ADDRESS_SIZES_HOST := $(ART_PHONY_TEST_HOST_SUFFIX)
-ifeq ($(ART_TEST_RUN_TEST_2ND_ARCH),true)
-  ADDRESS_SIZES_TARGET += $(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
-  ADDRESS_SIZES_HOST += $(2ND_ART_PHONY_TEST_HOST_SUFFIX)
-endif
-ALL_ADDRESS_SIZES := 64 32
-
-# List all run test names with number arguments agreeing with the comment above.
-define all-run-test-names
-  $(foreach target, $(1), \
-    $(foreach run-type, $(2), \
-      $(foreach prebuild, $(3), \
-        $(foreach compiler, $(4), \
-          $(foreach relocate, $(5), \
-            $(foreach trace, $(6), \
-              $(foreach gc, $(7), \
-                $(foreach jni, $(8), \
-                  $(foreach image, $(9), \
-                    $(foreach pictest, $(10), \
-                      $(foreach debuggable, $(11), \
-                        $(foreach test, $(12), \
-                          $(foreach address_size, $(13), \
-                            test-art-$(target)-run-test-$(run-type)-$(prebuild)-$(compiler)-$(relocate)-$(trace)-$(gc)-$(jni)-$(image)-$(pictest)-$(debuggable)-$(test)$(address_size) \
-                    )))))))))))))
-endef  # all-run-test-names
-
-# To generate a full list or tests:
-# $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
-#        $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-#        $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-
 # Convert's a rule name to the form used in variables, e.g. no-relocate to NO_RELOCATE
 define name-to-var
 $(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
 endef  # name-to-var
 
-# Disable 115-native-bridge, it fails when run through make b/35984597.
-# Disable 153-reference-stress temporarily until a fix arrives. b/33389022.
-# Disable 080-oom-fragmentation due to flakes. b/33795328
-# Disable 497-inlining-and-class-loader and 542-unresolved-access-check until
-#     they are rewritten. These tests use a broken class loader that tries to
-#     register a dex file that's already registered with a different loader.
-#     b/34193123
-# Disable 638-checker-inline-caches until b/36371709 is fixed.
-ART_TEST_RUN_TEST_SKIP += \
-  115-native-bridge \
-  153-reference-stress \
-  080-oom-fragmentation \
-  497-inlining-and-class-loader \
-  542-unresolved-access-check \
-  638-checker-inline-caches
-
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(ART_TEST_RUN_TEST_SKIP), $(ALL_ADDRESS_SIZES))
-
-
-# Disable 149-suspend-all-stress, its output is flaky (b/28988206).
-TEST_ART_BROKEN_ALL_TARGET_TESTS := \
-  149-suspend-all-stress \
-
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-    $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-    $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_ALL_TARGET_TESTS), \
-    $(ALL_ADDRESS_SIZES))
-
-TEST_ART_BROKEN_ALL_TARGET_TESTS :=
-
-# Tests that are timing sensitive and flaky on heavily loaded systems.
-TEST_ART_TIMING_SENSITIVE_RUN_TESTS := \
-  002-sleep \
-  053-wait-some \
-  055-enum-performance \
-  133-static-invoke-super
-
-# disable timing sensitive tests on "dist" builds.
-ifdef dist_goal
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_TIMING_SENSITIVE_RUN_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-# 147-stripped-dex-fallback isn't supported on device because --strip-dex
-# requires the zip command.
-# 569-checker-pattern-replacement tests behaviour present only on host.
-TEST_ART_BROKEN_TARGET_TESTS := \
-  147-stripped-dex-fallback \
-  569-checker-pattern-replacement
-
-ifneq (,$(filter target,$(TARGET_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TARGET_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_TARGET_TESTS :=
-
-# Tests that require python3.
-TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS := \
-  960-default-smali \
-  961-default-iface-resolution-gen \
-  964-default-iface-init-gen \
-  968-default-partial-compile-gen \
-  969-iface-super \
-  970-iface-super-resolution-gen \
-  971-iface-super
-
-# Check if we have python3 to run our tests.
-ifeq ($(wildcard /usr/bin/python3),)
-  $(warning "No python3 found. Disabling tests: $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS)")
-
-  # Currently disable tests requiring python3 when it is not installed.
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_TIMING_SENSITIVE_RUN_TESTS :=
-
-# Note 116-nodex2oat is not broken per-se it just doesn't (and isn't meant to) work with --prebuild.
-TEST_ART_BROKEN_PREBUILD_RUN_TESTS := \
-  116-nodex2oat \
-  118-noimage-dex2oat \
-  134-nodex2oat-nofallback
-
-ifneq (,$(filter prebuild,$(PREBUILD_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),prebuild, \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_PREBUILD_RUN_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_PREBUILD_RUN_TESTS :=
-
-# 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save.
-# 529 and 555: b/27784033
-TEST_ART_BROKEN_NO_PREBUILD_TESTS := \
-  117-nopatchoat \
-  147-stripped-dex-fallback \
-  554-jit-profile-file \
-  529-checker-unresolved \
-  555-checker-regression-x86const \
-  608-checker-unresolved-lse
-
-ifneq (,$(filter no-prebuild,$(PREBUILD_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-prebuild, \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_PREBUILD_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_NO_PREBUILD_TESTS :=
-
-# Note 117-nopatchoat is not broken per-se it just doesn't work (and isn't meant to) without
-# --prebuild --relocate
-TEST_ART_BROKEN_NO_RELOCATE_TESTS := \
-  117-nopatchoat \
-  118-noimage-dex2oat \
-  119-noimage-patchoat \
-  554-jit-profile-file
-
-ifneq (,$(filter no-relocate,$(RELOCATE_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES), no-relocate,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_RELOCATE_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_NO_RELOCATE_TESTS :=
-
-# Temporarily disable some broken tests when forcing access checks in interpreter b/22414682
-# 629 requires compilation.
-# 030, 080 and 530: b/36377828
-TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS := \
-  137-cfi \
-  030-bad-finalizer \
-  530-checker-lse \
-  530-checker-lse2 \
-  080-oom-throw \
-  629-vdex-speed
-
-ifneq (,$(filter interp-ac,$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      interp-ac,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS :=
-
-# Tests that are broken with GC stress.
-# * 137-cfi needs to unwind a second forked process. We're using a primitive sleep to wait till we
-#   hope the second process got into the expected state. The slowness of gcstress makes this bad.
-# * 152-dead-large-object requires a heap larger than what gcstress uses.
-# * 908-gc-start-finish expects GCs only to be run at clear points. The reduced heap size makes
-#   this non-deterministic. Same for 913.
-# * 961-default-iface-resolution-gen and 964-default-iface-init-genare very long tests that often
-#   will take more than the timeout to run when gcstress is enabled. This is because gcstress
-#   slows down allocations significantly which these tests do a lot.
-TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \
-  137-cfi \
-  152-dead-large-object \
-  154-gc-loop \
-  908-gc-start-finish \
-  913-heaps \
-  961-default-iface-resolution-gen \
-  964-default-iface-init-gen \
-
-ifneq (,$(filter gcstress,$(GC_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \
-      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_GCSTRESS_RUN_TESTS :=
-
-# 115-native-bridge setup is complicated. Need to implement it correctly for the target.
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
-    $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), 115-native-bridge, \
-    $(ALL_ADDRESS_SIZES))
-
-# 130-hprof dumps the heap and runs hprof-conv to check whether the file is somewhat readable. This
-# is only possible on the host.
-# TODO: Turn off all the other combinations, this is more about testing actual ART code. A gtest is
-#       very hard to write here, as (for a complete test) JDWP must be set up.
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
-    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),130-hprof,$(ALL_ADDRESS_SIZES))
-
-# 131 is an old test. The functionality has been implemented at an earlier stage and is checked
-# in tests 138. Blacklisted for debug builds since these builds have duplicate classes checks which
-# punt to interpreter.
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),debug,$(PREBUILD_TYPES), \
-    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),131-structural-change,$(ALL_ADDRESS_SIZES))
-
-# 138-duplicate-classes-check. Turned on for debug builds since debug builds have duplicate classes
-# checks enabled, b/2133391.
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \
-    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),138-duplicate-classes-check,$(ALL_ADDRESS_SIZES))
-
-# All these tests check that we have sane behavior if we don't have a patchoat or dex2oat.
-# Therefore we shouldn't run them in situations where we actually don't have these since they
-# explicitly test for them. These all also assume we have an image.
-# 147-stripped-dex-fallback is disabled because it requires --prebuild.
-# 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save.
-# 629-vdex-speed requires compiled code.
-TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \
-  116-nodex2oat \
-  117-nopatchoat \
-  118-noimage-dex2oat \
-  119-noimage-patchoat \
-  137-cfi \
-  138-duplicate-classes-check2 \
-  147-stripped-dex-fallback \
-  554-jit-profile-file \
-  616-cha \
-  616-cha-abstract \
-  912-classes \
-  629-vdex-speed
-
-# This test fails without an image.
-# 018, 961, 964, 968 often time out. b/34369284
-# 508: b/36365552
-# 597: b/36467228
-TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS := \
-  137-cfi \
-  138-duplicate-classes-check \
-  018-stack-overflow \
-  476-clinit-inline-static-invoke \
-  496-checker-inlining-class-loader \
-  508-referrer-method \
-  597-deopt-new-string \
-  637-checker-throw-inline \
-  616-cha \
-  616-cha-abstract \
-  912-classes \
-  961-default-iface-resolution-gen \
-  964-default-iface-init \
-  968-default-partial-compile-gen \
-
-ifneq (,$(filter no-dex2oat,$(PREBUILD_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-dex2oat, \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-
-ifneq (,$(filter no-image,$(IMAGE_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
-      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
-      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-ifneq (,$(filter relocate-npatchoat,$(RELOCATE_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES), relocate-npatchoat,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_FALLBACK_RUN_TESTS :=
-
-# 137:
-# This test unrolls and expects managed frames, but tracing means we run the interpreter.
-# 802 and 570-checker-osr:
-# This test dynamically enables tracing to force a deoptimization. This makes the test meaningless
-# when already tracing, and writes an error message that we do not want to check for.
-# 130 occasional timeout b/32383962.
-# 629 requires compilation.
-TEST_ART_BROKEN_TRACING_RUN_TESTS := \
-  087-gc-after-link \
-  130-hprof \
-  137-cfi \
-  141-class-unload \
-  570-checker-osr \
-  629-vdex-speed \
-  802-deoptimization
-
-ifneq (,$(filter trace stream,$(TRACE_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(COMPILER_TYPES),$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_TRACING_RUN_TESTS :=
-
-# These tests expect JIT compilation, which is suppressed when tracing.
-TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS := \
-  604-hot-static-interface \
-  612-jit-dex-cache \
-  613-inlining-dex-cache \
-  616-cha \
-  626-set-resolved-string \
-
-ifneq (,$(filter trace stream,$(TRACE_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      jit,$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
-      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS :=
-
-# Known broken tests for the interpreter.
-# CFI unwinding expects managed frames.
-# 629 requires compilation.
-TEST_ART_BROKEN_INTERPRETER_RUN_TESTS := \
-  137-cfi \
-  554-jit-profile-file \
-  629-vdex-speed
-
-ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_INTERPRETER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_INTERPRETER_RUN_TESTS :=
-
-# Known broken tests for the JIT.
-# CFI unwinding expects managed frames, and the test does not iterate enough to even compile. JIT
-# also uses Generic JNI instead of the JNI compiler.
-# 154-gc-loop requires more deterministic GC behavior than what JIT does.
-# Test 906 iterates the heap filtering with different options. No instances should be created
-# between those runs to be able to have precise checks.
-# Test 629 requires compilation.
-# 912: b/34655682
-TEST_ART_BROKEN_JIT_RUN_TESTS := \
-  137-cfi \
-  154-gc-loop \
-  629-vdex-speed \
-  904-object-allocation \
-  906-iterate-heap \
-
-ifneq (,$(filter jit,$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_JIT_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_JIT_RUN_TESTS :=
-
-# Known broken tests for the graph coloring register allocator.
-# These tests were based on the linear scan allocator, which makes different decisions than
-# the graph coloring allocator. (These attempt to test for code quality, not correctness.)
-TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR := \
-  570-checker-select \
-  484-checker-register-hints
-
-ifneq (,$(filter regalloc_gc,$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      regalloc_gc,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-      $(TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR),$(ALL_ADDRESS_SIZES))
-endif
-
-# Known broken tests for the mips32 optimizing compiler backend.
-TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \
-
-ifeq (mips,$(TARGET_ARCH))
-  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
-        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-  endif
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS :=
-
-# Known broken tests for the mips64 optimizing compiler backend.
-TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS := \
-
-ifeq (mips64,$(TARGET_ARCH))
-  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
-        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-  endif
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS :=
-
-# Tests that should fail when the optimizing compiler compiles them non-debuggable.
-TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS := \
-  454-get-vreg \
-  457-regs \
-  602-deoptimizeable
-
-ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),ndebuggable,$(TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS :=
-
-# Tests that should fail when the optimizing compiler compiles them debuggable.
-TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS := \
-
-ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS :=
-
-# Tests that should fail in the read barrier configuration with the interpreter.
-TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS :=
-
-# Tests that should fail in the read barrier configuration with the Optimizing compiler (AOT).
-TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
-
-# Tests that should fail in the read barrier configuration with JIT (Optimizing compiler).
-TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
-
-# Tests failing in non-Baker read barrier configurations with the Optimizing compiler (AOT).
-# 537 and 641: Expect an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
-#      handled in non-Baker read barrier configurations.
-TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS := \
-  537-checker-arraycopy \
-  641-checker-arraycopy
-
-# Tests failing in non-Baker read barrier configurations with JIT (Optimizing compiler).
-# 537 and 641: Expect an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
-#      handled in non-Baker read barrier configurations.
-TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS := \
-  537-checker-arraycopy \
-  641-checker-arraycopy
-
-ifeq ($(ART_USE_READ_BARRIER),true)
-  ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-        $(PREBUILD_TYPES),interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
-        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-  endif
-
-  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
-        $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
-      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-          $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
-          $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-          $(TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-    endif
-  endif
-
-  ifneq (,$(filter jit,$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-        $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
-        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
-      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-          $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
-          $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-          $(TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-    endif
-  endif
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
-TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
-
-TEST_ART_BROKEN_NPIC_RUN_TESTS := 596-app-images
-ifneq (,$(filter npictest,$(PICTEST_TYPES)))
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-      ${COMPILER_TYPES},$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),npictest,$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_NPIC_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-# Tests that should fail in the heap poisoning configuration with the Optimizing compiler.
-# 055: Exceeds run time limits due to heap poisoning instrumentation (on ARM and ARM64 devices).
-TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS := \
-  055-enum-performance
-
-ifeq ($(ART_HEAP_POISONING),true)
-  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
-    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-        $(TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-  endif
-endif
-
-TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS :=
-
-# 909: Tests that check semantics for a non-debuggable app.
-# 137: relies on AOT code and debuggable makes us JIT always.
-TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS := \
-  137-cfi \
-  909-attach-agent \
-
-ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
-    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-    $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-
-TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS :=
-
-# Tests incompatible with bisection bug search. Sorted by incompatibility reason.
-# 000 through 595 do not compile anything. 089 tests a build failure. 018 through 137
-# run dalvikvm more than once. 115 and 088 assume they are always compiled.
-# 055 tests performance which is degraded during bisecting.
-TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS := \
-  000-nop \
-  134-nodex2oat-nofallback \
-  147-stripped-dex-fallback \
-  595-profile-saving \
-  \
-  089-many-methods \
-  \
-  018-stack-overflow \
-  116-nodex2oat \
-  117-nopatchoat \
-  118-noimage-dex2oat \
-  119-noimage-patchoat \
-  126-miranda-multidex \
-  137-cfi \
-  \
-  115-native-bridge \
-  088-monitor-verification \
-  \
-  055-enum-performance
-
-ifeq ($(ART_TEST_BISECTION),true)
-  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
-      $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
-      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
-      $(TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS),$(ALL_ADDRESS_SIZES))
-endif
-
-# Clear variables ahead of appending to them when defining tests.
-$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach prebuild, $(PREBUILD_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach compiler, $(COMPILER_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach relocate, $(RELOCATE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach trace, $(TRACE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach gc, $(GC_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach jni, $(JNI_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach image, $(IMAGE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach test, $(TEST_ART_RUN_TESTS), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach run_type, $(RUN_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach debuggable_type, $(DEBUGGABLE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable_type))_RULES :=)))
-
 # We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
 # only once).
 TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
@@ -916,423 +208,62 @@ define core-image-dependencies
   endif
 endef
 
-COMPILER_TYPES_2 := optimizing
-COMPILER_TYPES_2 += interpreter
-COMPILER_TYPES_2 += jit
-COMPILER_TYPES_2 += regalloc_gc
-COMPILER_TYPES_2 += interp-ac
-ALL_ADDRESS_SIZES_2 := 32 64
-IMAGE_TYPES_2 := picimage
-IMAGE_TYPES_2 += no-image
-IMAGE_TYPES_2 += npicimage
-IMAGE_TYPES_2 += multinpicimage
-IMAGE_TYPES_2 += multipicimage
+TARGET_TYPES := host target
+COMPILER_TYPES := jit interpreter optimizing regalloc_gc jit interp-ac
+IMAGE_TYPES := picimage no-image multipicimage
+ALL_ADDRESS_SIZES := 64 32
 
 # Add core image dependencies required for given target - HOST or TARGET,
 # IMAGE_TYPE, COMPILER_TYPE and ADDRESS_SIZE to the prereq_rules.
 $(foreach target, $(TARGET_TYPES), \
-  $(foreach image, $(IMAGE_TYPES_2), \
-    $(foreach compiler, $(COMPILER_TYPES_2), \
-      $(foreach address_size, $(ALL_ADDRESS_SIZES_2), $(eval \
+  $(foreach image, $(IMAGE_TYPES), \
+    $(foreach compiler, $(COMPILER_TYPES), \
+      $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
         $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
 
 test-art-host-run-test-dependencies : $(host_prereq_rules)
 test-art-target-run-test-dependencies : $(target_prereq_rules)
 test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
 
-host_prereq_rules :=
-target_prereq_rules :=
-
-# 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 optimizing jit interp-ac}-
-#    {5: relocate nrelocate relocate-npatchoat}-
-#    {6: trace or ntrace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}-
-#    {9: no-image image picimage}-{10: pictest npictest}-
-#    {11: ndebuggable debuggable}-{12: test name}{13: 32 or 64}
-define define-test-art-run-test
-  run_test_options :=
-  prereq_rule :=
-  test_groups :=
-  uc_host_or_target :=
-  jack_classpath :=
-  ifeq ($(ART_TEST_WITH_STRACE),true)
-    run_test_options += --strace
-  endif
-  ifeq ($(ART_TEST_RUN_TEST_ALWAYS_CLEAN),true)
-    run_test_options += --always-clean
-  endif
-  ifeq ($(ART_TEST_BISECTION),true)
-    run_test_options += --bisection-search
-  endif
-  ifeq ($(1),host)
-    uc_host_or_target := HOST
-    test_groups := ART_RUN_TEST_HOST_RULES
-    run_test_options += --host
-    prereq_rule := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(HOST_JACK_CLASSPATH_DEPENDENCIES)
-    jack_classpath := $(HOST_JACK_CLASSPATH)
-  else
-    ifeq ($(1),target)
-      uc_host_or_target := TARGET
-      test_groups := ART_RUN_TEST_TARGET_RULES
-      prereq_rule := test-art-target-sync $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
-      jack_classpath := $(TARGET_JACK_CLASSPATH)
-    else
-      $$(error found $(1) expected $(TARGET_TYPES))
-    endif
-  endif
-  ifeq ($(2),debug)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUG_RULES
-  else
-    ifeq ($(2),ndebug)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELEASE_RULES
-      run_test_options += -O
-    else
-      $$(error found $(2) expected $(RUN_TYPES))
-    endif
-  endif
-  ifeq ($(3),prebuild)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PREBUILD_RULES
-    run_test_options += --prebuild
-  else
-    ifeq ($(3),no-prebuild)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_PREBUILD_RULES
-      run_test_options += --no-prebuild
-    else
-      ifeq ($(3),no-dex2oat)
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_DEX2OAT_RULES
-        run_test_options += --no-prebuild --no-dex2oat
-      else
-        $$(error found $(3) expected $(PREBUILD_TYPES))
-      endif
-    endif
-  endif
-  ifeq ($(4),optimizing)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES
-    run_test_options += --optimizing
-  else ifeq ($(4),regalloc_gc)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_GRAPH_COLOR_RULES
-    run_test_options += --optimizing -Xcompiler-option --register-allocation-strategy=graph-color
-  else
-    ifeq ($(4),interpreter)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES
-      run_test_options += --interpreter
-    else ifeq ($(4),interp-ac)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_ACCESS_CHECKS_RULES
-      run_test_options += --interpreter --verify-soft-fail
-    else
-      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
-
-  ifeq ($(5),relocate)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES
-    run_test_options += --relocate
-  else
-    ifeq ($(5),no-relocate)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_RELOCATE_RULES
-      run_test_options += --no-relocate
-    else
-      ifeq ($(5),relocate-npatchoat)
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_NO_PATCHOAT_RULES
-        run_test_options += --relocate --no-patchoat
-      else
-        $$(error found $(5) expected $(RELOCATE_TYPES))
-      endif
-    endif
-  endif
-  ifeq ($(6),trace)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
-    run_test_options += --trace
-  else
-    ifeq ($(6),ntrace)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_TRACE_RULES
-    else
-      ifeq ($(6),stream)
-        # Group streaming under normal tracing rules.
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
-        run_test_options += --trace --stream
-      else
-        $$(error found $(6) expected $(TRACE_TYPES))
-      endif
-    endif
-  endif
-  ifeq ($(7),gcverify)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCVERIFY_RULES
-    run_test_options += --gcverify
-  else
-    ifeq ($(7),gcstress)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCSTRESS_RULES
-      run_test_options += --gcstress
-    else
-      ifeq ($(7),cms)
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CMS_RULES
-      else
-        $$(error found $(7) expected $(GC_TYPES))
-      endif
-    endif
-  endif
-  ifeq ($(8),forcecopy)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_FORCECOPY_RULES
-    run_test_options += --runtime-option -Xjniopts:forcecopy
-    ifneq ($$(ART_TEST_JNI_FORCECOPY),true)
-      skip_test := true
-    endif
-  else
-    ifeq ($(8),checkjni)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CHECKJNI_RULES
-      run_test_options += --runtime-option -Xcheck:jni
-    else
-      ifeq ($(8),jni)
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JNI_RULES
-      else
-        $$(error found $(8) expected $(JNI_TYPES))
-      endif
-    endif
-  endif
-  image_suffix := $(4)
-  ifeq ($(4),regalloc_gc)
-    # Graph coloring tests share the image_suffix with optimizing tests.
-    image_suffix := optimizing
-  else
-    ifeq ($(4),jit)
-      # JIT tests share the image_suffix with interpreter tests.
-      image_suffix := interpreter
-    endif
-  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.
-    # Use the PIC image, as it is the default in run-test, to match dependencies.
-    ifeq ($(1),host)
-      prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
-    else
-      prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
-    endif
-  else
-    ifeq ($(9),picimage)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
-      ifeq ($(1),host)
-        prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
-      else
-        prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
-      endif
-    else
-      ifeq ($(9),multipicimage)
-        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
-        run_test_options += --multi-image
-        ifeq ($(1),host)
-          prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_multi_$(13))
-        else
-          prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_multi_$(13))
-        endif
-      else
-        $$(error found $(9) expected $(IMAGE_TYPES))
-      endif
-    endif
-  endif
-  ifeq ($(10),pictest)
-    run_test_options += --pic-test
-  else
-    ifeq ($(10),npictest)
-      # Nothing to be done.
-    else
-      $$(error found $(10) expected $(PICTEST_TYPES))
-    endif
-  endif
-  ifeq ($(11),debuggable)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUGGABLE_RULES
-    run_test_options += --debuggable
-  else
-    ifeq ($(11),ndebuggable)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NONDEBUGGABLE_RULES
-      # Nothing to be done.
-    else
-      $$(error found $(11) expected $(DEBUGGABLE_TYPES))
-    endif
-  endif
-  # $(12) is the test name.
-  test_groups += ART_RUN_TEST_$$(uc_host_or_target)_$(call name-to-var,$(12))_RULES
-  ifeq ($(13),64)
-    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_64_RULES
-    run_test_options += --64
-  else
-    ifeq ($(13),32)
-      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_32_RULES
-    else
-      $$(error found $(13) expected $(ALL_ADDRESS_SIZES))
-    endif
-  endif
-  # Override of host instruction-set-features. Required to test advanced x86 intrinsics. The
-  # conditionals aren't really correct, they will fail to do the right thing on a 32-bit only
-  # host. However, this isn't common enough to worry here and make the conditions complicated.
-  ifneq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
-    ifeq ($(13),64)
-      run_test_options += --instruction-set-features $(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
-    endif
-  endif
-  ifneq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
-    ifeq ($(13),32)
-      run_test_options += --instruction-set-features $($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
-    endif
-  endif
-  run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
-  run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
-      $$(run_test_options)
-  ifneq ($(ART_TEST_ANDROID_ROOT),)
-    run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options)
-  endif
-  ifeq ($(ART_TEST_QUIET),true)
-    run_test_options += --quiet
-  endif
-$$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
-$$(run_test_rule_name): PRIVATE_JACK_CLASSPATH := $$(jack_classpath)
-.PHONY: $$(run_test_rule_name)
-$$(run_test_rule_name): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(HOST_OUT_EXECUTABLES)/hprof-conv $$(prereq_rule) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
-       $(hide) $$(call ART_TEST_SKIP,$$@) && \
-         DX=$(abspath $(DX)) \
-           JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
-           SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
-           DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
-           JACK_VERSION=$(JACK_DEFAULT_VERSION) \
-           JACK=$(abspath $(JACK)) \
-           JACK_VERSION=$(JACK_DEFAULT_VERSION) \
-           JACK_CLASSPATH=$$(PRIVATE_JACK_CLASSPATH) \
-           art/test/run-test $$(PRIVATE_RUN_TEST_OPTIONS) $(12) \
-             && $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
-       $$(hide) (echo $(MAKECMDGOALS) | grep -q $$@ && \
-         echo "run-test run as top-level target, removing test directory $(ART_HOST_TEST_DIR)" && \
-         rm -r $(ART_HOST_TEST_DIR)) || true
-
-  $$(foreach test_group,$$(test_groups), $$(eval $$(value test_group) += $$(run_test_rule_name)))
-
-  # Clear locally defined variables.
-  uc_host_or_target :=
-  test_groups :=
-  run_test_options :=
-  run_test_rule_name :=
-  prereq_rule :=
-  jack_classpath :=
-endef  # define-test-art-run-test
-
+# Generate list of dependencies required for given target - HOST or TARGET, IMAGE_TYPE,
+# COMPILER_TYPE and ADDRESS_SIZE.
 $(foreach target, $(TARGET_TYPES), \
-  $(foreach test, $(TEST_ART_RUN_TESTS), \
-    $(foreach run_type, $(RUN_TYPES), \
-      $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), \
-        $(foreach prebuild, $(PREBUILD_TYPES), \
-          $(foreach compiler, $(COMPILER_TYPES), \
-            $(foreach relocate, $(RELOCATE_TYPES), \
-              $(foreach trace, $(TRACE_TYPES), \
-                $(foreach gc, $(GC_TYPES), \
-                  $(foreach jni, $(JNI_TYPES), \
-                    $(foreach image, $(IMAGE_TYPES), \
-                      $(foreach pictest, $(PICTEST_TYPES), \
-                        $(foreach debuggable, $(DEBUGGABLE_TYPES), \
-                          $(eval $(call define-test-art-run-test,$(target),$(run_type),$(prebuild),$(compiler),$(relocate),$(trace),$(gc),$(jni),$(image),$(pictest),$(debuggable),$(test),$(address_size))) \
-                  )))))))))))))
-define-test-art-run-test :=
+  $(foreach image, $(IMAGE_TYPES), \
+    $(foreach compiler, $(COMPILER_TYPES), \
+      $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
+        $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
 
-# Define a phony rule whose purpose is to test its prerequisites.
-# $(1): host or target
-# $(2): list of prerequisites
-define define-test-art-run-test-group
-.PHONY: $(1)
-$(1): $(2)
-       $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
+test-art-host-run-test-dependencies : $(host_prereq_rules)
+test-art-target-run-test-dependencies : $(target_prereq_rules)
+test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
 
-endef  # define-test-art-run-test-group
+# Create a rule to build and run a test group of the following form:
+# test-art-{1: host target}-run-test
+define define-test-art-host-or-target-run-test-group
+  build_target := test-art-$(1)-run-test
+  .PHONY: $$(build_target)
 
+  $$(build_target) : args := --$(1) --verbose
+  $$(build_target) : test-art-$(1)-run-test-dependencies
+       ./art/test/testrunner/testrunner.py $$(args)
+  build_target :=
+  args :=
+endef  # define-test-art-host-or-target-run-test-group
 
 $(foreach target, $(TARGET_TYPES), $(eval \
-  $(call define-test-art-run-test-group,test-art-$(target)-run-test,$(ART_RUN_TEST_$(call name-to-var,$(target))_RULES))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach prebuild, $(PREBUILD_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(prebuild),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach run-type, $(RUN_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(run-type),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run-type))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach compiler, $(COMPILER_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(compiler),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach relocate, $(RELOCATE_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(relocate),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach trace, $(TRACE_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(trace),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach gc, $(GC_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(gc),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach jni, $(JNI_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(jni),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach debuggable, $(DEBUGGABLE_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(debuggable),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach image, $(IMAGE_TYPES), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(image),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach test, $(TEST_ART_RUN_TESTS), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(test),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES)))))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), $(eval \
-    $(call define-test-art-run-test-group,test-art-$(target)-run-test$(address_size),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(address_size)_RULES)))))
+  $(call define-test-art-host-or-target-run-test-group,$(target))))
 
-# Clear variables now we're finished with them.
-$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach prebuild, $(PREBUILD_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach compiler, $(COMPILER_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach relocate, $(RELOCATE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach trace, $(TRACE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach gc, $(GC_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach jni, $(JNI_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach debuggable, $(DEBUGGABLE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach image, $(IMAGE_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach test, $(TEST_ART_RUN_TESTS), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
-$(foreach target, $(TARGET_TYPES), \
-  $(foreach run_type, $(RUN_TYPES), \
-    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
-define-test-art-run-test-group :=
+test-art-run-test : test-art-host-run-test test-art-target-run-test
+
+host_prereq_rules :=
+target_prereq_rules :=
+core-image-dependencies :=
+name-to-var :=
+ART_TEST_HOST_RUN_TEST_DEPENDENCIES :=
+TEST_ART_TARGET_SYNC_DEPS :=
+define-test-art-host-or-target-run-test-group :=
 TARGET_TYPES :=
-PREBUILD_TYPES :=
 COMPILER_TYPES :=
-RELOCATE_TYPES :=
-TRACE_TYPES :=
-GC_TYPES :=
-JNI_TYPES :=
 IMAGE_TYPES :=
-ADDRESS_SIZES_TARGET :=
-ADDRESS_SIZES_HOST :=
 ALL_ADDRESS_SIZES :=
-RUN_TYPES :=
-DEBUGGABLE_TYPES :=
-
 LOCAL_PATH :=
index fd2a317..2de34ca 100644 (file)
         "description": ["Disable 638-checker-inline-caches temporarily until a fix",
                         "arrives."],
         "bug": "http://b/36371709"
-    },
-    {
-        "tests": "080-oom-throw",
-        "bug": "http://b/36501991",
-        "variant": "interpreter & target"
     }
 ]
index 1715423..a6903ff 100755 (executable)
@@ -772,7 +772,7 @@ fi
 # Set a hard limit to encourage ART developers to increase the ulimit here if
 # needed to support a test case rather than resetting the limit in the run
 # script for the particular test in question.
-if ! ulimit -f -H 128000; then
+if ! ulimit -f 128000; then
   err_echo "ulimit file size setting failed"
 fi
 
index c211ed6..3203f7a 100755 (executable)
@@ -48,6 +48,7 @@ import argparse
 import fnmatch
 import itertools
 import json
+import multiprocessing
 import os
 import re
 import subprocess
@@ -115,7 +116,7 @@ failed_tests = []
 skipped_tests = []
 
 # Flags
-n_thread = 1
+n_thread = -1
 test_count = 0
 total_test_count = 0
 verbose = False
@@ -257,9 +258,26 @@ def setup_test_env():
     ADDRESS_SIZES_TARGET['host'] = ADDRESS_SIZES_TARGET['host'].union(ADDRESS_SIZES)
     ADDRESS_SIZES_TARGET['target'] = ADDRESS_SIZES_TARGET['target'].union(ADDRESS_SIZES)
 
+  global n_thread
+  if n_thread is -1:
+    if 'target' in TARGET_TYPES:
+      n_thread = get_default_threads('target')
+    else:
+      n_thread = get_default_threads('host')
+
   global semaphore
   semaphore = threading.Semaphore(n_thread)
 
+  if not sys.stdout.isatty():
+    global COLOR_ERROR
+    global COLOR_PASS
+    global COLOR_SKIP
+    global COLOR_NORMAL
+    COLOR_ERROR = ''
+    COLOR_PASS = ''
+    COLOR_SKIP = ''
+    COLOR_NORMAL = ''
+
 
 def run_tests(tests):
   """Creates thread workers to run the tests.
@@ -774,6 +792,15 @@ def setup_env_for_build_target(build_target, parser, options):
 
   return target_options
 
+def get_default_threads(target):
+  if target is 'target':
+    adb_command = 'adb shell cat /sys/devices/system/cpu/present'
+    cpu_info_proc = subprocess.Popen(adb_command.split(), stdout=subprocess.PIPE)
+    cpu_info = cpu_info_proc.stdout.read()
+    return int(cpu_info.split('-')[1])
+  else:
+    return multiprocessing.cpu_count()
+
 def parse_option():
   global verbose
   global dry_run
@@ -895,6 +922,7 @@ def parse_option():
     if options['gdb_arg']:
       gdb_arg = options['gdb_arg']
   timeout = options['timeout']
+
   return test
 
 def main():
@@ -908,7 +936,7 @@ def main():
     if 'target' in TARGET_TYPES:
       build_targets += 'test-art-target-run-test-dependencies'
     build_command = 'make'
-    build_command += ' -j' + str(n_thread)
+    build_command += ' -j'
     build_command += ' -C ' + env.ANDROID_BUILD_TOP
     build_command += ' ' + build_targets
     # Add 'dist' to avoid Jack issues b/36169180.