summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2019-03-19 09:30:35 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2019-03-19 12:33:11 +0000
commitebb481d070e3fdbb7950580e6f6886c3231a1ad9 (patch)
treeaf6986daab73dcd17dca5f4bab68024c12c40c83
parenta1e5b97b4bb4c47c2ab51d8a7d5dd1500d496c4d (diff)
Revert "Change state to waiting during aborting the VM"
This reverts commit 97b964960123d5f215a1cebbce548c8a5322c307. Bug: 127875380 Reason for revert: Broke Dex2oatWatchdogTest.TestWatchdogTrigger on host x86_64 and heap poisoning. Change-Id: Iaebfc4a03543bff4e7239d711dd7ad8c7f880d52
-rw-r--r--openjdkjvmti/ti_monitor.cc1
-rw-r--r--openjdkjvmti/ti_thread.cc2
-rw-r--r--runtime/debugger.cc1
-rw-r--r--runtime/native/java_lang_Thread.cc1
-rw-r--r--runtime/runtime.cc9
-rw-r--r--runtime/thread_state.h1
6 files changed, 3 insertions, 12 deletions
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 2ca5057f85..aac7233303 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -403,7 +403,6 @@ jvmtiError MonitorUtil::GetCurrentContendedMonitor(jvmtiEnv* env ATTRIBUTE_UNUSE
case art::kWaitingForGetObjectsAllocated:
case art::kWaitingWeakGcRootRead:
case art::kWaitingForGcThreadFlip:
- case art::kNativeForAbort:
case art::kStarting:
case art::kNative:
case art::kSuspended: {
diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc
index 01cc8c7699..c6798bb1c9 100644
--- a/openjdkjvmti/ti_thread.cc
+++ b/openjdkjvmti/ti_thread.cc
@@ -453,7 +453,6 @@ static jint GetJvmtiThreadStateFromInternal(const InternalThreadState& state) {
case art::ThreadState::kWaitingForVisitObjects:
case art::ThreadState::kWaitingForGetObjectsAllocated:
case art::ThreadState::kWaitingForGcThreadFlip:
- case art::ThreadState::kNativeForAbort:
// All of these are causing the thread to wait for an indeterminate amount of time but isn't
// caused by sleep, park, or object#wait.
jvmti_state |= (JVMTI_THREAD_STATE_WAITING |
@@ -509,7 +508,6 @@ static jint GetJavaStateFromInternal(const InternalThreadState& state) {
case art::ThreadState::kWaitingForMethodTracingStart:
case art::ThreadState::kWaitingForVisitObjects:
case art::ThreadState::kWaitingForGcThreadFlip:
- case art::ThreadState::kNativeForAbort:
return JVMTI_JAVA_LANG_THREAD_STATE_WAITING;
}
LOG(FATAL) << "Unreachable";
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index d3a3eeae49..663af814cd 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -2261,7 +2261,6 @@ JDWP::JdwpThreadStatus Dbg::ToJdwpThreadStatus(ThreadState state) {
case kWaitingPerformingGc:
case kWaitingWeakGcRootRead:
case kWaitingForGcThreadFlip:
- case kNativeForAbort:
case kWaiting:
return JDWP::TS_WAIT;
// Don't add a 'default' here so the compiler can spot incompatible enum changes.
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 37b3fe642e..67ad0a47b8 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -104,7 +104,6 @@ static jint Thread_nativeGetStatus(JNIEnv* env, jobject java_thread, jboolean ha
case kWaitingForVisitObjects: return kJavaWaiting;
case kWaitingWeakGcRootRead: return kJavaRunnable;
case kWaitingForGcThreadFlip: return kJavaWaiting;
- case kNativeForAbort: return kJavaWaiting;
case kSuspended: return kJavaRunnable;
// Don't add a 'default' here so the compiler can spot incompatible enum changes.
}
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 3e8b7c84a7..33ec088e30 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -584,12 +584,9 @@ void Runtime::Abort(const char* msg) {
#endif
}
- {
- // Ensure that we don't have multiple threads trying to abort at once,
- // which would result in significantly worse diagnostics.
- ScopedThreadStateChange tsc(Thread::Current(), kNativeForAbort);
- Locks::abort_lock_->ExclusiveLock(Thread::Current());
- }
+ // Ensure that we don't have multiple threads trying to abort at once,
+ // which would result in significantly worse diagnostics.
+ MutexLock mu(Thread::Current(), *Locks::abort_lock_);
// Get any pending output out of the way.
fflush(nullptr);
diff --git a/runtime/thread_state.h b/runtime/thread_state.h
index c8f382693e..e57a040cb1 100644
--- a/runtime/thread_state.h
+++ b/runtime/thread_state.h
@@ -47,7 +47,6 @@ enum ThreadState {
kWaitingForGetObjectsAllocated, // WAITING TS_WAIT waiting for getting the number of allocated objects
kWaitingWeakGcRootRead, // WAITING TS_WAIT waiting on the GC to read a weak root
kWaitingForGcThreadFlip, // WAITING TS_WAIT waiting on the GC thread flip (CC collector) to finish
- kNativeForAbort, // WAITING TS_WAIT checking other threads are not run on abort.
kStarting, // NEW TS_WAIT native thread started, not yet ready to run managed code
kNative, // RUNNABLE TS_RUNNING running in a JNI native method
kSuspended, // RUNNABLE TS_RUNNING suspended by GC or debugger