summaryrefslogtreecommitdiff
path: root/src/compiler_test.cc
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2011-10-04 14:58:28 -0700
committer Brian Carlstrom <bdc@google.com> 2011-10-07 11:59:20 -0700
commit3320cf46afd082398aa401b246e6f301cebdf64d (patch)
tree99ef2b240ad81fa7cafa0bca51ca2364120fa762 /src/compiler_test.cc
parent4f0d07c783afef89703dce32c94440fc8621a29b (diff)
Move rest of code related blobs from Method to oat
Change-Id: I55041b564ab65317c8b1f863005f20ba650a0322
Diffstat (limited to 'src/compiler_test.cc')
-rw-r--r--src/compiler_test.cc49
1 files changed, 5 insertions, 44 deletions
diff --git a/src/compiler_test.cc b/src/compiler_test.cc
index e951ade08b..f261406662 100644
--- a/src/compiler_test.cc
+++ b/src/compiler_test.cc
@@ -18,34 +18,6 @@ namespace art {
class CompilerTest : public CommonTest {
protected:
- void AssertStaticIntMethod(jint expected, const ClassLoader* class_loader,
- const char* class_name, const char* method, const char* signature,
- ...) {
- EnsureCompiled(class_loader, class_name, method, signature, false);
-#if defined(__arm__)
- va_list args;
- va_start(args, signature);
- jint result = env_->CallStaticIntMethodV(class_, mid_, args);
- va_end(args);
- LOG(INFO) << class_name << "." << method << "(...) result is " << result;
- EXPECT_EQ(expected, result);
-#endif // __arm__
- }
-
- void AssertStaticLongMethod(jlong expected, const ClassLoader* class_loader,
- const char* class_name, const char* method, const char* signature,
- ...) {
- EnsureCompiled(class_loader, class_name, method, signature, false);
-#if defined(__arm__)
- va_list args;
- va_start(args, signature);
- jlong result = env_->CallStaticLongMethodV(class_, mid_, args);
- va_end(args);
- LOG(INFO) << class_name << "." << method << "(...) result is " << result;
- EXPECT_EQ(expected, result);
-#endif // __arm__
- }
-
void CompileAll(const ClassLoader* class_loader) {
compiler_->CompileAll(class_loader);
MakeAllExecutable(class_loader);
@@ -83,27 +55,14 @@ class CompilerTest : public CommonTest {
Class* c = class_linker->FindClass(descriptor, class_loader);
CHECK(c != NULL);
for (size_t i = 0; i < c->NumDirectMethods(); i++) {
- MakeMethodExecutable(c->GetDirectMethod(i));
+ MakeExecutable(c->GetDirectMethod(i));
}
for (size_t i = 0; i < c->NumVirtualMethods(); i++) {
- MakeMethodExecutable(c->GetVirtualMethod(i));
+ MakeExecutable(c->GetVirtualMethod(i));
}
}
}
- void MakeMethodExecutable(Method* m) {
- if (m->GetCodeArray() != NULL) {
- MakeExecutable(m->GetCodeArray());
- } else {
- LOG(WARNING) << "no code for " << PrettyMethod(m);
- }
- if (m->GetInvokeStubArray() != NULL) {
- MakeExecutable(m->GetInvokeStubArray());
- } else {
- LOG(WARNING) << "no invoke stub for " << PrettyMethod(m);
- }
- }
-
JNIEnv* env_;
jclass class_;
jmethodID mid_;
@@ -165,6 +124,8 @@ TEST_F(CompilerTest, DISABLED_LARGE_CompileDexLibCore) {
}
TEST_F(CompilerTest, AbstractMethodErrorStub) {
+ CompileDirectMethod(NULL, "java.lang.Object", "<init>", "()V");
+
const ClassLoader* class_loader = LoadDex("AbstractMethod");
ASSERT_TRUE(class_loader != NULL);
EnsureCompiled(class_loader, "AbstractClass", "foo", "()V", true);
@@ -177,7 +138,7 @@ TEST_F(CompilerTest, AbstractMethodErrorStub) {
#if defined(__arm__)
Class* jlame = class_linker_->FindClass("Ljava/lang/AbstractMethodError;", class_loader);
- // Force non-virtal call to AbstractClass foo, will throw AbstractMethodError exception.
+ // Force non-virtual call to AbstractClass foo, will throw AbstractMethodError exception.
env_->CallNonvirtualVoidMethod(jobj_, class_, mid_);
EXPECT_TRUE(Thread::Current()->IsExceptionPending());
EXPECT_TRUE(Thread::Current()->GetException()->InstanceOf(jlame));