JIT mini-debug-info: Allocate entries in the JIT data space.

Test: test.py -b --host --jit
Test: device boots
Bug: 119800099
Change-Id: I7efa1e6e6660239cbd6438b829e08dd9cd079343
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index f01554a..0bdab0b 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -123,8 +123,7 @@
   return jit_compiler;
 }
 
-void JitCompiler::TypesLoaded(mirror::Class** types, size_t count)
-    REQUIRES_SHARED(Locks::mutator_lock_) {
+void JitCompiler::TypesLoaded(mirror::Class** types, size_t count) {
   const CompilerOptions& compiler_options = GetCompilerOptions();
   if (compiler_options.GetGenerateDebugInfo()) {
     InstructionSet isa = compiler_options.GetInstructionSet();
@@ -134,6 +133,7 @@
         debug::WriteDebugElfFileForClasses(isa, features, types_array);
 
     // NB: Don't allow packing since it would remove non-backtrace data.
+    MutexLock mu(Thread::Current(), *Locks::jit_lock_);
     AddNativeDebugInfoForJit(/*code_ptr=*/ nullptr, elf_file, /*allow_packing=*/ false);
   }
 }
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 5d06969..8ef1b55 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -1486,6 +1486,7 @@
     std::vector<uint8_t> elf = debug::MakeElfFileForJIT(isa, features, mini_debug_info, info);
 
     // NB: Don't allow packing of full info since it would remove non-backtrace data.
+    MutexLock mu(Thread::Current(), *Locks::jit_lock_);
     const void* code_ptr = reinterpret_cast<const void*>(info.code_address);
     AddNativeDebugInfoForJit(code_ptr, elf, /*allow_packing=*/ mini_debug_info);
   }