diff options
| -rw-r--r-- | runtime/gc/space/valgrind_malloc_space-inl.h | 24 | ||||
| -rw-r--r-- | runtime/gc/space/valgrind_malloc_space.h | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/runtime/gc/space/valgrind_malloc_space-inl.h b/runtime/gc/space/valgrind_malloc_space-inl.h index 793d7989f1..ae8e892e29 100644 --- a/runtime/gc/space/valgrind_malloc_space-inl.h +++ b/runtime/gc/space/valgrind_malloc_space-inl.h @@ -126,6 +126,30 @@ template <typename S, size_t kValgrindRedZoneBytes, bool kAdjustForRedzoneInAllocSize, bool kUseObjSizeForUsable> +mirror::Object* ValgrindMallocSpace<S, + kValgrindRedZoneBytes, + kAdjustForRedzoneInAllocSize, + kUseObjSizeForUsable>::AllocThreadUnsafe( + Thread* self, size_t num_bytes, size_t* bytes_allocated_out, size_t* usable_size_out) { + size_t bytes_allocated; + size_t usable_size; + void* obj_with_rdz = S::AllocThreadUnsafe(self, num_bytes + 2 * kValgrindRedZoneBytes, + &bytes_allocated, &usable_size); + if (obj_with_rdz == nullptr) { + return nullptr; + } + + return valgrind_details::AdjustForValgrind<kValgrindRedZoneBytes, + kUseObjSizeForUsable>(obj_with_rdz, num_bytes, + bytes_allocated, usable_size, + bytes_allocated_out, + usable_size_out); +} + +template <typename S, + size_t kValgrindRedZoneBytes, + bool kAdjustForRedzoneInAllocSize, + bool kUseObjSizeForUsable> size_t ValgrindMallocSpace<S, kValgrindRedZoneBytes, kAdjustForRedzoneInAllocSize, diff --git a/runtime/gc/space/valgrind_malloc_space.h b/runtime/gc/space/valgrind_malloc_space.h index d102f492c7..707ea69a20 100644 --- a/runtime/gc/space/valgrind_malloc_space.h +++ b/runtime/gc/space/valgrind_malloc_space.h @@ -37,6 +37,9 @@ class ValgrindMallocSpace FINAL : public BaseMallocSpaceType { size_t* usable_size) OVERRIDE; mirror::Object* Alloc(Thread* self, size_t num_bytes, size_t* bytes_allocated, size_t* usable_size) OVERRIDE; + mirror::Object* AllocThreadUnsafe(Thread* self, size_t num_bytes, size_t* bytes_allocated, + size_t* usable_size) OVERRIDE + EXCLUSIVE_LOCKS_REQUIRED(Locks::mutator_lock_); size_t AllocationSize(mirror::Object* obj, size_t* usable_size) OVERRIDE; |