Obtain stack trace outside of critical section
Fixes deadlock if the stack walk does allocations, changed stack
trace format to prevent slowdown.
Added missing GetInterfaceMethodIfProxy to fix a crash in maps.
Bug: 27857910
(cherry picked from commit 23428587d32361736d4c5e0ba7270c7602695a43)
Change-Id: I64373bcd87a68fdd1b58fb855db2b16c9f6ed36b
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index 59fd4a6..6aed61a 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -176,8 +176,10 @@
}
if (kInstrumented) {
if (IsAllocTrackingEnabled()) {
- // Use obj->GetClass() instead of klass, because PushOnAllocationStack() could move klass
- AllocRecordObjectMap::RecordAllocation(self, obj, obj->GetClass(), bytes_allocated);
+ // allocation_records_ is not null since it never becomes null after allocation tracking is
+ // enabled.
+ DCHECK(allocation_records_ != nullptr);
+ allocation_records_->RecordAllocation(self, &obj, bytes_allocated);
}
} else {
DCHECK(!IsAllocTrackingEnabled());