Call NativeDebugInfoPostFork in the child post-fork.
It only applies to children, and must be called before threads resume.
Test: ./art/test/run-test --host --jit --gdb --runtime-option -Xjitthreshold:0 689-zygote-jit-deopt
Change-Id: I20a82b55316e4343948a54c17289049f587c354e
diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc
index 0397ad8..3f6aae9 100644
--- a/runtime/jit/debugger_interface.cc
+++ b/runtime/jit/debugger_interface.cc
@@ -361,10 +361,9 @@
}
void NativeDebugInfoPostFork() {
+ CHECK(!Runtime::Current()->IsZygote());
JITDescriptor& descriptor = JitNativeInfo::Descriptor();
- if (!Runtime::Current()->IsZygote()) {
- descriptor.free_entries_ = nullptr; // Don't reuse zygote's entries.
- }
+ descriptor.free_entries_ = nullptr; // Don't reuse zygote's entries.
}
// Size of JIT code range covered by each packed JITCodeEntry.
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index d6d0b87..788c10f 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1218,6 +1218,10 @@
// TODO(ngeoffray): Fix this so we still collect deoptimized and unused code.
code_cache_->SetGarbageCollectCode(false);
}
+
+ // We do this here instead of PostZygoteFork, as NativeDebugInfoPostFork only
+ // applies to a child.
+ NativeDebugInfoPostFork();
}
void Jit::PreZygoteFork() {
@@ -1234,8 +1238,6 @@
return;
}
thread_pool_->CreateThreads();
-
- NativeDebugInfoPostFork();
}
void Jit::BootCompleted() {