Revert "Revert "Make the JIT zygote memory shared.""
This reverts commit 2fef66b294417d447630f9d98de68227eef476d3.
Bug: 119800099
Bug: 136110523
Reason for revert: Fixed webview_zygote case.
Change-Id: Iaae8c999463d77b7b1e62b55458493bdbc97a104
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index a4e2964..88b440b 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -96,7 +96,11 @@
std::string* error_msg);
~JitCodeCache();
- bool NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr, bool prejit)
+ bool NotifyCompilationOf(ArtMethod* method,
+ Thread* self,
+ bool osr,
+ bool prejit,
+ JitMemoryRegion* region)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::jit_lock_);
@@ -213,7 +217,7 @@
REQUIRES_SHARED(Locks::mutator_lock_);
bool OwnsSpace(const void* mspace) const NO_THREAD_SAFETY_ANALYSIS {
- return private_region_.OwnsSpace(mspace);
+ return private_region_.OwnsSpace(mspace) || shared_region_.OwnsSpace(mspace);
}
void* MoreCore(const void* mspace, intptr_t increment);
@@ -276,7 +280,15 @@
// is debuggable.
void ClearEntryPointsInZygoteExecSpace() REQUIRES(!Locks::jit_lock_) REQUIRES(Locks::mutator_lock_);
- JitMemoryRegion* GetPrivateRegion() { return &private_region_; }
+ JitMemoryRegion* GetCurrentRegion();
+ bool IsSharedRegion(const JitMemoryRegion& region) const { return ®ion == &shared_region_; }
+ bool CanAllocateProfilingInfo() {
+ // If we don't have a private region, we cannot allocate a profiling info.
+ // A shared region doesn't support in general GC objects, which a profiling info
+ // can reference.
+ JitMemoryRegion* region = GetCurrentRegion();
+ return region->IsValid() && !IsSharedRegion(*region);
+ }
private:
JitCodeCache();