diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-01-23 13:50:03 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-01-25 13:18:11 -0800 |
commit | cb535da36915f9d10bec3880b46f1de1f7a69f22 (patch) | |
tree | 5fc15c1fab170f0f27022ad19880c5ffb15baa01 /runtime/thread-inl.h | |
parent | 61e620d4771e09143471e38fe7531678a36ce3f8 (diff) | |
download | art-cb535da36915f9d10bec3880b46f1de1f7a69f22.zip art-cb535da36915f9d10bec3880b46f1de1f7a69f22.tar.gz art-cb535da36915f9d10bec3880b46f1de1f7a69f22.tar.bz2 |
Change AtomicStack to use StackReference
Previously used Object*, using StackReference saves memory on 64 bit
devices.
Bug: 12935052
Bug: 17643507
Change-Id: I035878690054eeeb24d655a900b8f26c837703ff
Diffstat (limited to 'runtime/thread-inl.h')
-rw-r--r-- | runtime/thread-inl.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h index a85d608..16add79 100644 --- a/runtime/thread-inl.h +++ b/runtime/thread-inl.h @@ -213,22 +213,23 @@ inline bool Thread::PushOnThreadLocalAllocationStack(mirror::Object* obj) { if (tlsPtr_.thread_local_alloc_stack_top < tlsPtr_.thread_local_alloc_stack_end) { // There's room. DCHECK_LE(reinterpret_cast<uint8_t*>(tlsPtr_.thread_local_alloc_stack_top) + - sizeof(mirror::Object*), + sizeof(StackReference<mirror::Object>), reinterpret_cast<uint8_t*>(tlsPtr_.thread_local_alloc_stack_end)); - DCHECK(*tlsPtr_.thread_local_alloc_stack_top == nullptr); - *tlsPtr_.thread_local_alloc_stack_top = obj; + DCHECK(tlsPtr_.thread_local_alloc_stack_top->AsMirrorPtr() == nullptr); + tlsPtr_.thread_local_alloc_stack_top->Assign(obj); ++tlsPtr_.thread_local_alloc_stack_top; return true; } return false; } -inline void Thread::SetThreadLocalAllocationStack(mirror::Object** start, mirror::Object** end) { +inline void Thread::SetThreadLocalAllocationStack(StackReference<mirror::Object>* start, + StackReference<mirror::Object>* end) { DCHECK(Thread::Current() == this) << "Should be called by self"; DCHECK(start != nullptr); DCHECK(end != nullptr); - DCHECK_ALIGNED(start, sizeof(mirror::Object*)); - DCHECK_ALIGNED(end, sizeof(mirror::Object*)); + DCHECK_ALIGNED(start, sizeof(StackReference<mirror::Object>)); + DCHECK_ALIGNED(end, sizeof(StackReference<mirror::Object>)); DCHECK_LT(start, end); tlsPtr_.thread_local_alloc_stack_end = end; tlsPtr_.thread_local_alloc_stack_top = start; |