Pass self to lock methods.
This avoids frequent recomputation of
Thread::Current/pthread_getspecific.
Also add a futex based reader/writer mutex that is disabled.
Change-Id: I118fdb99ef1d1c4bfda6446ba3a0d8b6ab31eaee
diff --git a/src/mark_sweep.cc b/src/mark_sweep.cc
index 2c280a2..cdb73db 100644
--- a/src/mark_sweep.cc
+++ b/src/mark_sweep.cc
@@ -25,10 +25,12 @@
#include "heap.h"
#include "indirect_reference_table.h"
#include "intern_table.h"
+#include "jni_internal.h"
#include "logging.h"
#include "macros.h"
#include "mark_stack.h"
#include "monitor.h"
+#include "mutex.h"
#include "object.h"
#include "runtime.h"
#include "space.h"
@@ -456,7 +458,7 @@
};
void MarkSweep::SweepCallback(size_t num_ptrs, Object** ptrs, void* arg) {
- Locks::heap_bitmap_lock_->AssertExclusiveHeld();
+ Locks::heap_bitmap_lock_->AssertExclusiveHeld(Thread::Current());
size_t freed_objects = num_ptrs;
size_t freed_bytes = 0;
@@ -490,7 +492,7 @@
}
void MarkSweep::ZygoteSweepCallback(size_t num_ptrs, Object** ptrs, void* arg) {
- Locks::heap_bitmap_lock_->AssertExclusiveHeld();
+ Locks::heap_bitmap_lock_->AssertExclusiveHeld(Thread::Current());
SweepCallbackContext* context = static_cast<SweepCallbackContext*>(arg);
Heap* heap = context->mark_sweep->GetHeap();