Upgrade to latest dlmalloc. Refactor Heap and related APIs to use STL like naming.
We fail assertions in the existing heap code, as does Dalvik. This refactoring
is to clean the heap and space APIs and to reduce duplication of data
and thereby solve a failing assertion in the card table.
This change also wires up clearing of soft references including before
out-of-memory errors are reported.
In doing this change it was made clear that mspaces are buggy (and
violating invariants with the garbage collector). This
change upgrades to an un-Android molested version of dlmalloc-2.8.5 and
implements a version of the mspace morecore routine under ART control.
run-test 061-out-of-memory is updated for current heap sizes.
Change-Id: I377e83ab2a8c78afb9b1881f03356929e2c9dc64
diff --git a/src/thread.h b/src/thread.h
index 856fd5c..d612f62 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -419,26 +419,26 @@
// Size of stack less any space reserved for stack overflow
size_t GetStackSize() {
- return stack_size_ - (stack_end_ - stack_base_);
+ return stack_size_ - (stack_end_ - stack_begin_);
}
// Set the stack end to that to be used during a stack overflow
void SetStackEndForStackOverflow() {
// During stack overflow we allow use of the full stack
- if (stack_end_ == stack_base_) {
+ if (stack_end_ == stack_begin_) {
DumpStack(std::cerr);
LOG(FATAL) << "Need to increase kStackOverflowReservedBytes (currently "
<< kStackOverflowReservedBytes << ")";
}
- stack_end_ = stack_base_;
+ stack_end_ = stack_begin_;
}
// Set the stack end to that to be used during regular execution
void ResetDefaultStackEnd() {
// Our stacks grow down, so we want stack_end_ to be near there, but reserving enough room
// to throw a StackOverflowError.
- stack_end_ = stack_base_ + kStackOverflowReservedBytes;
+ stack_end_ = stack_begin_ + kStackOverflowReservedBytes;
}
static ThreadOffset StackEndOffset() {
@@ -578,7 +578,7 @@
size_t stack_size_;
// The "lowest addressable byte" of the stack
- byte* stack_base_;
+ byte* stack_begin_;
// A linked list (of stack allocated records) recording transitions from
// native to managed code.