diff options
Diffstat (limited to 'runtime/linear_alloc-inl.h')
-rw-r--r-- | runtime/linear_alloc-inl.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/linear_alloc-inl.h b/runtime/linear_alloc-inl.h index 13dbea11d0..7c81352cd9 100644 --- a/runtime/linear_alloc-inl.h +++ b/runtime/linear_alloc-inl.h @@ -40,6 +40,18 @@ inline void LinearAlloc::SetFirstObject(void* begin, size_t bytes) const { down_cast<TrackedArena*>(arena)->SetFirstObject(static_cast<uint8_t*>(begin), end); } +inline void LinearAlloc::ConvertToNoGcRoots(void* ptr, LinearAllocKind orig_kind) { + if (track_allocations_ && ptr != nullptr) { + TrackingHeader* header = static_cast<TrackingHeader*>(ptr); + header--; + DCHECK_EQ(header->GetKind(), orig_kind); + DCHECK_GT(header->GetSize(), 0u); + // 16-byte allocations are not supported yet. + DCHECK(!header->Is16Aligned()); + header->SetKind(LinearAllocKind::kNoGCRoots); + } +} + inline void LinearAlloc::SetupForPostZygoteFork(Thread* self) { MutexLock mu(self, lock_); DCHECK(track_allocations_); |