Revert "Implement rosalloc fast path in assembly for 32 bit arm."
Tentative. Looks like heap poisoning breaks with this change.
bug: 9986565
This reverts commit e6316940db61faead36f9642cce137d41fc8f606.
Change-Id: I5c63758221464fe319315f40ae79c656048faed0
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index 3ce3d63..87f1392 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -131,7 +131,6 @@
private:
Slot* next_; // Next slot in the list.
- friend class RosAlloc;
};
// We use the tail (kUseTail == true) for the bulk or thread-local free lists to avoid the need to
@@ -303,7 +302,6 @@
// free without traversing the whole free list.
uint32_t size_;
uint32_t padding_ ATTRIBUTE_UNUSED;
- friend class RosAlloc;
};
// Represents a run of memory slots of the same size.
@@ -484,7 +482,7 @@
static constexpr uint8_t kMagicNumFree = 43;
// The number of size brackets. Sync this with the length of Thread::rosalloc_runs_.
static constexpr size_t kNumOfSizeBrackets = kNumRosAllocThreadLocalSizeBrackets;
- // The number of smaller size brackets that are the quantum size apart.
+ // The number of smaller size brackets that are 16 bytes apart.
static constexpr size_t kNumOfQuantumSizeBrackets = 32;
// The sizes (the slot sizes, in bytes) of the size brackets.
static size_t bracketSizes[kNumOfSizeBrackets];
@@ -522,7 +520,9 @@
}
// Returns true if the given allocation size is for a thread local allocation.
static bool IsSizeForThreadLocal(size_t size) {
- bool is_size_for_thread_local = size <= kMaxThreadLocalBracketSize;
+ DCHECK_GT(kNumThreadLocalSizeBrackets, 0U);
+ size_t max_thread_local_bracket_idx = kNumThreadLocalSizeBrackets - 1;
+ bool is_size_for_thread_local = size <= bracketSizes[max_thread_local_bracket_idx];
DCHECK(size > kLargeSizeThreshold ||
(is_size_for_thread_local == (SizeToIndex(size) < kNumThreadLocalSizeBrackets)));
return is_size_for_thread_local;
@@ -634,16 +634,6 @@
// are less than this index. We use shared (current) runs for the rest.
static const size_t kNumThreadLocalSizeBrackets = 8;
- // The size of the largest bracket we use thread-local runs for.
- // This should be equal to bracketSizes[kNumThreadLocalSizeBrackets - 1].
- static const size_t kMaxThreadLocalBracketSize = 128;
-
- // The bracket size increment for the brackets of size <= 512 bytes.
- static constexpr size_t kBracketQuantumSize = 16;
-
- // Equal to Log2(kQuantumBracketSizeIncrement).
- static constexpr size_t kBracketQuantumSizeShift = 4;
-
private:
// The base address of the memory region that's managed by this allocator.
uint8_t* base_;
@@ -780,19 +770,6 @@
size_t page_release_size_threshold = kDefaultPageReleaseSizeThreshold);
~RosAlloc();
- static size_t RunFreeListOffset() {
- return OFFSETOF_MEMBER(Run, free_list_);
- }
- static size_t RunFreeListHeadOffset() {
- return OFFSETOF_MEMBER(SlotFreeList<false>, head_);
- }
- static size_t RunFreeListSizeOffset() {
- return OFFSETOF_MEMBER(SlotFreeList<false>, size_);
- }
- static size_t RunSlotNextOffset() {
- return OFFSETOF_MEMBER(Slot, next_);
- }
-
// If kThreadUnsafe is true then the allocator may avoid acquiring some locks as an optimization.
// If used, this may cause race conditions if multiple threads are allocating at the same time.
template<bool kThreadSafe = true>