summaryrefslogtreecommitdiffstats
path: root/runtime/scoped_thread_state_change.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-02-24 16:53:16 -0800
committerIan Rogers <irogers@google.com>2014-02-24 18:47:23 -0800
commit9837939678bb5dcba178e5fb00ed59b5d14c8d9b (patch)
tree00f0e6b54d7c4cac78a02752e268724157e50b6e /runtime/scoped_thread_state_change.h
parent3fcf18e25241253f23efbeebe77b2a4c4a7c54d3 (diff)
downloadart-9837939678bb5dcba178e5fb00ed59b5d14c8d9b.tar.gz
art-9837939678bb5dcba178e5fb00ed59b5d14c8d9b.tar.bz2
art-9837939678bb5dcba178e5fb00ed59b5d14c8d9b.zip
Avoid std::string allocations for finding an array class.
Introduce ClassLinker::FindArrayClass which performs an array class lookup given the element/component class. This has a 16 element cache of recently looked up arrays. Pass the current thread to ClassLinker Find .. Class routines to avoid calls to Thread::Current(). Avoid some uses of FindClass in the debugger where WellKnownClasses is a faster and more compacting GC friendly alternative. Change-Id: I60e231820b349543a7edb3ceb9cf1ce92db3c843
Diffstat (limited to 'runtime/scoped_thread_state_change.h')
-rw-r--r--runtime/scoped_thread_state_change.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/scoped_thread_state_change.h b/runtime/scoped_thread_state_change.h
index 2f959dbcb7..f0f5ed263d 100644
--- a/runtime/scoped_thread_state_change.h
+++ b/runtime/scoped_thread_state_change.h
@@ -122,6 +122,7 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange {
: ScopedThreadStateChange(ThreadForEnv(env), kRunnable),
env_(down_cast<JNIEnvExt*>(env)), vm_(env_->vm) {
self_->VerifyStack();
+ Locks::mutator_lock_->AssertSharedHeld(self_);
}
explicit ScopedObjectAccessUnchecked(Thread* self)
@@ -130,6 +131,7 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange {
env_(down_cast<JNIEnvExt*>(self->GetJniEnv())),
vm_(env_ != NULL ? env_->vm : NULL) {
self_->VerifyStack();
+ Locks::mutator_lock_->AssertSharedHeld(self_);
}
// Used when we want a scoped JNI thread state but have no thread/JNIEnv. Consequently doesn't
@@ -139,6 +141,7 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange {
// Here purely to force inlining.
~ScopedObjectAccessUnchecked() ALWAYS_INLINE {
+ Locks::mutator_lock_->AssertSharedHeld(self_);
}
JNIEnvExt* Env() const {
@@ -250,14 +253,12 @@ class ScopedObjectAccess : public ScopedObjectAccessUnchecked {
LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_) ALWAYS_INLINE
: ScopedObjectAccessUnchecked(env) {
- Locks::mutator_lock_->AssertSharedHeld(Self());
}
explicit ScopedObjectAccess(Thread* self)
LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_)
: ScopedObjectAccessUnchecked(self) {
- Locks::mutator_lock_->AssertSharedHeld(Self());
}
~ScopedObjectAccess() UNLOCK_FUNCTION(Locks::mutator_lock_) ALWAYS_INLINE {