summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/heap.cc12
-rw-r--r--src/mark_stack.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/heap.cc b/src/heap.cc
index 3d84451d21..4576a9025a 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -497,8 +497,10 @@ void Heap::RecordAllocation(AllocSpace* space, const Object* obj) {
DCHECK_GT(size, 0u);
COMPILE_ASSERT(sizeof(size_t) == sizeof(int32_t),
int32_t_must_be_same_size_as_size_t_for_used_atomic_operations);
- android_atomic_add(size, reinterpret_cast<volatile int32_t*>(&num_bytes_allocated_));
- android_atomic_add(1, reinterpret_cast<volatile int32_t*>(&num_objects_allocated_));
+ android_atomic_add(size, reinterpret_cast<volatile int32_t*>(
+ reinterpret_cast<size_t>(&num_bytes_allocated_)));
+ android_atomic_add(1, reinterpret_cast<volatile int32_t*>(
+ reinterpret_cast<size_t>(&num_objects_allocated_)));
if (Runtime::Current()->HasStatsEnabled()) {
RuntimeStats* global_stats = Runtime::Current()->GetStats();
@@ -525,11 +527,13 @@ void Heap::RecordFree(size_t freed_objects, size_t freed_bytes) {
int32_t_must_be_same_size_as_size_t_for_used_atomic_operations);
DCHECK_LE(freed_objects, num_objects_allocated_);
android_atomic_add(-static_cast<int32_t>(freed_objects),
- reinterpret_cast<volatile int32_t*>(&num_objects_allocated_));
+ reinterpret_cast<volatile int32_t*>(
+ reinterpret_cast<size_t>(&num_objects_allocated_)));
DCHECK_LE(freed_bytes, num_bytes_allocated_);
android_atomic_add(-static_cast<int32_t>(freed_bytes),
- reinterpret_cast<volatile int32_t*>(&num_bytes_allocated_));
+ reinterpret_cast<volatile int32_t*>(
+ reinterpret_cast<size_t>(&num_bytes_allocated_)));
if (Runtime::Current()->HasStatsEnabled()) {
RuntimeStats* global_stats = Runtime::Current()->GetStats();
diff --git a/src/mark_stack.h b/src/mark_stack.h
index dada4a551a..224e6d4a78 100644
--- a/src/mark_stack.h
+++ b/src/mark_stack.h
@@ -48,7 +48,7 @@ class MarkStack {
DCHECK(obj != NULL);
DCHECK_NE(ptr_, limit_);
DCHECK_EQ(sizeof(ptr_), sizeof(int32_t));
- int32_t* ptr = reinterpret_cast<int32_t*>(&ptr_);
+ int32_t* ptr = reinterpret_cast<int32_t*>(reinterpret_cast<size_t>(&ptr_));
*reinterpret_cast<const Object**>(android_atomic_add(sizeof(*ptr_), ptr)) = obj;
}