Simplify the default stack size handling.
The extra 16KB was just silly. We only need a notion of "default stack size"
if there's an explicit command-line override.
Change-Id: Ia63e00047a420546656ac8d2dad46789994157a3
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index 99f9fee..b481b57 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -146,12 +146,10 @@
if (Runtime::Current()->IsMethodTracingActive()) {
TraceMethodUnwindFromCode(thread);
}
- thread->SetStackEndForStackOverflow(); // Allow space on the stack for constructor to execute
- thread->ThrowNewExceptionF("Ljava/lang/StackOverflowError;",
- "stack size %zdkb; default stack size: %zdkb",
- thread->GetStackSize() / KB,
- Runtime::Current()->GetDefaultStackSize() / KB);
- thread->ResetDefaultStackEnd(); // Return to default stack size
+ thread->SetStackEndForStackOverflow(); // Allow space on the stack for constructor to execute.
+ thread->ThrowNewExceptionF("Ljava/lang/StackOverflowError;", "stack size %s",
+ PrettySize(thread->GetStackSize()).c_str());
+ thread->ResetDefaultStackEnd(); // Return to default stack size.
}
void art_throw_exception_from_code(Object* exception) {
diff --git a/src/oat/runtime/support_throw.cc b/src/oat/runtime/support_throw.cc
index 4d4890d..4293228 100644
--- a/src/oat/runtime/support_throw.cc
+++ b/src/oat/runtime/support_throw.cc
@@ -75,15 +75,14 @@
extern "C" void artThrowStackOverflowFromCode(Thread* thread, Method** sp) {
FinishCalleeSaveFrameSetup(thread, sp, Runtime::kSaveAll);
- // Remove extra entry pushed onto second stack during method tracing
+ // Remove extra entry pushed onto second stack during method tracing.
if (Runtime::Current()->IsMethodTracingActive()) {
TraceMethodUnwindFromCode(thread);
}
- thread->SetStackEndForStackOverflow(); // Allow space on the stack for constructor to execute
- thread->ThrowNewExceptionF("Ljava/lang/StackOverflowError;",
- "stack size %zdkb; default stack size: %zdkb",
- thread->GetStackSize() / KB, Runtime::Current()->GetDefaultStackSize() / KB);
- thread->ResetDefaultStackEnd(); // Return to default stack size
+ thread->SetStackEndForStackOverflow(); // Allow space on the stack for constructor to execute.
+ thread->ThrowNewExceptionF("Ljava/lang/StackOverflowError;", "stack size %s",
+ PrettySize(thread->GetStackSize()).c_str());
+ thread->ResetDefaultStackEnd(); // Return to default stack size.
thread->DeliverException();
}
diff --git a/src/runtime.cc b/src/runtime.cc
index 74f6652..fdbd70a 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -56,7 +56,7 @@
Runtime::Runtime()
: is_compiler_(false),
is_zygote_(false),
- default_stack_size_(Thread::kDefaultStackSize),
+ default_stack_size_(0),
heap_(NULL),
monitor_list_(NULL),
thread_list_(NULL),
@@ -312,8 +312,8 @@
parsed->heap_initial_size_ = Heap::kInitialSize;
parsed->heap_maximum_size_ = Heap::kMaximumSize;
- parsed->heap_growth_limit_ = 0; // 0 means no growth limit
- parsed->stack_size_ = Thread::kDefaultStackSize;
+ parsed->heap_growth_limit_ = 0; // 0 means no growth limit.
+ parsed->stack_size_ = 0; // 0 means default.
parsed->is_compiler_ = false;
parsed->is_zygote_ = false;
diff --git a/src/thread.cc b/src/thread.cc
index 8ef784f..a87e550 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -152,7 +152,6 @@
// so include that here to support apps that expect large native stacks.
stack_size += 1 * MB;
-
// It's not possible to request a stack smaller than the system-defined PTHREAD_STACK_MIN.
if (stack_size < PTHREAD_STACK_MIN) {
stack_size = PTHREAD_STACK_MIN;
diff --git a/src/thread.h b/src/thread.h
index f621d60..310f629 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -93,8 +93,6 @@
static const size_t kStackOverflowReservedBytes = 8 * KB;
#endif
- static const size_t kDefaultStackSize = 16 * KB;
-
class StackVisitor {
public:
virtual ~StackVisitor() {}
diff --git a/src/thread_list.cc b/src/thread_list.cc
index a1e9d2f..0ec9bdd 100644
--- a/src/thread_list.cc
+++ b/src/thread_list.cc
@@ -35,7 +35,6 @@
thread_exit_cond_("thread exit condition variable"),
thread_suspend_count_lock_("thread suspend count lock", kThreadSuspendCountLock),
thread_suspend_count_cond_("thread suspend count condition variable") {
- VLOG(threads) << "Default stack size: " << PrettySize(Runtime::Current()->GetDefaultStackSize());
}
ThreadList::~ThreadList() {