Fix and reenable lock dumping in stack dumps.
This patch adds a flag to tell the method verifier not to load
classes when resolving types, so that when we ask the method verifier
to find monitor-enter instructions for stack dumping it doesn't try
to allocate (since the most common cause of stack dumping is SIGQUIT).
We believe that all the classes we care about will be loaded already
anyway, since we're only interested in _held_ locks, and you can only
hold a lock if you've executed the code that leads to the monitor-enter,
and you can't execute the code without loading the relevant classes.
Any not-yet-loaded classes shouldn't be relevant for our purposes.
Also clarify the stack dumps when a thread is starting up; although
strictly speaking a thread might be in the kNative state, it's more
helpful if we also explicitly say that it's still starting up.
Also a few GC log output fixes.
Change-Id: Ibf8519e9bde27838c511eafa5c13734c5bebeab6
diff --git a/src/thread.cc b/src/thread.cc
index 484806e..439e8f6 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -773,7 +773,11 @@
}
os << " prio=" << priority
<< " tid=" << thread->GetThinLockId()
- << " " << thread->GetState() << "\n";
+ << " " << thread->GetState();
+ if (thread->IsStillStarting()) {
+ os << " (still starting up)";
+ }
+ os << "\n";
} else {
os << '"' << ::art::GetThreadName(tid) << '"'
<< " prio=" << priority
@@ -996,12 +1000,12 @@
bool Thread::IsStillStarting() const {
// You might think you can check whether the state is kStarting, but for much of thread startup,
- // the thread might also be in kVmWait.
+ // the thread is in kNative; it might also be in kVmWait.
// You might think you can check whether the peer is NULL, but the peer is actually created and
// assigned fairly early on, and needs to be.
// It turns out that the last thing to change is the thread name; that's a good proxy for "has
// this thread _ever_ entered kRunnable".
- return (*name_ == kThreadNameDuringStartup);
+ return (jpeer_ == NULL && opeer_ == NULL) || (*name_ == kThreadNameDuringStartup);
}
void Thread::AssertNoPendingException() const {