Improve performance of JNI field operations.
Change improves performance of JniField Fadden test by around 25%, we're still
2x slower than Dalvik.
Aggressively inline ScopedObjectAccess, Thread::SetState and field helpers.
If we're not contention logging don't call MilliTime (avoids a double register
spill).
Remove (broken?) thread checks in scoped object access, they are redundant with
ones being performed in check JNI.
Change-Id: I128eed1e4205d4d540d5c6f430ef9e3853745585
diff --git a/src/thread.cc b/src/thread.cc
index 5b1a325..37c6783 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -41,7 +41,7 @@
#include "mirror/abstract_method-inl.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
-#include "mirror/object-inl.h"
+#include "mirror/field-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/stack_trace_element.h"
#include "monitor.h"
@@ -531,16 +531,6 @@
android_atomic_and(-1 ^ flag, &state_and_flags_.as_int);
}
-ThreadState Thread::SetState(ThreadState new_state) {
- // Cannot use this code to change into Runnable as changing to Runnable should fail if
- // old_state_and_flags.suspend_request is true.
- DCHECK_NE(new_state, kRunnable);
- DCHECK_EQ(this, Thread::Current());
- union StateAndFlags old_state_and_flags = state_and_flags_;
- state_and_flags_.as_struct.state = new_state;
- return static_cast<ThreadState>(old_state_and_flags.as_struct.state);
-}
-
// Attempt to rectify locks so that we dump thread list with required locks before exiting.
static void UnsafeLogFatalForSuspendCount(Thread* self, Thread* thread) NO_THREAD_SAFETY_ANALYSIS {
LOG(ERROR) << *thread << " suspend count already zero.";