JIT mini-debug-info: Remove global maps.

Keep the extra bookkeeping information in JITCodeEntry.

Also do the compression eagerly during GC rather then lazily.

Test: test.py -b --host --jit
Bug: 119800099
Change-Id: Ie6cc682033a32c01d4c2cac242d8a4201116f940
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index d84a132..f01554a 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -127,17 +127,14 @@
     REQUIRES_SHARED(Locks::mutator_lock_) {
   const CompilerOptions& compiler_options = GetCompilerOptions();
   if (compiler_options.GetGenerateDebugInfo()) {
+    InstructionSet isa = compiler_options.GetInstructionSet();
+    const InstructionSetFeatures* features = compiler_options.GetInstructionSetFeatures();
     const ArrayRef<mirror::Class*> types_array(types, count);
-    std::vector<uint8_t> elf_file = debug::WriteDebugElfFileForClasses(
-        kRuntimeISA, compiler_options.GetInstructionSetFeatures(), types_array);
-    // We never free debug info for types, so we don't need to provide a handle
-    // (which would have been otherwise used as identifier to remove it later).
-    AddNativeDebugInfoForJit(Thread::Current(),
-                             /*code_ptr=*/ nullptr,
-                             elf_file,
-                             /*pack*/ nullptr,
-                             compiler_options.GetInstructionSet(),
-                             compiler_options.GetInstructionSetFeatures());
+    std::vector<uint8_t> elf_file =
+        debug::WriteDebugElfFileForClasses(isa, features, types_array);
+
+    // NB: Don't allow packing since it would remove non-backtrace data.
+    AddNativeDebugInfoForJit(/*code_ptr=*/ nullptr, elf_file, /*allow_packing=*/ false);
   }
 }
 
@@ -145,6 +142,13 @@
   return GetCompilerOptions().GetGenerateDebugInfo();
 }
 
+std::vector<uint8_t> JitCompiler::PackElfFileForJIT(ArrayRef<JITCodeEntry*> elf_files,
+                                                    ArrayRef<const void*> removed_symbols,
+                                                    bool compress,
+                                                    /*out*/ size_t* num_symbols) {
+  return debug::PackElfFileForJIT(elf_files, removed_symbols, compress, num_symbols);
+}
+
 JitCompiler::JitCompiler() {
   compiler_options_.reset(new CompilerOptions());
   ParseCompilerOptions();