summaryrefslogtreecommitdiffstats
path: root/runtime/common_test.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/common_test.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/common_test.h')
-rw-r--r--runtime/common_test.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/common_test.h b/runtime/common_test.h
index 7f9b6b192b..215b6428bb 100644
--- a/runtime/common_test.h
+++ b/runtime/common_test.h
@@ -418,8 +418,9 @@ class CommonTest : public testing::Test {
void MakeExecutable(mirror::ClassLoader* class_loader, const char* class_name)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string class_descriptor(DotToDescriptor(class_name));
- SirtRef<mirror::ClassLoader> loader(Thread::Current(), class_loader);
- mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), loader);
+ Thread* self = Thread::Current();
+ SirtRef<mirror::ClassLoader> loader(self, class_loader);
+ mirror::Class* klass = class_linker_->FindClass(self, class_descriptor.c_str(), loader);
CHECK(klass != NULL) << "Class not found " << class_name;
for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
MakeExecutable(klass->GetDirectMethod(i));
@@ -632,8 +633,9 @@ class CommonTest : public testing::Test {
void CompileClass(mirror::ClassLoader* class_loader, const char* class_name)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string class_descriptor(DotToDescriptor(class_name));
- SirtRef<mirror::ClassLoader> loader(Thread::Current(), class_loader);
- mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), loader);
+ Thread* self = Thread::Current();
+ SirtRef<mirror::ClassLoader> loader(self, class_loader);
+ mirror::Class* klass = class_linker_->FindClass(self, class_descriptor.c_str(), loader);
CHECK(klass != NULL) << "Class not found " << class_name;
for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
CompileMethod(klass->GetDirectMethod(i));
@@ -656,7 +658,8 @@ class CommonTest : public testing::Test {
const char* method_name, const char* signature)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string class_descriptor(DotToDescriptor(class_name));
- mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), class_loader);
+ Thread* self = Thread::Current();
+ mirror::Class* klass = class_linker_->FindClass(self, class_descriptor.c_str(), class_loader);
CHECK(klass != NULL) << "Class not found " << class_name;
mirror::ArtMethod* method = klass->FindDirectMethod(method_name, signature);
CHECK(method != NULL) << "Direct method not found: "
@@ -668,7 +671,8 @@ class CommonTest : public testing::Test {
const char* method_name, const char* signature)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string class_descriptor(DotToDescriptor(class_name));
- mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), class_loader);
+ Thread* self = Thread::Current();
+ mirror::Class* klass = class_linker_->FindClass(self, class_descriptor.c_str(), class_loader);
CHECK(klass != NULL) << "Class not found " << class_name;
mirror::ArtMethod* method = klass->FindVirtualMethod(method_name, signature);
CHECK(method != NULL) << "Virtual method not found: "