summaryrefslogtreecommitdiffstats
path: root/src/heap.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2012-10-03 21:09:42 -0700
committerIan Rogers <irogers@google.com>2012-10-04 09:27:04 -0700
commit1f5393447b9f45be7918042d9ee7b521376de866 (patch)
tree1793cb0ae00b38a63f8cfd3a25b6cb0ee4edca16 /src/heap.cc
parent870ea4772199f8d4cbd9a269f9093620ee50a59c (diff)
downloadart-1f5393447b9f45be7918042d9ee7b521376de866.zip
art-1f5393447b9f45be7918042d9ee7b521376de866.tar.gz
art-1f5393447b9f45be7918042d9ee7b521376de866.tar.bz2
Make PopSirt inlinable, pass self to SirtRef.
Change-Id: Ieb91526b1cb1f8644ceb3c5b99649f658f43bbc1
Diffstat (limited to 'src/heap.cc')
-rw-r--r--src/heap.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/heap.cc b/src/heap.cc
index 703549f..5c6a606 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -34,6 +34,7 @@
#include "os.h"
#include "ScopedLocalRef.h"
#include "scoped_thread_state_change.h"
+#include "sirt_ref.h"
#include "space.h"
#include "stl_util.h"
#include "thread_list.h"
@@ -420,8 +421,9 @@ Object* Heap::AllocObject(Class* c, size_t byte_count) {
concurrent_start_bytes_ = std::numeric_limits<size_t>::max();
bytes_since_last_gc_ = 0;
// The SirtRef is necessary since the calls in RequestConcurrentGC are a safepoint.
- SirtRef<Object> ref(obj);
- RequestConcurrentGC();
+ Thread* self = Thread::Current();
+ SirtRef<Object> ref(self, obj);
+ RequestConcurrentGC(self);
}
VerifyObject(obj);
@@ -1923,14 +1925,13 @@ void Heap::EnqueueClearedReferences(Object** cleared) {
}
}
-void Heap::RequestConcurrentGC() {
+void Heap::RequestConcurrentGC(Thread* self) {
// Make sure that we can do a concurrent GC.
Runtime* runtime = Runtime::Current();
if (requesting_gc_ || runtime == NULL || !runtime->IsFinishedStarting() ||
!runtime->IsConcurrentGcEnabled()) {
return;
}
- Thread* self = Thread::Current();
{
MutexLock mu(self, *Locks::runtime_shutdown_lock_);
if (runtime->IsShuttingDown()) {