[jitzygote] Remap boot boot image methods in zygote when single-threaded.
This avoids concurrent updates made by other threads while copying the
data.
Bug: 143569713
Bug: 119800099
Test: boots
Change-Id: Ife0141a45b8d8671ab0c5868ccf90b4799a9f5db
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index 637d5e3..58cf0e3 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -127,12 +127,17 @@
region_->WriteData(compilation_state_, state);
}
+ bool IsCompilationDoneButNotNotified() const {
+ return compilation_state_ != nullptr && *compilation_state_ == ZygoteCompilationState::kDone;
+ }
+
bool IsCompilationNotified() const {
- return *compilation_state_ > ZygoteCompilationState::kDone;
+ return compilation_state_ != nullptr && *compilation_state_ > ZygoteCompilationState::kDone;
}
bool CanMapBootImageMethods() const {
- return *compilation_state_ == ZygoteCompilationState::kNotifiedOk;
+ return compilation_state_ != nullptr &&
+ *compilation_state_ == ZygoteCompilationState::kNotifiedOk;
}
private: