Make jni_internal_test a CommonRuntimeTest.

Also clean up proxy_test and reflection_test.

Test: m test-art-host-gtest
Change-Id: I7530855a40d7b9f7214ea7a069508ae1361b2b42
diff --git a/runtime/Android.bp b/runtime/Android.bp
index a08ba70..2170e95 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -618,6 +618,7 @@
         "jdwp/jdwp_options_test.cc",
         "jit/profiling_info_test.cc",
         "jni/java_vm_ext_test.cc",
+        "jni/jni_internal_test.cc",
         "method_handles_test.cc",
         "mirror/dex_cache_test.cc",
         "mirror/method_type_test.cc",
@@ -629,6 +630,7 @@
         "oat_file_assistant_test.cc",
         "parsed_options_test.cc",
         "prebuilt_tools_test.cc",
+        "proxy_test.cc",
         "reference_table_test.cc",
         "runtime_callbacks_test.cc",
         "subtype_check_info_test.cc",
@@ -656,8 +658,6 @@
         "art_gtest_defaults",
     ],
     srcs: [
-        "jni/jni_internal_test.cc",
-        "proxy_test.cc",
         "reflection_test.cc",
     ],
     shared_libs: [
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index a20baa0..ca410d9 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -385,6 +385,13 @@
   }
 }
 
+void CommonRuntimeTestImpl::MakeInterpreted(ObjPtr<mirror::Class> klass) {
+  PointerSize pointer_size = class_linker_->GetImagePointerSize();
+  for (ArtMethod& method : klass->GetMethods(pointer_size)) {
+    class_linker_->SetEntryPointsToInterpreter(&method);
+  }
+}
+
 bool CommonRuntimeTestImpl::StartDex2OatCommandLine(/*out*/std::vector<std::string>* argv,
                                                     /*out*/std::string* error_msg) {
   DCHECK(argv != nullptr);
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index d7f6127..ab90fc5 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -97,6 +97,9 @@
     return true;
   }
 
+  void MakeInterpreted(ObjPtr<mirror::Class> klass)
+      REQUIRES_SHARED(Locks::mutator_lock_);
+
   static bool StartDex2OatCommandLine(/*out*/std::vector<std::string>* argv,
                                       /*out*/std::string* error_msg);
 
diff --git a/runtime/jni/jni_internal_test.cc b/runtime/jni/jni_internal_test.cc
index 57346b7..a4b3801 100644
--- a/runtime/jni/jni_internal_test.cc
+++ b/runtime/jni/jni_internal_test.cc
@@ -19,7 +19,7 @@
 #include "android-base/stringprintf.h"
 
 #include "art_method-inl.h"
-#include "common_compiler_test.h"
+#include "common_runtime_test.h"
 #include "indirect_reference_table.h"
 #include "java_vm_ext.h"
 #include "jni_env_ext.h"
@@ -31,11 +31,10 @@
 
 using android::base::StringPrintf;
 
-// TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used.
-class JniInternalTest : public CommonCompilerTest {
+class JniInternalTest : public CommonRuntimeTest {
  protected:
   void SetUp() override {
-    CommonCompilerTest::SetUp();
+    CommonRuntimeTest::SetUp();
 
     vm_ = Runtime::Current()->GetJavaVM();
 
@@ -86,7 +85,7 @@
 
   void TearDown() override {
     CleanUpJniEnv();
-    CommonCompilerTest::TearDown();
+    CommonRuntimeTest::TearDown();
   }
 
   jclass GetPrimitiveClass(char descriptor) {
@@ -2265,13 +2264,13 @@
   // Start runtime.
   Thread* self = Thread::Current();
   self->TransitionFromSuspendedToRunnable();
-  MakeExecutable(nullptr, "java.lang.Class");
-  MakeExecutable(nullptr, "java.lang.Object");
-  MakeExecutable(nullptr, "java.nio.DirectByteBuffer");
-  MakeExecutable(nullptr, "java.nio.Bits");
-  MakeExecutable(nullptr, "java.nio.MappedByteBuffer");
-  MakeExecutable(nullptr, "java.nio.ByteBuffer");
-  MakeExecutable(nullptr, "java.nio.Buffer");
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Class;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Object;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/nio/DirectByteBuffer;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/nio/Bits;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/nio/MappedByteBuffer;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/nio/ByteBuffer;"));
+  MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/nio/Buffer;"));
   // TODO: we only load a dex file here as starting the runtime relies upon it.
   const char* class_name = "StaticLeafMethods";
   LoadDex(class_name);
diff --git a/runtime/proxy_test.cc b/runtime/proxy_test.cc
index f1e485b..b78855f 100644
--- a/runtime/proxy_test.cc
+++ b/runtime/proxy_test.cc
@@ -19,7 +19,7 @@
 
 #include "art_field-inl.h"
 #include "base/enums.h"
-#include "common_compiler_test.h"
+#include "common_runtime_test.h"
 #include "mirror/field-inl.h"
 #include "proxy_test.h"
 #include "scoped_thread_state_change-inl.h"
diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc
index 9fab7fb..8a76855 100644
--- a/runtime/reflection_test.cc
+++ b/runtime/reflection_test.cc
@@ -31,7 +31,7 @@
 
 namespace art {
 
-// TODO: Convert to CommonRuntimeTest. Currently MakeExecutable is used.
+// TODO: Convert to CommonRuntimeTest. Currently CompileDirectMethod is used in one test.
 class ReflectionTest : public CommonCompilerTest {
  protected:
   void SetUp() override {
@@ -86,11 +86,11 @@
     return soa.AddLocalReference<jclass>(c);
   }
 
-  void ReflectionTestMakeExecutable(ArtMethod** method,
-                                    ObjPtr<mirror::Object>* receiver,
-                                    bool is_static,
-                                    const char* method_name,
-                                    const char* method_signature)
+  void ReflectionTestMakeInterpreted(ArtMethod** method,
+                                     ObjPtr<mirror::Object>* receiver,
+                                     bool is_static,
+                                     const char* method_name,
+                                     const char* method_signature)
       REQUIRES_SHARED(Locks::mutator_lock_) {
     const char* class_name = is_static ? "StaticLeafMethods" : "NonStaticLeafMethods";
     jobject jclass_loader(LoadDex(class_name));
@@ -100,15 +100,15 @@
         hs.NewHandle(
             ScopedObjectAccessUnchecked(self).Decode<mirror::ClassLoader>(jclass_loader)));
     if (!is_static) {
-      MakeExecutable(nullptr, "java.lang.Class");
-      MakeExecutable(nullptr, "java.lang.Object");
+      MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Class;"));
+      MakeInterpreted(class_linker_->FindSystemClass(self, "Ljava/lang/Object;"));
     }
-    MakeExecutable(class_loader.Get(), class_name);
 
     ObjPtr<mirror::Class> c = class_linker_->FindClass(self,
                                                        DotToDescriptor(class_name).c_str(),
                                                        class_loader);
     CHECK(c != nullptr);
+    MakeInterpreted(c);
 
     *method = c->FindClassMethod(method_name, method_signature, kRuntimePointerSize);
     CHECK(*method != nullptr);
@@ -138,7 +138,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "nop", "()V");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "nop", "()V");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     InvokeWithJValues(soa, receiver_ref.get(), jni::EncodeArtMethod(method), nullptr);
   }
@@ -147,7 +147,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "identity", "(B)B");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(B)B");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[1];
 
@@ -173,7 +173,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "identity", "(I)I");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(I)I");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[1];
 
@@ -198,7 +198,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "identity", "(D)D");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "identity", "(D)D");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[1];
 
@@ -223,7 +223,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(II)I");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(II)I");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[2];
 
@@ -252,7 +252,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(III)I");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(III)I");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[3];
 
@@ -291,7 +291,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(IIII)I");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(IIII)I");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[4];
 
@@ -335,7 +335,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(IIIII)I");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(IIIII)I");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[5];
 
@@ -384,7 +384,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(DD)D");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DD)D");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[2];
 
@@ -418,7 +418,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(DDD)D");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDD)D");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[3];
 
@@ -445,7 +445,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(DDDD)D");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDDD)D");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[4];
 
@@ -475,7 +475,7 @@
     ScopedObjectAccess soa(env_);
     ArtMethod* method;
     ObjPtr<mirror::Object> receiver;
-    ReflectionTestMakeExecutable(&method, &receiver, is_static, "sum", "(DDDDD)D");
+    ReflectionTestMakeInterpreted(&method, &receiver, is_static, "sum", "(DDDDD)D");
     ScopedLocalRef<jobject> receiver_ref(soa.Env(), soa.AddLocalReference<jobject>(receiver));
     jvalue args[5];