Revert "Prevent overflows for concurrent_start_bytes_ sum"
This reverts commit 50b04451431c648a36d2b0f84d728c1ecaf8b71b.
Reason for revert: Broke tests (debug-gc, gss, ss).
Bug: 123772350
Change-Id: I3c7948b966f7e051e26b470cda5f6e5cb387ff54
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 8b67184..d72003c 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -4022,8 +4022,7 @@
+ old_native_bytes / kOldNativeDiscountFactor;
size_t add_bytes_allowed = static_cast<size_t>(
NativeAllocationGcWatermark() * HeapGrowthMultiplier());
- size_t adj_start_bytes = UnsignedSum(concurrent_start_bytes_,
- add_bytes_allowed / kNewNativeDiscountFactor);
+ size_t adj_start_bytes = concurrent_start_bytes_ + add_bytes_allowed / kNewNativeDiscountFactor;
return static_cast<float>(GetBytesAllocated() + weighted_native_bytes)
/ static_cast<float>(adj_start_bytes);
}
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 1aefad5..6bdba12 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -917,13 +917,9 @@
return main_space_backup_ != nullptr;
}
- // Size_t saturating arithmetic
static ALWAYS_INLINE size_t UnsignedDifference(size_t x, size_t y) {
return x > y ? x - y : 0;
}
- static ALWAYS_INLINE size_t UnsignedSum(size_t x, size_t y) {
- return x + y > x ? x + y : std::numeric_limits<size_t>::max();
- }
static ALWAYS_INLINE bool AllocatorHasAllocationStack(AllocatorType allocator_type) {
return