xref: /aosp_15_r20/art/runtime/jit/jit_memory_region.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker  * Copyright 2019 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker  *
4*795d594fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker  *
8*795d594fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker  *
10*795d594fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker  * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker  */
16*795d594fSAndroid Build Coastguard Worker 
17*795d594fSAndroid Build Coastguard Worker #ifndef ART_RUNTIME_JIT_JIT_MEMORY_REGION_H_
18*795d594fSAndroid Build Coastguard Worker #define ART_RUNTIME_JIT_JIT_MEMORY_REGION_H_
19*795d594fSAndroid Build Coastguard Worker 
20*795d594fSAndroid Build Coastguard Worker #include <string>
21*795d594fSAndroid Build Coastguard Worker 
22*795d594fSAndroid Build Coastguard Worker #include "arch/instruction_set.h"
23*795d594fSAndroid Build Coastguard Worker #include "base/globals.h"
24*795d594fSAndroid Build Coastguard Worker #include "base/locks.h"
25*795d594fSAndroid Build Coastguard Worker #include "base/mem_map.h"
26*795d594fSAndroid Build Coastguard Worker #include "gc_root-inl.h"
27*795d594fSAndroid Build Coastguard Worker #include "handle.h"
28*795d594fSAndroid Build Coastguard Worker 
29*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN {
30*795d594fSAndroid Build Coastguard Worker 
31*795d594fSAndroid Build Coastguard Worker namespace mirror {
32*795d594fSAndroid Build Coastguard Worker class Object;
33*795d594fSAndroid Build Coastguard Worker }
34*795d594fSAndroid Build Coastguard Worker 
35*795d594fSAndroid Build Coastguard Worker namespace jit {
36*795d594fSAndroid Build Coastguard Worker 
37*795d594fSAndroid Build Coastguard Worker class TestZygoteMemory;
38*795d594fSAndroid Build Coastguard Worker 
39*795d594fSAndroid Build Coastguard Worker // Number of bytes represented by a bit in the CodeCacheBitmap. Value is reasonable for all
40*795d594fSAndroid Build Coastguard Worker // architectures.
41*795d594fSAndroid Build Coastguard Worker static constexpr int kJitCodeAccountingBytes = 16;
42*795d594fSAndroid Build Coastguard Worker 
43*795d594fSAndroid Build Coastguard Worker // Helper to get the size required for emitting `number_of_roots` in the
44*795d594fSAndroid Build Coastguard Worker // data portion of a JIT memory region.
ComputeRootTableSize(uint32_t number_of_roots)45*795d594fSAndroid Build Coastguard Worker uint32_t inline ComputeRootTableSize(uint32_t number_of_roots) {
46*795d594fSAndroid Build Coastguard Worker   return sizeof(uint32_t) + number_of_roots * sizeof(GcRoot<mirror::Object>);
47*795d594fSAndroid Build Coastguard Worker }
48*795d594fSAndroid Build Coastguard Worker 
49*795d594fSAndroid Build Coastguard Worker // Represents a memory region for the JIT, where code and data are stored. This class
50*795d594fSAndroid Build Coastguard Worker // provides allocation and deallocation primitives.
51*795d594fSAndroid Build Coastguard Worker class JitMemoryRegion {
52*795d594fSAndroid Build Coastguard Worker  public:
JitMemoryRegion()53*795d594fSAndroid Build Coastguard Worker   JitMemoryRegion()
54*795d594fSAndroid Build Coastguard Worker       : initial_capacity_(0),
55*795d594fSAndroid Build Coastguard Worker         max_capacity_(0),
56*795d594fSAndroid Build Coastguard Worker         current_capacity_(0),
57*795d594fSAndroid Build Coastguard Worker         data_end_(0),
58*795d594fSAndroid Build Coastguard Worker         exec_end_(0),
59*795d594fSAndroid Build Coastguard Worker         used_memory_for_code_(0),
60*795d594fSAndroid Build Coastguard Worker         used_memory_for_data_(0),
61*795d594fSAndroid Build Coastguard Worker         data_pages_(),
62*795d594fSAndroid Build Coastguard Worker         writable_data_pages_(),
63*795d594fSAndroid Build Coastguard Worker         exec_pages_(),
64*795d594fSAndroid Build Coastguard Worker         non_exec_pages_(),
65*795d594fSAndroid Build Coastguard Worker         data_mspace_(nullptr),
66*795d594fSAndroid Build Coastguard Worker         exec_mspace_(nullptr) {}
67*795d594fSAndroid Build Coastguard Worker 
68*795d594fSAndroid Build Coastguard Worker   bool Initialize(size_t initial_capacity,
69*795d594fSAndroid Build Coastguard Worker                   size_t max_capacity,
70*795d594fSAndroid Build Coastguard Worker                   bool rwx_memory_allowed,
71*795d594fSAndroid Build Coastguard Worker                   bool is_zygote,
72*795d594fSAndroid Build Coastguard Worker                   std::string* error_msg)
73*795d594fSAndroid Build Coastguard Worker       REQUIRES(Locks::jit_lock_);
74*795d594fSAndroid Build Coastguard Worker 
75*795d594fSAndroid Build Coastguard Worker   // Try to increase the current capacity of the code cache. Return whether we
76*795d594fSAndroid Build Coastguard Worker   // succeeded at doing so.
77*795d594fSAndroid Build Coastguard Worker   bool IncreaseCodeCacheCapacity() REQUIRES(Locks::jit_lock_);
78*795d594fSAndroid Build Coastguard Worker 
79*795d594fSAndroid Build Coastguard Worker   // Set the footprint limit of the code cache.
80*795d594fSAndroid Build Coastguard Worker   void SetFootprintLimit(size_t new_footprint) REQUIRES(Locks::jit_lock_);
81*795d594fSAndroid Build Coastguard Worker 
82*795d594fSAndroid Build Coastguard Worker   const uint8_t* AllocateCode(size_t code_size) REQUIRES(Locks::jit_lock_);
83*795d594fSAndroid Build Coastguard Worker   void FreeCode(const uint8_t* code) REQUIRES(Locks::jit_lock_);
84*795d594fSAndroid Build Coastguard Worker   const uint8_t* AllocateData(size_t data_size) REQUIRES(Locks::jit_lock_);
85*795d594fSAndroid Build Coastguard Worker   void FreeData(const uint8_t* data) REQUIRES(Locks::jit_lock_);
86*795d594fSAndroid Build Coastguard Worker   void FreeData(uint8_t* writable_data) REQUIRES(Locks::jit_lock_) = delete;
87*795d594fSAndroid Build Coastguard Worker   void FreeWritableData(uint8_t* writable_data) REQUIRES(Locks::jit_lock_);
88*795d594fSAndroid Build Coastguard Worker 
89*795d594fSAndroid Build Coastguard Worker   // Emit header and code into the memory pointed by `reserved_code` (despite it being const).
90*795d594fSAndroid Build Coastguard Worker   // Returns pointer to copied code (within reserved_code region; after OatQuickMethodHeader).
91*795d594fSAndroid Build Coastguard Worker   const uint8_t* CommitCode(ArrayRef<const uint8_t> reserved_code,
92*795d594fSAndroid Build Coastguard Worker                             ArrayRef<const uint8_t> code,
93*795d594fSAndroid Build Coastguard Worker                             const uint8_t* stack_map)
94*795d594fSAndroid Build Coastguard Worker       REQUIRES(Locks::jit_lock_);
95*795d594fSAndroid Build Coastguard Worker 
96*795d594fSAndroid Build Coastguard Worker   // Emit roots and stack map into the memory pointed by `roots_data` (despite it being const).
97*795d594fSAndroid Build Coastguard Worker   bool CommitData(ArrayRef<const uint8_t> reserved_data,
98*795d594fSAndroid Build Coastguard Worker                   const std::vector<Handle<mirror::Object>>& roots,
99*795d594fSAndroid Build Coastguard Worker                   ArrayRef<const uint8_t> stack_map)
100*795d594fSAndroid Build Coastguard Worker       REQUIRES(Locks::jit_lock_)
101*795d594fSAndroid Build Coastguard Worker       REQUIRES_SHARED(Locks::mutator_lock_);
102*795d594fSAndroid Build Coastguard Worker 
ResetWritableMappings()103*795d594fSAndroid Build Coastguard Worker   void ResetWritableMappings() REQUIRES(Locks::jit_lock_) {
104*795d594fSAndroid Build Coastguard Worker     non_exec_pages_.ResetInForkedProcess();
105*795d594fSAndroid Build Coastguard Worker     writable_data_pages_.ResetInForkedProcess();
106*795d594fSAndroid Build Coastguard Worker     // Also clear the mspaces, which, in their implementation,
107*795d594fSAndroid Build Coastguard Worker     // point to the discarded mappings.
108*795d594fSAndroid Build Coastguard Worker     exec_mspace_ = nullptr;
109*795d594fSAndroid Build Coastguard Worker     data_mspace_ = nullptr;
110*795d594fSAndroid Build Coastguard Worker   }
111*795d594fSAndroid Build Coastguard Worker 
IsValid()112*795d594fSAndroid Build Coastguard Worker   bool IsValid() const NO_THREAD_SAFETY_ANALYSIS {
113*795d594fSAndroid Build Coastguard Worker     return exec_mspace_ != nullptr || data_mspace_ != nullptr;
114*795d594fSAndroid Build Coastguard Worker   }
115*795d594fSAndroid Build Coastguard Worker 
116*795d594fSAndroid Build Coastguard Worker   template <typename T>
FillData(const T * address,size_t n,const T & t)117*795d594fSAndroid Build Coastguard Worker   void FillData(const T* address, size_t n, const T& t)  REQUIRES(Locks::jit_lock_) {
118*795d594fSAndroid Build Coastguard Worker     std::fill_n(GetWritableDataAddress(address), n, t);
119*795d594fSAndroid Build Coastguard Worker   }
120*795d594fSAndroid Build Coastguard Worker 
121*795d594fSAndroid Build Coastguard Worker   // Generic helper for writing abritrary data in the data portion of the
122*795d594fSAndroid Build Coastguard Worker   // region.
123*795d594fSAndroid Build Coastguard Worker   template <typename T>
WriteData(const T * address,const T & value)124*795d594fSAndroid Build Coastguard Worker   void WriteData(const T* address, const T& value) {
125*795d594fSAndroid Build Coastguard Worker     *GetWritableDataAddress(address) = value;
126*795d594fSAndroid Build Coastguard Worker   }
127*795d594fSAndroid Build Coastguard Worker 
HasDualCodeMapping()128*795d594fSAndroid Build Coastguard Worker   bool HasDualCodeMapping() const {
129*795d594fSAndroid Build Coastguard Worker     return non_exec_pages_.IsValid();
130*795d594fSAndroid Build Coastguard Worker   }
131*795d594fSAndroid Build Coastguard Worker 
HasDualDataMapping()132*795d594fSAndroid Build Coastguard Worker   bool HasDualDataMapping() const {
133*795d594fSAndroid Build Coastguard Worker     return writable_data_pages_.IsValid();
134*795d594fSAndroid Build Coastguard Worker   }
135*795d594fSAndroid Build Coastguard Worker 
HasCodeMapping()136*795d594fSAndroid Build Coastguard Worker   bool HasCodeMapping() const {
137*795d594fSAndroid Build Coastguard Worker     return exec_pages_.IsValid();
138*795d594fSAndroid Build Coastguard Worker   }
139*795d594fSAndroid Build Coastguard Worker 
IsInDataSpace(const void * ptr)140*795d594fSAndroid Build Coastguard Worker   bool IsInDataSpace(const void* ptr) const {
141*795d594fSAndroid Build Coastguard Worker     return data_pages_.HasAddress(ptr);
142*795d594fSAndroid Build Coastguard Worker   }
143*795d594fSAndroid Build Coastguard Worker 
IsInExecSpace(const void * ptr)144*795d594fSAndroid Build Coastguard Worker   bool IsInExecSpace(const void* ptr) const {
145*795d594fSAndroid Build Coastguard Worker     return exec_pages_.HasAddress(ptr);
146*795d594fSAndroid Build Coastguard Worker   }
147*795d594fSAndroid Build Coastguard Worker 
GetExecPages()148*795d594fSAndroid Build Coastguard Worker   const MemMap* GetExecPages() const {
149*795d594fSAndroid Build Coastguard Worker     return &exec_pages_;
150*795d594fSAndroid Build Coastguard Worker   }
151*795d594fSAndroid Build Coastguard Worker 
152*795d594fSAndroid Build Coastguard Worker   void* MoreCore(const void* mspace, intptr_t increment);
153*795d594fSAndroid Build Coastguard Worker 
OwnsSpace(const void * mspace)154*795d594fSAndroid Build Coastguard Worker   bool OwnsSpace(const void* mspace) const NO_THREAD_SAFETY_ANALYSIS {
155*795d594fSAndroid Build Coastguard Worker     return mspace == data_mspace_ || mspace == exec_mspace_;
156*795d594fSAndroid Build Coastguard Worker   }
157*795d594fSAndroid Build Coastguard Worker 
GetCurrentCapacity()158*795d594fSAndroid Build Coastguard Worker   size_t GetCurrentCapacity() const REQUIRES(Locks::jit_lock_) {
159*795d594fSAndroid Build Coastguard Worker     return current_capacity_;
160*795d594fSAndroid Build Coastguard Worker   }
161*795d594fSAndroid Build Coastguard Worker 
GetMaxCapacity()162*795d594fSAndroid Build Coastguard Worker   size_t GetMaxCapacity() const REQUIRES(Locks::jit_lock_) {
163*795d594fSAndroid Build Coastguard Worker     return max_capacity_;
164*795d594fSAndroid Build Coastguard Worker   }
165*795d594fSAndroid Build Coastguard Worker 
GetUsedMemoryForCode()166*795d594fSAndroid Build Coastguard Worker   size_t GetUsedMemoryForCode() const REQUIRES(Locks::jit_lock_) {
167*795d594fSAndroid Build Coastguard Worker     return used_memory_for_code_;
168*795d594fSAndroid Build Coastguard Worker   }
169*795d594fSAndroid Build Coastguard Worker 
GetResidentMemoryForCode()170*795d594fSAndroid Build Coastguard Worker   size_t GetResidentMemoryForCode() const REQUIRES(Locks::jit_lock_) {
171*795d594fSAndroid Build Coastguard Worker     return exec_end_;
172*795d594fSAndroid Build Coastguard Worker   }
173*795d594fSAndroid Build Coastguard Worker 
GetUsedMemoryForData()174*795d594fSAndroid Build Coastguard Worker   size_t GetUsedMemoryForData() const REQUIRES(Locks::jit_lock_) {
175*795d594fSAndroid Build Coastguard Worker     return used_memory_for_data_;
176*795d594fSAndroid Build Coastguard Worker   }
177*795d594fSAndroid Build Coastguard Worker 
GetResidentMemoryForData()178*795d594fSAndroid Build Coastguard Worker   size_t GetResidentMemoryForData() const REQUIRES(Locks::jit_lock_) {
179*795d594fSAndroid Build Coastguard Worker     return data_end_;
180*795d594fSAndroid Build Coastguard Worker   }
181*795d594fSAndroid Build Coastguard Worker 
GetWritableDataAddress(const T * src_ptr)182*795d594fSAndroid Build Coastguard Worker   template <typename T> T* GetWritableDataAddress(const T* src_ptr) {
183*795d594fSAndroid Build Coastguard Worker     if (!HasDualDataMapping()) {
184*795d594fSAndroid Build Coastguard Worker       return const_cast<T*>(src_ptr);
185*795d594fSAndroid Build Coastguard Worker     }
186*795d594fSAndroid Build Coastguard Worker     return const_cast<T*>(TranslateAddress(src_ptr, data_pages_, writable_data_pages_));
187*795d594fSAndroid Build Coastguard Worker   }
188*795d594fSAndroid Build Coastguard Worker 
189*795d594fSAndroid Build Coastguard Worker  private:
190*795d594fSAndroid Build Coastguard Worker   template <typename T>
TranslateAddress(T * src_ptr,const MemMap & src,const MemMap & dst)191*795d594fSAndroid Build Coastguard Worker   T* TranslateAddress(T* src_ptr, const MemMap& src, const MemMap& dst) {
192*795d594fSAndroid Build Coastguard Worker     CHECK(src.HasAddress(src_ptr)) << reinterpret_cast<const void*>(src_ptr);
193*795d594fSAndroid Build Coastguard Worker     const uint8_t* const raw_src_ptr = reinterpret_cast<const uint8_t*>(src_ptr);
194*795d594fSAndroid Build Coastguard Worker     return reinterpret_cast<T*>(raw_src_ptr - src.Begin() + dst.Begin());
195*795d594fSAndroid Build Coastguard Worker   }
196*795d594fSAndroid Build Coastguard Worker 
GetUpdatableCodeMapping()197*795d594fSAndroid Build Coastguard Worker   const MemMap* GetUpdatableCodeMapping() const {
198*795d594fSAndroid Build Coastguard Worker     if (HasDualCodeMapping()) {
199*795d594fSAndroid Build Coastguard Worker       return &non_exec_pages_;
200*795d594fSAndroid Build Coastguard Worker     } else if (HasCodeMapping()) {
201*795d594fSAndroid Build Coastguard Worker       return &exec_pages_;
202*795d594fSAndroid Build Coastguard Worker     } else {
203*795d594fSAndroid Build Coastguard Worker       return nullptr;
204*795d594fSAndroid Build Coastguard Worker     }
205*795d594fSAndroid Build Coastguard Worker   }
206*795d594fSAndroid Build Coastguard Worker 
GetWritableDataMapping()207*795d594fSAndroid Build Coastguard Worker   const MemMap* GetWritableDataMapping() const {
208*795d594fSAndroid Build Coastguard Worker     if (HasDualDataMapping()) {
209*795d594fSAndroid Build Coastguard Worker       return &writable_data_pages_;
210*795d594fSAndroid Build Coastguard Worker     } else {
211*795d594fSAndroid Build Coastguard Worker       return &data_pages_;
212*795d594fSAndroid Build Coastguard Worker     }
213*795d594fSAndroid Build Coastguard Worker   }
214*795d594fSAndroid Build Coastguard Worker 
GetNonWritableDataAddress(T * src_ptr)215*795d594fSAndroid Build Coastguard Worker   template <typename T> T* GetNonWritableDataAddress(T* src_ptr) {
216*795d594fSAndroid Build Coastguard Worker     if (!HasDualDataMapping()) {
217*795d594fSAndroid Build Coastguard Worker       return src_ptr;
218*795d594fSAndroid Build Coastguard Worker     }
219*795d594fSAndroid Build Coastguard Worker     return TranslateAddress(src_ptr, writable_data_pages_, data_pages_);
220*795d594fSAndroid Build Coastguard Worker   }
221*795d594fSAndroid Build Coastguard Worker 
GetExecutableAddress(T * src_ptr)222*795d594fSAndroid Build Coastguard Worker   template <typename T> T* GetExecutableAddress(T* src_ptr) {
223*795d594fSAndroid Build Coastguard Worker     if (!HasDualCodeMapping()) {
224*795d594fSAndroid Build Coastguard Worker       return src_ptr;
225*795d594fSAndroid Build Coastguard Worker     }
226*795d594fSAndroid Build Coastguard Worker     return TranslateAddress(src_ptr, non_exec_pages_, exec_pages_);
227*795d594fSAndroid Build Coastguard Worker   }
228*795d594fSAndroid Build Coastguard Worker 
GetNonExecutableAddress(T * src_ptr)229*795d594fSAndroid Build Coastguard Worker   template <typename T> T* GetNonExecutableAddress(T* src_ptr) {
230*795d594fSAndroid Build Coastguard Worker     if (!HasDualCodeMapping()) {
231*795d594fSAndroid Build Coastguard Worker       return src_ptr;
232*795d594fSAndroid Build Coastguard Worker     }
233*795d594fSAndroid Build Coastguard Worker     return TranslateAddress(src_ptr, exec_pages_, non_exec_pages_);
234*795d594fSAndroid Build Coastguard Worker   }
235*795d594fSAndroid Build Coastguard Worker 
236*795d594fSAndroid Build Coastguard Worker   static int CreateZygoteMemory(size_t capacity, std::string* error_msg);
237*795d594fSAndroid Build Coastguard Worker   static bool ProtectZygoteMemory(int fd, std::string* error_msg);
238*795d594fSAndroid Build Coastguard Worker 
239*795d594fSAndroid Build Coastguard Worker   // The initial capacity in bytes this code region starts with.
240*795d594fSAndroid Build Coastguard Worker   size_t initial_capacity_ GUARDED_BY(Locks::jit_lock_);
241*795d594fSAndroid Build Coastguard Worker 
242*795d594fSAndroid Build Coastguard Worker   // The maximum capacity in bytes this region can go to.
243*795d594fSAndroid Build Coastguard Worker   size_t max_capacity_ GUARDED_BY(Locks::jit_lock_);
244*795d594fSAndroid Build Coastguard Worker 
245*795d594fSAndroid Build Coastguard Worker   // The current capacity in bytes of the region.
246*795d594fSAndroid Build Coastguard Worker   size_t current_capacity_ GUARDED_BY(Locks::jit_lock_);
247*795d594fSAndroid Build Coastguard Worker 
248*795d594fSAndroid Build Coastguard Worker   // The current footprint in bytes of the data portion of the region.
249*795d594fSAndroid Build Coastguard Worker   size_t data_end_ GUARDED_BY(Locks::jit_lock_);
250*795d594fSAndroid Build Coastguard Worker 
251*795d594fSAndroid Build Coastguard Worker   // The current footprint in bytes of the code portion of the region.
252*795d594fSAndroid Build Coastguard Worker   size_t exec_end_ GUARDED_BY(Locks::jit_lock_);
253*795d594fSAndroid Build Coastguard Worker 
254*795d594fSAndroid Build Coastguard Worker   // The size in bytes of used memory for the code portion of the region.
255*795d594fSAndroid Build Coastguard Worker   size_t used_memory_for_code_ GUARDED_BY(Locks::jit_lock_);
256*795d594fSAndroid Build Coastguard Worker 
257*795d594fSAndroid Build Coastguard Worker   // The size in bytes of used memory for the data portion of the region.
258*795d594fSAndroid Build Coastguard Worker   size_t used_memory_for_data_ GUARDED_BY(Locks::jit_lock_);
259*795d594fSAndroid Build Coastguard Worker 
260*795d594fSAndroid Build Coastguard Worker   // Mem map which holds data (stack maps and profiling info).
261*795d594fSAndroid Build Coastguard Worker   MemMap data_pages_;
262*795d594fSAndroid Build Coastguard Worker 
263*795d594fSAndroid Build Coastguard Worker   // Mem map which holds data with writable permission. Only valid for dual view
264*795d594fSAndroid Build Coastguard Worker   // JIT when this is the writable view and data_pages_ is the readable view.
265*795d594fSAndroid Build Coastguard Worker   MemMap writable_data_pages_;
266*795d594fSAndroid Build Coastguard Worker 
267*795d594fSAndroid Build Coastguard Worker   // Mem map which holds code and has executable permission.
268*795d594fSAndroid Build Coastguard Worker   MemMap exec_pages_;
269*795d594fSAndroid Build Coastguard Worker 
270*795d594fSAndroid Build Coastguard Worker   // Mem map which holds code with non executable permission. Only valid for dual view JIT when
271*795d594fSAndroid Build Coastguard Worker   // this is the non-executable view of code used to write updates.
272*795d594fSAndroid Build Coastguard Worker   MemMap non_exec_pages_;
273*795d594fSAndroid Build Coastguard Worker 
274*795d594fSAndroid Build Coastguard Worker   // The opaque mspace for allocating data.
275*795d594fSAndroid Build Coastguard Worker   void* data_mspace_ GUARDED_BY(Locks::jit_lock_);
276*795d594fSAndroid Build Coastguard Worker 
277*795d594fSAndroid Build Coastguard Worker   // The opaque mspace for allocating code.
278*795d594fSAndroid Build Coastguard Worker   void* exec_mspace_ GUARDED_BY(Locks::jit_lock_);
279*795d594fSAndroid Build Coastguard Worker 
280*795d594fSAndroid Build Coastguard Worker   friend class ScopedCodeCacheWrite;  // For GetUpdatableCodeMapping
281*795d594fSAndroid Build Coastguard Worker   friend class TestZygoteMemory;
282*795d594fSAndroid Build Coastguard Worker };
283*795d594fSAndroid Build Coastguard Worker 
284*795d594fSAndroid Build Coastguard Worker }  // namespace jit
285*795d594fSAndroid Build Coastguard Worker }  // namespace art
286*795d594fSAndroid Build Coastguard Worker 
287*795d594fSAndroid Build Coastguard Worker #endif  // ART_RUNTIME_JIT_JIT_MEMORY_REGION_H_
288