NativePcOffsetToReferenceMap

Rather than translate a native PC to a Dex PC and then to the reference
bitmap, just go straight from the native PC to the reference bitmap.
Encode the native PC offsets using a hash rather than linearly
searching.

Change-Id: Iee1073d93c941c0a31f639e5f23cea9e9f747bee
diff --git a/src/compiler.cc b/src/compiler.cc
index b80b6a6..abbb939 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -554,8 +554,7 @@
   timings.AddSplit("PreCompile.InitializeClassesWithoutClinit");
 }
 
-void Compiler::PostCompile(jobject class_loader, const std::vector<const DexFile*>& dex_files) {
-  SetGcMaps(class_loader, dex_files);
+void Compiler::PostCompile(jobject, const std::vector<const DexFile*>&) {
 }
 
 bool Compiler::IsImageClass(const std::string& descriptor) const {
@@ -1703,72 +1702,6 @@
   return it->second;
 }
 
-void Compiler::SetGcMaps(jobject class_loader, const std::vector<const DexFile*>& dex_files) {
-  for (size_t i = 0; i != dex_files.size(); ++i) {
-    const DexFile* dex_file = dex_files[i];
-    CHECK(dex_file != NULL);
-    SetGcMapsDexFile(class_loader, *dex_file);
-  }
-}
-
-void Compiler::SetGcMapsDexFile(jobject jni_class_loader, const DexFile& dex_file) {
-  ScopedObjectAccess soa(Thread::Current());
-  ClassLoader* class_loader = soa.Decode<ClassLoader*>(jni_class_loader);
-  ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
-  DexCache* dex_cache = class_linker->FindDexCache(dex_file);
-  for (size_t class_def_index = 0; class_def_index < dex_file.NumClassDefs(); class_def_index++) {
-    const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
-    const char* descriptor = dex_file.GetClassDescriptor(class_def);
-    Class* klass = class_linker->FindClass(descriptor, class_loader);
-    if (klass == NULL || !klass->IsVerified()) {
-      Thread::Current()->ClearException();
-      continue;
-    }
-    const byte* class_data = dex_file.GetClassData(class_def);
-    if (class_data == NULL) {
-      // empty class such as a marker interface
-      continue;
-    }
-    ClassDataItemIterator it(dex_file, class_data);
-    while (it.HasNextStaticField()) {
-      it.Next();
-    }
-    while (it.HasNextInstanceField()) {
-      it.Next();
-    }
-    while (it.HasNextDirectMethod()) {
-      Method* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), dex_cache,
-                                                   class_loader, NULL, it.GetMethodInvokeType(class_def));
-      SetGcMapsMethod(dex_file, method);
-      it.Next();
-    }
-    while (it.HasNextVirtualMethod()) {
-      Method* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), dex_cache,
-                                                   class_loader, NULL, it.GetMethodInvokeType(class_def));
-      SetGcMapsMethod(dex_file, method);
-      it.Next();
-    }
-  }
-}
-
-void Compiler::SetGcMapsMethod(const DexFile& dex_file, Method* method) {
-  if (method == NULL) {
-    Thread::Current()->ClearException();
-    return;
-  }
-  uint16_t method_idx = method->GetDexMethodIndex();
-  MethodReference ref(&dex_file, method_idx);
-  CompiledMethod* compiled_method = GetCompiledMethod(ref);
-  if (compiled_method == NULL) {
-    return;
-  }
-  const std::vector<uint8_t>* gc_map = verifier::MethodVerifier::GetGcMap(ref);
-  if (gc_map == NULL) {
-    return;
-  }
-  compiled_method->SetGcMap(*gc_map);
-}
-
 #if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_QUICK_COMPILER)
 void Compiler::SetBitcodeFileName(std::string const& filename) {
   typedef void (*SetBitcodeFileNameFn)(Compiler&, std::string const&);