Fix signal test to work with gcstress
We now avoid running GC if we are handling a stack overflow, this
helps prevent running past the end of the stack overflow reserved
bytes.
Added logic in ThrowStackOverflowError to use a stack overflow
exception without a stack trace if we fail to allocate the stack
trace.
Bug: 16406852
Change-Id: Ib34e235cd0af6d7c4c93c9705fa822f2b9b23b38
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 26d6117..2575676 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -2106,7 +2106,9 @@
ScopedThreadStateChange tsc(self, kWaitingPerformingGc);
Locks::mutator_lock_->AssertNotHeld(self);
if (self->IsHandlingStackOverflow()) {
- LOG(WARNING) << "Performing GC on a thread that is handling a stack overflow.";
+ // If we are throwing a stack overflow error we probably don't have enough remaining stack
+ // space to run the GC.
+ return collector::kGcTypeNone;
}
bool compacting_gc;
{