Start implementing JNI.

This patch replaces our JniEnvironment class with the regular JNIEnv.

This patch also adds support for .jar, .zip, and .apk files in the
boot classpath.

There's also an attempt at implementing JNIEnv::FindClass.

I've also fixed a few scoped_ptr/scoped_array bugs (this kind of thing
being the reason we use UniquePtr in libcore), and removed some
unnecessary .

The 'tools/art' script makes it easier to play with aexec on the command-line.

Change-Id: Ic4f704c12e0071f17e95b6e182fdab9370ead9b0
diff --git a/src/jni_compiler.cc b/src/jni_compiler.cc
index 436d4d8..b7d8f5d 100644
--- a/src/jni_compiler.cc
+++ b/src/jni_compiler.cc
@@ -134,9 +134,11 @@
       FrameOffset out_off = jni_conv.CurrentParamStackOffset();
       jni_asm->StoreRawPtr(out_off, jni_env_register);
     }
-    // Call JNIEnv*->MonitorEnter(JNIEnv*, object)
-    jni_asm->Call(jni_env_register, JniEnvironment::MonitorEnterOffset(),
+    // Call JNIEnvExt::MonitorEnterHelper(JNIEnv*, object)
+    static Offset monitor_enter(OFFSETOF_MEMBER(JNIEnvExt, MonitorEnterHelper));
+    jni_asm->Call(jni_env_register, monitor_enter,
                   jni_conv.InterproceduralScratchRegister());
+    jni_asm->ExceptionPoll(jni_conv.InterproceduralScratchRegister());
   }
 
   // 8. Iterate over arguments placing values from managed calling convention in
@@ -232,9 +234,11 @@
       FrameOffset out_off = jni_conv.CurrentParamStackOffset();
       jni_asm->StoreRawPtr(out_off, jni_env_register);
     }
-    // Call JNIEnv*->MonitorExit(JNIEnv*, object)
-    jni_asm->Call(jni_env_register, JniEnvironment::MonitorExitOffset(),
+    // Call JNIEnvExt::MonitorExitHelper(JNIEnv*, object)
+    static Offset monitor_exit(OFFSETOF_MEMBER(JNIEnvExt, MonitorExitHelper));
+    jni_asm->Call(jni_env_register, monitor_exit,
                   jni_conv.InterproceduralScratchRegister());
+    jni_asm->ExceptionPoll(jni_conv.InterproceduralScratchRegister());
     // Reload return value
     jni_asm->Load(jni_conv.ReturnRegister(), return_save_location,
                   jni_conv.SizeOfReturnValue());