Use local references for native method args.

This changes the JNI method call mechanism to register all reference
arguments as local refs, as well as the "this" argument (for virtual
calls) and the class object (for static calls).

Before now we skipped this part, because we're handing raw object
pointers around, and we know that all of the arguments can be found by
the GC on the interpreted stack.  In fact, there's no need to add the
arguments for GC-correctness; rather, we need to do this to rewrite the
pointers we hand to native code.

This change impacts JNI method call performance, especially for functions
with a large number of reference arguments.  To improve things a little,
there are now four "call bridge" functions:

  (1) general handler
  (2) synchronized method handler (grabs lock, calls #1)
  (3) virtual method, no reference args
  (4) static method, no reference args

While booting the system, the virtual/static no-ref handlers are used
for about 70% of calls.  Since these don't have to scan the method
signature to look for reference arguments, they're a bit faster.

At this point we're still passing raw pointers around, so nothing should
really change.
diff --git a/vm/Thread.h b/vm/Thread.h
index 45018b4..1725b1e 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /*
  * VM thread support.
  */
@@ -22,7 +23,7 @@
 #include "jni.h"
 
 #if defined(CHECK_MUTEX) && !defined(__USE_UNIX98)
-/* Linux lacks this unless you #define __USE_UNIX98 */
+/* glibc lacks this unless you #define __USE_UNIX98 */
 int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
 enum { PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP };
 #endif
@@ -151,7 +152,6 @@
     ReferenceTable  internalLocalRefTable;
 
     /* JNI local reference tracking */
-    // TODO: move this to JNIEnvExt to avoid an indirection?
     ReferenceTable  jniLocalRefTable;
 
     /* JNI native monitor reference tracking (initialized on first use) */