OSDN Git Service

* gcc_release: Add /usr/local/bin to path when local.
[pf3gnuchains/gcc-fork.git] / libjava / jni.cc
index d4040b2..dbe1d1f 100644 (file)
@@ -1,6 +1,6 @@
 // jni.cc - JNI implementation, including the jump table.
 
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -37,22 +37,19 @@ details.  */
 #include <java/lang/reflect/Method.h>
 #include <java/lang/reflect/Modifier.h>
 #include <java/lang/OutOfMemoryError.h>
-#include <java/util/Hashtable.h>
+#include <java/util/IdentityHashMap.h>
 #include <java/lang/Integer.h>
-#include <gnu/gcj/jni/NativeThread.h>
+#include <java/lang/ThreadGroup.h>
+#include <java/lang/Thread.h>
+#include <gnu/gcj/runtime/JNIWeakRef.h>
 
 #include <gcj/method.h>
 #include <gcj/field.h>
 
 #include <java-interp.h>
+#include <java-threads.h>
 
-// FIXME: remove these defines.
-#define ClassClass java::lang::Class::class$
-#define ObjectClass java::lang::Object::class$
-#define ThrowableClass java::lang::Throwable::class$
-#define MethodClass java::lang::reflect::Method::class$
-#define ThreadGroupClass java::lang::ThreadGroup::class$
-#define NativeThreadClass gnu::gcj::jni::NativeThread::class$
+using namespace gcj;
 
 // This enum is used to select different template instantiations in
 // the invocation code.
@@ -96,8 +93,10 @@ struct _Jv_JNI_LocalFrame
   jobject vec[0];
 };
 
-// This holds a reference count for all local and global references.
-static java::util::Hashtable *ref_table;
+// This holds a reference count for all local references.
+static java::util::IdentityHashMap *local_ref_table;
+// This holds a reference count for all global references.
+static java::util::IdentityHashMap *global_ref_table;
 
 // The only VM.
 static JavaVM *the_vm;
@@ -114,19 +113,19 @@ jvmpiEnableEvent (jint event_type, void *)
     case JVMPI_EVENT_OBJECT_ALLOC:
       _Jv_JVMPI_Notify_OBJECT_ALLOC = _Jv_JVMPI_Interface.NotifyEvent;
       break;
-      
+
     case JVMPI_EVENT_THREAD_START:
       _Jv_JVMPI_Notify_THREAD_START = _Jv_JVMPI_Interface.NotifyEvent;
       break;
-      
+
     case JVMPI_EVENT_THREAD_END:
       _Jv_JVMPI_Notify_THREAD_END = _Jv_JVMPI_Interface.NotifyEvent;
       break;
-      
+
     default:
       return JVMPI_NOT_AVAILABLE;
     }
-  
+
   return JVMPI_SUCCESS;
 }
 
@@ -138,11 +137,11 @@ jvmpiDisableEvent (jint event_type, void *)
     case JVMPI_EVENT_OBJECT_ALLOC:
       _Jv_JVMPI_Notify_OBJECT_ALLOC = NULL;
       break;
-      
+
     default:
       return JVMPI_NOT_AVAILABLE;
     }
-  
+
   return JVMPI_SUCCESS;
 }
 #endif
@@ -152,8 +151,9 @@ jvmpiDisableEvent (jint event_type, void *)
 void
 _Jv_JNI_Init (void)
 {
-  ref_table = new java::util::Hashtable;
-  
+  local_ref_table = new java::util::IdentityHashMap;
+  global_ref_table = new java::util::IdentityHashMap;
+
 #ifdef ENABLE_JVMPI
   _Jv_JVMPI_Interface.version = 1;
   _Jv_JVMPI_Interface.EnableEvent = &jvmpiEnableEvent;
@@ -166,7 +166,7 @@ _Jv_JNI_Init (void)
 
 // Tell the GC that a certain pointer is live.
 static void
-mark_for_gc (jobject obj)
+mark_for_gc (jobject obj, java::util::IdentityHashMap *ref_table)
 {
   JvSynchronize sync (ref_table);
 
@@ -179,7 +179,7 @@ mark_for_gc (jobject obj)
 
 // Unmark a pointer.
 static void
-unmark_for_gc (jobject obj)
+unmark_for_gc (jobject obj, java::util::IdentityHashMap *ref_table)
 {
   JvSynchronize sync (ref_table);
 
@@ -187,6 +187,7 @@ unmark_for_gc (jobject obj)
   Integer *refcount = (Integer *) ref_table->get (obj);
   JvAssert (refcount);
   jint val = refcount->intValue () - 1;
+  JvAssert (val >= 0);
   if (val == 0)
     ref_table->remove (obj);
   else
@@ -194,19 +195,46 @@ unmark_for_gc (jobject obj)
     ref_table->put (obj, new Integer (val));
 }
 
+// "Unwrap" some random non-reference type.  This exists to simplify
+// other template functions.
+template<typename T>
+static T
+unwrap (T val)
+{
+  return val;
+}
+
+// Unwrap a weak reference, if required.
+template<typename T>
+static T *
+unwrap (T *obj)
+{
+  using namespace gnu::gcj::runtime;
+  // We can compare the class directly because JNIWeakRef is `final'.
+  // Doing it this way is much faster.
+  if (obj == NULL || obj->getClass () != &JNIWeakRef::class$)
+    return obj;
+  JNIWeakRef *wr = reinterpret_cast<JNIWeakRef *> (obj);
+  return reinterpret_cast<T *> (wr->get ());
+}
+
 \f
 
 static jobject
 _Jv_JNI_NewGlobalRef (JNIEnv *, jobject obj)
 {
-  mark_for_gc (obj);
+  // This seems weird but I think it is correct.
+  obj = unwrap (obj);
+  mark_for_gc (obj, global_ref_table);
   return obj;
 }
 
 static void
 _Jv_JNI_DeleteGlobalRef (JNIEnv *, jobject obj)
 {
-  unmark_for_gc (obj);
+  // This seems weird but I think it is correct.
+  obj = unwrap (obj);
+  unmark_for_gc (obj, global_ref_table);
 }
 
 static void
@@ -214,14 +242,17 @@ _Jv_JNI_DeleteLocalRef (JNIEnv *env, jobject obj)
 {
   _Jv_JNI_LocalFrame *frame;
 
+  // This seems weird but I think it is correct.
+  obj = unwrap (obj);
+
   for (frame = env->locals; frame != NULL; frame = frame->next)
     {
-      for (int i = 0; i < FRAME_SIZE; ++i)
+      for (int i = 0; i < frame->size; ++i)
        {
          if (frame->vec[i] == obj)
            {
              frame->vec[i] = NULL;
-             unmark_for_gc (obj);
+             unmark_for_gc (obj, local_ref_table);
              return;
            }
        }
@@ -277,19 +308,29 @@ _Jv_JNI_PushLocalFrame (JNIEnv *env, jint size)
 static jobject
 _Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj)
 {
+  // This seems weird but I think it is correct.
+  obj = unwrap (obj);
+
   // Try to find an open slot somewhere in the topmost frame.
   _Jv_JNI_LocalFrame *frame = env->locals;
   bool done = false, set = false;
-  while (frame != NULL && ! done)
+  for (; frame != NULL && ! done; frame = frame->next)
     {
       for (int i = 0; i < frame->size; ++i)
-       if (frame->vec[i] == NULL)
-         {
-           set = true;
-           done = true;
-           frame->vec[i] = obj;
-           break;
-         }
+       {
+         if (frame->vec[i] == NULL)
+           {
+             set = true;
+             done = true;
+             frame->vec[i] = obj;
+             break;
+           }
+       }
+
+      // If we found a slot, or if the frame we just searched is the
+      // mark frame, then we are done.
+      if (done || frame->marker != MARK_NONE)
+       break;
     }
 
   if (! set)
@@ -301,7 +342,7 @@ _Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj)
       env->locals->vec[0] = obj;
     }
 
-  mark_for_gc (obj);
+  mark_for_gc (obj, local_ref_table);
   return obj;
 }
 
@@ -312,10 +353,10 @@ _Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result, int stop)
 
   bool done = false;
   while (rf != NULL && ! done)
-    {  
+    {
       for (int i = 0; i < rf->size; ++i)
        if (rf->vec[i] != NULL)
-         unmark_for_gc (rf->vec[i]);
+         unmark_for_gc (rf->vec[i], local_ref_table);
 
       // If the frame we just freed is the marker frame, we are done.
       done = (rf->marker == stop);
@@ -334,6 +375,9 @@ _Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result, int stop)
       rf = n;
     }
 
+  // Update the local frame information.
+  env->locals = rf;
+
   return result == NULL ? NULL : _Jv_JNI_NewLocalRef (env, result);
 }
 
@@ -368,11 +412,15 @@ wrap_value (JNIEnv *, T value)
   return value;
 }
 
-template<>
-static jobject
-wrap_value (JNIEnv *env, jobject value)
+// This specialization is used for jobject, jclass, jstring, jarray,
+// etc.
+template<typename T>
+static T *
+wrap_value (JNIEnv *env, T *value)
 {
-  return value == NULL ? value : _Jv_JNI_NewLocalRef (env, value);
+  return (value == NULL
+         ? value
+         : (T *) _Jv_JNI_NewLocalRef (env, (jobject) value));
 }
 
 \f
@@ -384,11 +432,13 @@ _Jv_JNI_GetVersion (JNIEnv *)
 }
 
 static jclass
-_Jv_JNI_DefineClass (JNIEnv *env, jobject loader, 
+_Jv_JNI_DefineClass (JNIEnv *env, jobject loader,
                     const jbyte *buf, jsize bufLen)
 {
   try
     {
+      loader = unwrap (loader);
+
       jbyteArray bytes = JvNewByteArray (bufLen);
 
       jbyte *elts = elements (bytes);
@@ -446,20 +496,21 @@ _Jv_JNI_FindClass (JNIEnv *env, const char *name)
 static jclass
 _Jv_JNI_GetSuperclass (JNIEnv *env, jclass clazz)
 {
-  return (jclass) wrap_value (env, clazz->getSuperclass ());
+  return (jclass) wrap_value (env, unwrap (clazz)->getSuperclass ());
 }
 
 static jboolean
 _Jv_JNI_IsAssignableFrom(JNIEnv *, jclass clazz1, jclass clazz2)
 {
-  return clazz1->isAssignableFrom (clazz2);
+  return unwrap (clazz1)->isAssignableFrom (unwrap (clazz2));
 }
 
 static jint
 _Jv_JNI_Throw (JNIEnv *env, jthrowable obj)
 {
   // We check in case the user did some funky cast.
-  JvAssert (obj != NULL && (&ThrowableClass)->isInstance (obj));
+  obj = unwrap (obj);
+  JvAssert (obj != NULL && java::lang::Throwable::class$.isInstance (obj));
   env->ex = obj;
   return 0;
 }
@@ -469,13 +520,15 @@ _Jv_JNI_ThrowNew (JNIEnv *env, jclass clazz, const char *message)
 {
   using namespace java::lang::reflect;
 
-  JvAssert ((&ThrowableClass)->isAssignableFrom (clazz));
+  clazz = unwrap (clazz);
+  JvAssert (java::lang::Throwable::class$.isAssignableFrom (clazz));
 
   int r = JNI_OK;
   try
     {
       JArray<jclass> *argtypes
-       = (JArray<jclass> *) JvNewObjectArray (1, &ClassClass, NULL);
+       = (JArray<jclass> *) JvNewObjectArray (1, &java::lang::Class::class$,
+                                              NULL);
 
       jclass *elts = elements (argtypes);
       elts[0] = &StringClass;
@@ -535,7 +588,7 @@ _Jv_JNI_FatalError (JNIEnv *, const char *message)
 static jboolean
 _Jv_JNI_IsSameObject (JNIEnv *, jobject obj1, jobject obj2)
 {
-  return obj1 == obj2;
+  return unwrap (obj1) == unwrap (obj2);
 }
 
 static jobject
@@ -546,6 +599,7 @@ _Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
 
   try
     {
+      clazz = unwrap (clazz);
       JvAssert (clazz && ! clazz->isArray ());
       if (clazz->isInterface() || Modifier::isAbstract(clazz->getModifiers()))
        env->ex = new java::lang::InstantiationException ();
@@ -566,6 +620,7 @@ _Jv_JNI_AllocObject (JNIEnv *env, jclass clazz)
 static jclass
 _Jv_JNI_GetObjectClass (JNIEnv *env, jobject obj)
 {
+  obj = unwrap (obj);
   JvAssert (obj);
   return (jclass) wrap_value (env, obj->getClass());
 }
@@ -573,7 +628,7 @@ _Jv_JNI_GetObjectClass (JNIEnv *env, jobject obj)
 static jboolean
 _Jv_JNI_IsInstanceOf (JNIEnv *, jobject obj, jclass clazz)
 {
-  return clazz->isInstance(obj);
+  return unwrap (clazz)->isInstance(unwrap (obj));
 }
 
 \f
@@ -589,10 +644,17 @@ _Jv_JNI_GetAnyMethodID (JNIEnv *env, jclass clazz,
 {
   try
     {
+      clazz = unwrap (clazz);
       _Jv_InitClass (clazz);
 
       _Jv_Utf8Const *name_u = _Jv_makeUtf8Const ((char *) name, -1);
-      _Jv_Utf8Const *sig_u = _Jv_makeUtf8Const ((char *) sig, -1);
+
+      // FIXME: assume that SIG isn't too long.
+      int len = strlen (sig);
+      char s[len + 1];
+      for (int i = 0; i <= len; ++i)
+       s[i] = (sig[i] == '/') ? '.' : sig[i];
+      _Jv_Utf8Const *sig_u = _Jv_makeUtf8Const ((char *) s, -1);
 
       JvAssert (! clazz->isPrimitive());
 
@@ -637,9 +699,9 @@ array_from_valist (jvalue *values, JArray<jclass> *arg_types, va_list vargs)
   for (int i = 0; i < arg_types->length; ++i)
     {
       if (arg_elts[i] == JvPrimClass (byte))
-       values[i].b = va_arg (vargs, jbyte);
+       values[i].b = (jbyte) va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (short))
-       values[i].s = va_arg (vargs, jshort);
+       values[i].s = (jshort) va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (int))
        values[i].i = va_arg (vargs, jint);
       else if (arg_elts[i] == JvPrimClass (long))
@@ -649,13 +711,13 @@ array_from_valist (jvalue *values, JArray<jclass> *arg_types, va_list vargs)
       else if (arg_elts[i] == JvPrimClass (double))
        values[i].d = va_arg (vargs, jdouble);
       else if (arg_elts[i] == JvPrimClass (boolean))
-       values[i].z = va_arg (vargs, jboolean);
+       values[i].z = (jboolean) va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (char))
-       values[i].c = va_arg (vargs, jchar);
+       values[i].c = (jchar) va_arg (vargs, int);
       else
        {
          // An object.
-         values[i].l = va_arg (vargs, jobject);
+         values[i].l = unwrap (va_arg (vargs, jobject));
        }
     }
 }
@@ -667,6 +729,9 @@ static T
 _Jv_JNI_CallAnyMethodV (JNIEnv *env, jobject obj, jclass klass,
                        jmethodID id, va_list vargs)
 {
+  obj = unwrap (obj);
+  klass = unwrap (klass);
+
   if (style == normal)
     id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature);
 
@@ -727,6 +792,9 @@ static T
 _Jv_JNI_CallAnyMethodA (JNIEnv *env, jobject obj, jclass klass,
                        jmethodID id, jvalue *args)
 {
+  obj = unwrap (obj);
+  klass = unwrap (klass);
+
   if (style == normal)
     id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature);
 
@@ -744,10 +812,21 @@ _Jv_JNI_CallAnyMethodA (JNIEnv *env, jobject obj, jclass klass,
       if (style == constructor)
        return_type = klass;
 
+      // Unwrap arguments as required.  Eww.
+      jclass *type_elts = elements (arg_types);
+      jvalue arg_copy[arg_types->length];
+      for (int i = 0; i < arg_types->length; ++i)
+       {
+         if (type_elts[i]->isPrimitive ())
+           arg_copy[i] = args[i];
+         else
+           arg_copy[i].l = unwrap (args[i].l);
+       }
+
       jvalue result;
       jthrowable ex = _Jv_CallAnyMethodA (obj, return_type, id,
                                          style == constructor,
-                                         arg_types, args, &result);
+                                         arg_types, arg_copy, &result);
 
       if (ex != NULL)
        env->ex = ex;
@@ -768,6 +847,9 @@ static void
 _Jv_JNI_CallAnyVoidMethodV (JNIEnv *env, jobject obj, jclass klass,
                            jmethodID id, va_list vargs)
 {
+  obj = unwrap (obj);
+  klass = unwrap (klass);
+
   if (style == normal)
     id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature);
 
@@ -831,6 +913,17 @@ _Jv_JNI_CallAnyVoidMethodA (JNIEnv *env, jobject obj, jclass klass,
       _Jv_GetTypesFromSignature (id, decl_class,
                                 &arg_types, &return_type);
 
+      // Unwrap arguments as required.  Eww.
+      jclass *type_elts = elements (arg_types);
+      jvalue arg_copy[arg_types->length];
+      for (int i = 0; i < arg_types->length; ++i)
+       {
+         if (type_elts[i]->isPrimitive ())
+           arg_copy[i] = args[i];
+         else
+           arg_copy[i].l = unwrap (args[i].l);
+       }
+
       jthrowable ex = _Jv_CallAnyMethodA (obj, return_type, id,
                                          style == constructor,
                                          arg_types, args, NULL);
@@ -908,7 +1001,7 @@ _Jv_JNI_CallStaticMethodV (JNIEnv *env, jclass klass,
                           jmethodID id, va_list args)
 {
   JvAssert (((id->accflags) & java::lang::reflect::Modifier::STATIC));
-  JvAssert ((&ClassClass)->isInstance (klass));
+  JvAssert (java::lang::Class::class$.isInstance (unwrap (klass)));
 
   return _Jv_JNI_CallAnyMethodV<T, static_type> (env, NULL, klass, id, args);
 }
@@ -923,7 +1016,7 @@ _Jv_JNI_CallStaticMethod (JNIEnv *env, jclass klass, jmethodID id, ...)
   T result;
 
   JvAssert (((id->accflags) & java::lang::reflect::Modifier::STATIC));
-  JvAssert ((&ClassClass)->isInstance (klass));
+  JvAssert (java::lang::Class::class$.isInstance (unwrap (klass)));
 
   va_start (args, id);
   result = _Jv_JNI_CallAnyMethodV<T, static_type> (env, NULL, klass,
@@ -941,7 +1034,7 @@ _Jv_JNI_CallStaticMethodA (JNIEnv *env, jclass klass, jmethodID id,
                           jvalue *args)
 {
   JvAssert (((id->accflags) & java::lang::reflect::Modifier::STATIC));
-  JvAssert ((&ClassClass)->isInstance (klass));
+  JvAssert (java::lang::Class::class$.isInstance (unwrap (klass)));
 
   return _Jv_JNI_CallAnyMethodA<T, static_type> (env, NULL, klass, id, args);
 }
@@ -1025,8 +1118,9 @@ _Jv_JNI_NewObjectA (JNIEnv *env, jclass klass, jmethodID id,
 
 template<typename T>
 static T
-_Jv_JNI_GetField (JNIEnv *env, jobject obj, jfieldID field) 
+_Jv_JNI_GetField (JNIEnv *env, jobject obj, jfieldID field)
 {
+  obj = unwrap (obj);
   JvAssert (obj);
   T *ptr = (T *) ((char *) obj + field->getOffset ());
   return wrap_value (env, *ptr);
@@ -1036,6 +1130,9 @@ template<typename T>
 static void
 _Jv_JNI_SetField (JNIEnv *, jobject obj, jfieldID field, T value)
 {
+  obj = unwrap (obj);
+  value = unwrap (value);
+
   JvAssert (obj);
   T *ptr = (T *) ((char *) obj + field->getOffset ());
   *ptr = value;
@@ -1048,23 +1145,28 @@ _Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz,
 {
   try
     {
+      clazz = unwrap (clazz);
+
       _Jv_InitClass (clazz);
 
       _Jv_Utf8Const *a_name = _Jv_makeUtf8Const ((char *) name, -1);
 
-      jclass field_class = NULL;
-      if (sig[0] == '[')
-       field_class = _Jv_FindClassFromSignature ((char *) sig, NULL);
-      else
-       {
-         _Jv_Utf8Const *sig_u = _Jv_makeUtf8Const ((char *) sig, -1);
-         field_class = _Jv_FindClass (sig_u, NULL);
-       }
+      // FIXME: assume that SIG isn't too long.
+      int len = strlen (sig);
+      char s[len + 1];
+      for (int i = 0; i <= len; ++i)
+       s[i] = (sig[i] == '/') ? '.' : sig[i];
+      jclass field_class = _Jv_FindClassFromSignature ((char *) s, NULL);
 
       // FIXME: what if field_class == NULL?
 
+      java::lang::ClassLoader *loader = clazz->getClassLoader ();
       while (clazz != NULL)
        {
+         // We acquire the class lock so that fields aren't resolved
+         // while we are running.
+         JvSynchronize sync (clazz);
+
          jint count = (is_static
                        ? JvNumStaticFields (clazz)
                        : JvNumInstanceFields (clazz));
@@ -1073,12 +1175,11 @@ _Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz,
                            : JvGetFirstInstanceField (clazz));
          for (jint i = 0; i < count; ++i)
            {
-             // The field is resolved as a side effect of class
-             // initialization.
-             JvAssert (field->isResolved ());
-
              _Jv_Utf8Const *f_name = field->getNameUtf8Const(clazz);
 
+             // The field might be resolved or it might not be.  It
+             // is much simpler to always resolve it.
+             _Jv_ResolveField (field, loader);
              if (_Jv_equalUtf8Consts (f_name, a_name)
                  && field->getClass() == field_class)
                return field;
@@ -1110,6 +1211,7 @@ template<typename T>
 static void
 _Jv_JNI_SetStaticField (JNIEnv *, jclass, jfieldID field, T value)
 {
+  value = unwrap (value);
   T *ptr = (T *) field->u.addr;
   *ptr = value;
 }
@@ -1132,14 +1234,15 @@ _Jv_JNI_NewString (JNIEnv *env, const jchar *unichars, jsize len)
 static jsize
 _Jv_JNI_GetStringLength (JNIEnv *, jstring string)
 {
-  return string->length();
+  return unwrap (string)->length();
 }
 
 static const jchar *
 _Jv_JNI_GetStringChars (JNIEnv *, jstring string, jboolean *isCopy)
 {
+  string = unwrap (string);
   jchar *result = _Jv_GetStringChars (string);
-  mark_for_gc (string);
+  mark_for_gc (string, global_ref_table);
   if (isCopy)
     *isCopy = false;
   return (const jchar *) result;
@@ -1148,7 +1251,7 @@ _Jv_JNI_GetStringChars (JNIEnv *, jstring string, jboolean *isCopy)
 static void
 _Jv_JNI_ReleaseStringChars (JNIEnv *, jstring string, const jchar *)
 {
-  unmark_for_gc (string);
+  unmark_for_gc (unwrap (string), global_ref_table);
 }
 
 static jstring
@@ -1169,12 +1272,13 @@ _Jv_JNI_NewStringUTF (JNIEnv *env, const char *bytes)
 static jsize
 _Jv_JNI_GetStringUTFLength (JNIEnv *, jstring string)
 {
-  return JvGetStringUTFLength (string);
+  return JvGetStringUTFLength (unwrap (string));
 }
 
 static const char *
 _Jv_JNI_GetStringUTFChars (JNIEnv *env, jstring string, jboolean *isCopy)
 {
+  string = unwrap (string);
   jsize len = JvGetStringUTFLength (string);
   try
     {
@@ -1204,6 +1308,7 @@ static void
 _Jv_JNI_GetStringRegion (JNIEnv *env, jstring string, jsize start, jsize len,
                         jchar *buf)
 {
+  string = unwrap (string);
   jchar *result = _Jv_GetStringChars (string);
   if (start < 0 || start > string->length ()
       || len < 0 || start + len > string->length ())
@@ -1225,6 +1330,8 @@ static void
 _Jv_JNI_GetStringUTFRegion (JNIEnv *env, jstring str, jsize start,
                            jsize len, char *buf)
 {
+  str = unwrap (str);
+    
   if (start < 0 || start > str->length ()
       || len < 0 || start + len > str->length ())
     {
@@ -1244,7 +1351,7 @@ _Jv_JNI_GetStringUTFRegion (JNIEnv *env, jstring str, jsize start,
 static const jchar *
 _Jv_JNI_GetStringCritical (JNIEnv *, jstring str, jboolean *isCopy)
 {
-  jchar *result = _Jv_GetStringChars (str);
+  jchar *result = _Jv_GetStringChars (unwrap (str));
   if (isCopy)
     *isCopy = false;
   return result;
@@ -1259,7 +1366,7 @@ _Jv_JNI_ReleaseStringCritical (JNIEnv *, jstring, const jchar *)
 static jsize
 _Jv_JNI_GetArrayLength (JNIEnv *, jarray array)
 {
-  return array->length;
+  return unwrap (array)->length;
 }
 
 static jarray
@@ -1268,6 +1375,9 @@ _Jv_JNI_NewObjectArray (JNIEnv *env, jsize length, jclass elementClass,
 {
   try
     {
+      elementClass = unwrap (elementClass);
+      init = unwrap (init);
+
       jarray result = JvNewObjectArray (length, elementClass, init);
       return (jarray) wrap_value (env, result);
     }
@@ -1281,7 +1391,7 @@ _Jv_JNI_NewObjectArray (JNIEnv *env, jsize length, jclass elementClass,
 static jobject
 _Jv_JNI_GetObjectArrayElement (JNIEnv *env, jobjectArray array, jsize index)
 {
-  jobject *elts = elements (array);
+  jobject *elts = elements (unwrap (array));
   return wrap_value (env, elts[index]);
 }
 
@@ -1291,6 +1401,9 @@ _Jv_JNI_SetObjectArrayElement (JNIEnv *env, jobjectArray array, jsize index,
 {
   try
     {
+      array = unwrap (array);
+      value = unwrap (value);
+
       _Jv_CheckArrayStore (array, value);
       jobject *elts = elements (array);
       elts[index] = value;
@@ -1321,13 +1434,14 @@ static T *
 _Jv_JNI_GetPrimitiveArrayElements (JNIEnv *, JArray<T> *array,
                                   jboolean *isCopy)
 {
+  array = unwrap (array);
   T *elts = elements (array);
   if (isCopy)
     {
       // We elect never to copy.
       *isCopy = false;
     }
-  mark_for_gc (array);
+  mark_for_gc (array, global_ref_table);
   return elts;
 }
 
@@ -1336,10 +1450,11 @@ static void
 _Jv_JNI_ReleasePrimitiveArrayElements (JNIEnv *, JArray<T> *array,
                                       T *, jint /* mode */)
 {
+  array = unwrap (array);
   // Note that we ignore MODE.  We can do this because we never copy
   // the array elements.  My reading of the JNI documentation is that
   // this is an option for the implementor.
-  unmark_for_gc (array);
+  unmark_for_gc (array, global_ref_table);
 }
 
 template<typename T>
@@ -1348,7 +1463,11 @@ _Jv_JNI_GetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
                                 jsize start, jsize len,
                                 T *buf)
 {
-  if (start < 0 || len >= array->length || start + len >= array->length)
+  array = unwrap (array);
+
+  // The cast to unsigned lets us save a comparison.
+  if (start < 0 || len < 0
+      || (unsigned long) (start + len) > (unsigned long) array->length)
     {
       try
        {
@@ -1370,10 +1489,14 @@ _Jv_JNI_GetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
 
 template<typename T>
 static void
-_Jv_JNI_SetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array, 
+_Jv_JNI_SetPrimitiveArrayRegion (JNIEnv *env, JArray<T> *array,
                                 jsize start, jsize len, T *buf)
 {
-  if (start < 0 || len >= array->length || start + len >= array->length)
+  array = unwrap (array);
+
+  // The cast to unsigned lets us save a comparison.
+  if (start < 0 || len < 0
+      || (unsigned long) (start + len) > (unsigned long) array->length)
     {
       try
        {
@@ -1396,6 +1519,7 @@ static void *
 _Jv_JNI_GetPrimitiveArrayCritical (JNIEnv *, jarray array,
                                   jboolean *isCopy)
 {
+  array = unwrap (array);
   // FIXME: does this work?
   jclass klass = array->getClass()->getComponentType();
   JvAssert (klass->isPrimitive ());
@@ -1416,7 +1540,8 @@ _Jv_JNI_MonitorEnter (JNIEnv *env, jobject obj)
 {
   try
     {
-      return _Jv_MonitorEnter (obj);
+      _Jv_MonitorEnter (unwrap (obj));
+      return 0;
     }
   catch (jthrowable t)
     {
@@ -1430,7 +1555,8 @@ _Jv_JNI_MonitorExit (JNIEnv *env, jobject obj)
 {
   try
     {
-      return _Jv_MonitorExit (obj);
+      _Jv_MonitorExit (unwrap (obj));
+      return 0;
     }
   catch (jthrowable t)
     {
@@ -1446,6 +1572,7 @@ _Jv_JNI_ToReflectedField (JNIEnv *env, jclass cls, jfieldID fieldID,
 {
   try
     {
+      cls = unwrap (cls);
       java::lang::reflect::Field *field = new java::lang::reflect::Field();
       field->declaringClass = cls;
       field->offset = (char*) fieldID - (char *) cls->fields;
@@ -1465,6 +1592,7 @@ _Jv_JNI_FromReflectedField (JNIEnv *, jobject f)
 {
   using namespace java::lang::reflect;
 
+  f = unwrap (f);
   Field *field = reinterpret_cast<Field *> (f);
   return _Jv_FromReflectedField (field);
 }
@@ -1475,10 +1603,8 @@ _Jv_JNI_ToReflectedMethod (JNIEnv *env, jclass klass, jmethodID id,
 {
   using namespace java::lang::reflect;
 
-  // FIXME.
-  static _Jv_Utf8Const *init_name = _Jv_makeUtf8Const ("<init>", 6);
-
   jobject result = NULL;
+  klass = unwrap (klass);
 
   try
     {
@@ -1510,25 +1636,169 @@ static jmethodID
 _Jv_JNI_FromReflectedMethod (JNIEnv *, jobject method)
 {
   using namespace java::lang::reflect;
-  if ((&MethodClass)->isInstance (method))
+  method = unwrap (method);
+  if (Method::class$.isInstance (method))
     return _Jv_FromReflectedMethod (reinterpret_cast<Method *> (method));
   return
     _Jv_FromReflectedConstructor (reinterpret_cast<Constructor *> (method));
 }
 
+// JDK 1.2.
+jweak
+_Jv_JNI_NewWeakGlobalRef (JNIEnv *env, jobject obj)
+{
+  using namespace gnu::gcj::runtime;
+  JNIWeakRef *ref = NULL;
+
+  try
+    {
+      // This seems weird but I think it is correct.
+      obj = unwrap (obj);
+      ref = new JNIWeakRef (obj);
+      mark_for_gc (ref, global_ref_table);
+    }
+  catch (jthrowable t)
+    {
+      env->ex = t;
+    }
+
+  return reinterpret_cast<jweak> (ref);
+}
+
+void
+_Jv_JNI_DeleteWeakGlobalRef (JNIEnv *, jweak obj)
+{
+  using namespace gnu::gcj::runtime;
+  JNIWeakRef *ref = reinterpret_cast<JNIWeakRef *> (obj);
+  unmark_for_gc (ref, global_ref_table);
+  ref->clear ();
+}
+
+\f
+
+// Hash table of native methods.
+static JNINativeMethod *nathash;
+// Number of slots used.
+static int nathash_count = 0;
+// Number of slots available.  Must be power of 2.
+static int nathash_size = 0;
+
+#define DELETED_ENTRY ((char *) (~0))
+
+// Compute a hash value for a native method descriptor.
+static int
+hash (const JNINativeMethod *method)
+{
+  char *ptr;
+  int hash = 0;
+
+  ptr = method->name;
+  while (*ptr)
+    hash = (31 * hash) + *ptr++;
+
+  ptr = method->signature;
+  while (*ptr)
+    hash = (31 * hash) + *ptr++;
+
+  return hash;
+}
+
+// Find the slot where a native method goes.
+static JNINativeMethod *
+nathash_find_slot (const JNINativeMethod *method)
+{
+  jint h = hash (method);
+  int step = (h ^ (h >> 16)) | 1;
+  int w = h & (nathash_size - 1);
+  int del = -1;
+
+  for (;;)
+    {
+      JNINativeMethod *slotp = &nathash[w];
+      if (slotp->name == NULL)
+       {
+         if (del >= 0)
+           return &nathash[del];
+         else
+           return slotp;
+       }
+      else if (slotp->name == DELETED_ENTRY)
+       del = w;
+      else if (! strcmp (slotp->name, method->name)
+              && ! strcmp (slotp->signature, method->signature))
+       return slotp;
+      w = (w + step) & (nathash_size - 1);
+    }
+}
+
+// Find a method.  Return NULL if it isn't in the hash table.
+static void *
+nathash_find (JNINativeMethod *method)
+{
+  if (nathash == NULL)
+    return NULL;
+  JNINativeMethod *slot = nathash_find_slot (method);
+  if (slot->name == NULL || slot->name == DELETED_ENTRY)
+    return NULL;
+  return slot->fnPtr;
+}
+
+static void
+natrehash ()
+{
+  if (nathash == NULL)
+    {
+      nathash_size = 1024;
+      nathash =
+       (JNINativeMethod *) _Jv_AllocBytes (nathash_size
+                                           * sizeof (JNINativeMethod));
+      memset (nathash, 0, nathash_size * sizeof (JNINativeMethod));
+    }
+  else
+    {
+      int savesize = nathash_size;
+      JNINativeMethod *savehash = nathash;
+      nathash_size *= 2;
+      nathash =
+       (JNINativeMethod *) _Jv_AllocBytes (nathash_size
+                                           * sizeof (JNINativeMethod));
+      memset (nathash, 0, nathash_size * sizeof (JNINativeMethod));
+
+      for (int i = 0; i < savesize; ++i)
+       {
+         if (savehash[i].name != NULL && savehash[i].name != DELETED_ENTRY)
+           {
+             JNINativeMethod *slot = nathash_find_slot (&savehash[i]);
+             *slot = savehash[i];
+           }
+       }
+    }
+}
+
+static void
+nathash_add (const JNINativeMethod *method)
+{
+  if (3 * nathash_count >= 2 * nathash_size)
+    natrehash ();
+  JNINativeMethod *slot = nathash_find_slot (method);
+  // If the slot has a real entry in it, then there is no work to do.
+  if (slot->name != NULL && slot->name != DELETED_ENTRY)
+    return;
+  // FIXME
+  slot->name = strdup (method->name);
+  slot->signature = strdup (method->signature);
+  slot->fnPtr = method->fnPtr;
+}
+
 static jint
-_Jv_JNI_RegisterNatives (JNIEnv *env, jclass k,
+_Jv_JNI_RegisterNatives (JNIEnv *env, jclass klass,
                         const JNINativeMethod *methods,
                         jint nMethods)
 {
-#ifdef INTERPRETER
-  // For now, this only matters for interpreted methods.  FIXME.
-  if (! _Jv_IsInterpretedClass (k))
-    {
-      // FIXME: throw exception.
-      return JNI_ERR;
-    }
-  _Jv_InterpClass *klass = reinterpret_cast<_Jv_InterpClass *> (k);
+  // Synchronize while we do the work.  This must match
+  // synchronization in some other functions that manipulate or use
+  // the nathash table.
+  JvSynchronize sync (global_ref_table);
 
   // Look at each descriptor given us, and find the corresponding
   // method in the class.
@@ -1536,11 +1806,10 @@ _Jv_JNI_RegisterNatives (JNIEnv *env, jclass k,
     {
       bool found = false;
 
-      _Jv_MethodBase **imeths = _Jv_GetFirstMethod (klass);
+      _Jv_Method *imeths = JvGetFirstMethod (klass);
       for (int i = 0; i < JvNumMethods (klass); ++i)
        {
-         _Jv_MethodBase *meth = imeths[i];
-         _Jv_Method *self = meth->get_method ();
+         _Jv_Method *self = &imeths[i];
 
          if (! strcmp (self->name->data, methods[j].name)
              && ! strcmp (self->signature->data, methods[j].signature))
@@ -1550,9 +1819,9 @@ _Jv_JNI_RegisterNatives (JNIEnv *env, jclass k,
                break;
 
              // Found a match that is native.
-             _Jv_JNIMethod *jmeth = reinterpret_cast<_Jv_JNIMethod *> (meth);
-             jmeth->set_function (methods[i].fnPtr);
              found = true;
+             nathash_add (&methods[j]);
+
              break;
            }
        }
@@ -1573,21 +1842,17 @@ _Jv_JNI_RegisterNatives (JNIEnv *env, jclass k,
     }
 
   return JNI_OK;
-#else /* INTERPRETER */
-  return JNI_ERR;
-#endif /* INTERPRETER */
 }
 
 static jint
 _Jv_JNI_UnregisterNatives (JNIEnv *, jclass)
 {
+  // FIXME -- we could implement this.
   return JNI_ERR;
 }
 
 \f
 
-#ifdef INTERPRETER
-
 // Add a character to the buffer, encoding properly.
 static void
 add_char (char *buf, jchar c, int *here)
@@ -1607,11 +1872,14 @@ add_char (char *buf, jchar c, int *here)
       buf[(*here)++] = '_';
       buf[(*here)++] = '3';
     }
-  else if (c == '/')
+
+  // Also check for `.' here because we might be passed an internal
+  // qualified class name like `foo.bar'.
+  else if (c == '/' || c == '.')
     buf[(*here)++] = '_';
   else if ((c >= '0' && c <= '9')
-      || (c >= 'a' && c <= 'z')
-      || (c >= 'A' && c <= 'Z'))
+          || (c >= 'a' && c <= 'z')
+          || (c >= 'A' && c <= 'Z'))
     buf[(*here)++] = (char) c;
   else
     {
@@ -1621,7 +1889,7 @@ add_char (char *buf, jchar c, int *here)
       for (int i = 0; i < 4; ++i)
        {
          int val = c & 0x0f;
-         buf[(*here) + 4 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
+         buf[(*here) + 3 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
          c >>= 4;
        }
       *here += 4;
@@ -1723,6 +1991,22 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
   int long_start;
   void *function;
 
+  // Synchronize on something convenient.  Right now we use the hash.
+  JvSynchronize sync (global_ref_table);
+
+  // First see if we have an override in the hash table.
+  strncpy (buf, name->data, name->length);
+  buf[name->length] = '\0';
+  strncpy (buf + name->length + 1, signature->data, signature->length);
+  buf[name->length + signature->length + 1] = '\0';
+  JNINativeMethod meth;
+  meth.name = buf;
+  meth.signature = buf + name->length + 1;
+  function = nathash_find (&meth);
+  if (function != NULL)
+    return function;
+
+  // If there was no override, then look in the symbol table.
   mangled_name (klass, name, signature, buf, &long_start);
   char c = buf[long_start];
   buf[long_start] = '\0';
@@ -1734,13 +2018,15 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
       if (function == NULL)
        {
          jstring str = JvNewStringUTF (name->data);
-         JvThrow (new java::lang::AbstractMethodError (str));
+         throw new java::lang::AbstractMethodError (str);
        }
     }
 
   return function;
 }
 
+#ifdef INTERPRETER
+
 // This function is the stub which is used to turn an ordinary (CNI)
 // method call into a JNI call.
 void
@@ -1757,10 +2043,16 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
   // We cache the value that we find, of course, but if we don't find
   // a value we don't cache that fact -- we might subsequently load a
   // library which finds the function in question.
-  if (_this->function == NULL)
-    _this->function = _Jv_LookupJNIMethod (_this->defining_class,
-                                          _this->self->name,
-                                          _this->self->signature);
+  {
+    // Synchronize on a convenient object to ensure sanity in case two
+    // threads reach this point for the same function at the same
+    // time.
+    JvSynchronize sync (global_ref_table);
+    if (_this->function == NULL)
+      _this->function = _Jv_LookupJNIMethod (_this->defining_class,
+                                            _this->self->name,
+                                            _this->self->signature);
+  }
 
   JvAssert (_this->args_raw_size % sizeof (ffi_raw) == 0);
   ffi_raw real_args[2 + _this->args_raw_size / sizeof (ffi_raw)];
@@ -1806,7 +2098,7 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args)
          && attach->version != JNI_VERSION_1_1)
        return JNI_EVERSION;
 
-      JvAssert ((&ThreadGroupClass)->isInstance (attach->group));
+      JvAssert (java::lang::ThreadGroup::class$.isInstance (attach->group));
       group = reinterpret_cast<java::lang::ThreadGroup *> (attach->group);
     }
 
@@ -1837,7 +2129,7 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args)
     {
       try
        {
-         (void) new gnu::gcj::jni::NativeThread (group, name);
+         _Jv_AttachCurrentThread (name, group);
        }
       catch (jthrowable t)
        {
@@ -1891,28 +2183,11 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm)
   return JNI_ERR;
 }
 
-static jint
+jint
 _Jv_JNI_DetachCurrentThread (JavaVM *)
 {
-  java::lang::Thread *t = _Jv_ThreadCurrent ();
-  if (t == NULL)
-    return JNI_EDETACHED;
-
-  // FIXME: we only allow threads attached via AttachCurrentThread to
-  // be detached.  I have no idea how we could implement detaching
-  // other threads, given the requirement that we must release all the
-  // monitors.  That just seems evil.
-  JvAssert ((&NativeThreadClass)->isInstance (t));
-
-  // FIXME: release the monitors.  We'll take this to mean all
-  // monitors acquired via the JNI interface.  This means we have to
-  // keep track of them.
-
-  gnu::gcj::jni::NativeThread *nt
-    = reinterpret_cast<gnu::gcj::jni::NativeThread *> (t);
-  nt->finish ();
-
-  return 0;
+  jint code = _Jv_DetachCurrentThread ();
+  return code  ? JNI_EDETACHED : 0;
 }
 
 static jint
@@ -1965,6 +2240,9 @@ jint
 JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
 {
   JvAssert (! the_vm);
+
+  _Jv_CreateJavaVM (NULL);
+
   // FIXME: synchronize
   JavaVM *nvm = (JavaVM *) _Jv_MallocUnchecked (sizeof (JavaVM));
   if (nvm == NULL)
@@ -2019,6 +2297,7 @@ JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
 
   the_vm = nvm;
   *vm = the_vm;
+
   return 0;
 }
 
@@ -2071,7 +2350,6 @@ _Jv_JNI_GetJavaVM (JNIEnv *, JavaVM **vm)
 
 \f
 
-#define NOT_IMPL NULL
 #define RESERVED NULL
 
 struct JNINativeInterface _Jv_JNIFunctions =
@@ -2080,242 +2358,243 @@ struct JNINativeInterface _Jv_JNIFunctions =
   RESERVED,
   RESERVED,
   RESERVED,
-  _Jv_JNI_GetVersion,
-  _Jv_JNI_DefineClass,
-  _Jv_JNI_FindClass,
-  _Jv_JNI_FromReflectedMethod,
-  _Jv_JNI_FromReflectedField,
-  _Jv_JNI_ToReflectedMethod,
-  _Jv_JNI_GetSuperclass,
-  _Jv_JNI_IsAssignableFrom,
-  _Jv_JNI_ToReflectedField,
-  _Jv_JNI_Throw,
-  _Jv_JNI_ThrowNew,
-  _Jv_JNI_ExceptionOccurred,
-  _Jv_JNI_ExceptionDescribe,
-  _Jv_JNI_ExceptionClear,
-  _Jv_JNI_FatalError,
-
-  _Jv_JNI_PushLocalFrame,
-  _Jv_JNI_PopLocalFrame,
-  _Jv_JNI_NewGlobalRef,
-  _Jv_JNI_DeleteGlobalRef,
-  _Jv_JNI_DeleteLocalRef,
-
-  _Jv_JNI_IsSameObject,
-
-  _Jv_JNI_NewLocalRef,
-  _Jv_JNI_EnsureLocalCapacity,
-
-  _Jv_JNI_AllocObject,
-  _Jv_JNI_NewObject,
-  _Jv_JNI_NewObjectV,
-  _Jv_JNI_NewObjectA,
-  _Jv_JNI_GetObjectClass,
-  _Jv_JNI_IsInstanceOf,
-  _Jv_JNI_GetAnyMethodID<false>,
-
-  _Jv_JNI_CallMethod<jobject>,
-  _Jv_JNI_CallMethodV<jobject>,
-  _Jv_JNI_CallMethodA<jobject>,
-  _Jv_JNI_CallMethod<jboolean>,
-  _Jv_JNI_CallMethodV<jboolean>,
-  _Jv_JNI_CallMethodA<jboolean>,
-  _Jv_JNI_CallMethod<jbyte>,
-  _Jv_JNI_CallMethodV<jbyte>,
-  _Jv_JNI_CallMethodA<jbyte>,
-  _Jv_JNI_CallMethod<jchar>,
-  _Jv_JNI_CallMethodV<jchar>,
-  _Jv_JNI_CallMethodA<jchar>,
-  _Jv_JNI_CallMethod<jshort>,
-  _Jv_JNI_CallMethodV<jshort>,
-  _Jv_JNI_CallMethodA<jshort>,
-  _Jv_JNI_CallMethod<jint>,
-  _Jv_JNI_CallMethodV<jint>,
-  _Jv_JNI_CallMethodA<jint>,
-  _Jv_JNI_CallMethod<jlong>,
-  _Jv_JNI_CallMethodV<jlong>,
-  _Jv_JNI_CallMethodA<jlong>,
-  _Jv_JNI_CallMethod<jfloat>,
-  _Jv_JNI_CallMethodV<jfloat>,
-  _Jv_JNI_CallMethodA<jfloat>,
-  _Jv_JNI_CallMethod<jdouble>,
-  _Jv_JNI_CallMethodV<jdouble>,
-  _Jv_JNI_CallMethodA<jdouble>,
-  _Jv_JNI_CallVoidMethod,
-  _Jv_JNI_CallVoidMethodV,
-  _Jv_JNI_CallVoidMethodA,
+  _Jv_JNI_GetVersion,          // GetVersion
+  _Jv_JNI_DefineClass,         // DefineClass
+  _Jv_JNI_FindClass,           // FindClass
+  _Jv_JNI_FromReflectedMethod, // FromReflectedMethod
+  _Jv_JNI_FromReflectedField,  // FromReflectedField
+  _Jv_JNI_ToReflectedMethod,   // ToReflectedMethod
+  _Jv_JNI_GetSuperclass,       // GetSuperclass
+  _Jv_JNI_IsAssignableFrom,    // IsAssignableFrom
+  _Jv_JNI_ToReflectedField,    // ToReflectedField
+  _Jv_JNI_Throw,               // Throw
+  _Jv_JNI_ThrowNew,            // ThrowNew
+  _Jv_JNI_ExceptionOccurred,   // ExceptionOccurred
+  _Jv_JNI_ExceptionDescribe,   // ExceptionDescribe
+  _Jv_JNI_ExceptionClear,      // ExceptionClear
+  _Jv_JNI_FatalError,          // FatalError
+
+  _Jv_JNI_PushLocalFrame,      // PushLocalFrame
+  _Jv_JNI_PopLocalFrame,       // PopLocalFrame
+  _Jv_JNI_NewGlobalRef,                // NewGlobalRef
+  _Jv_JNI_DeleteGlobalRef,     // DeleteGlobalRef
+  _Jv_JNI_DeleteLocalRef,      // DeleteLocalRef
+
+  _Jv_JNI_IsSameObject,                // IsSameObject
+
+  _Jv_JNI_NewLocalRef,         // NewLocalRef
+  _Jv_JNI_EnsureLocalCapacity, // EnsureLocalCapacity
+
+  _Jv_JNI_AllocObject,             // AllocObject
+  _Jv_JNI_NewObject,               // NewObject
+  _Jv_JNI_NewObjectV,              // NewObjectV
+  _Jv_JNI_NewObjectA,              // NewObjectA
+  _Jv_JNI_GetObjectClass,          // GetObjectClass
+  _Jv_JNI_IsInstanceOf,                    // IsInstanceOf
+  _Jv_JNI_GetAnyMethodID<false>,    // GetMethodID
+
+  _Jv_JNI_CallMethod<jobject>,         // CallObjectMethod
+  _Jv_JNI_CallMethodV<jobject>,                // CallObjectMethodV
+  _Jv_JNI_CallMethodA<jobject>,                // CallObjectMethodA
+  _Jv_JNI_CallMethod<jboolean>,                // CallBooleanMethod
+  _Jv_JNI_CallMethodV<jboolean>,       // CallBooleanMethodV
+  _Jv_JNI_CallMethodA<jboolean>,       // CallBooleanMethodA
+  _Jv_JNI_CallMethod<jbyte>,           // CallByteMethod
+  _Jv_JNI_CallMethodV<jbyte>,          // CallByteMethodV
+  _Jv_JNI_CallMethodA<jbyte>,          // CallByteMethodA
+  _Jv_JNI_CallMethod<jchar>,           // CallCharMethod
+  _Jv_JNI_CallMethodV<jchar>,          // CallCharMethodV
+  _Jv_JNI_CallMethodA<jchar>,          // CallCharMethodA
+  _Jv_JNI_CallMethod<jshort>,          // CallShortMethod
+  _Jv_JNI_CallMethodV<jshort>,         // CallShortMethodV
+  _Jv_JNI_CallMethodA<jshort>,         // CallShortMethodA
+  _Jv_JNI_CallMethod<jint>,            // CallIntMethod
+  _Jv_JNI_CallMethodV<jint>,           // CallIntMethodV
+  _Jv_JNI_CallMethodA<jint>,           // CallIntMethodA
+  _Jv_JNI_CallMethod<jlong>,           // CallLongMethod
+  _Jv_JNI_CallMethodV<jlong>,          // CallLongMethodV
+  _Jv_JNI_CallMethodA<jlong>,          // CallLongMethodA
+  _Jv_JNI_CallMethod<jfloat>,          // CallFloatMethod
+  _Jv_JNI_CallMethodV<jfloat>,         // CallFloatMethodV
+  _Jv_JNI_CallMethodA<jfloat>,         // CallFloatMethodA
+  _Jv_JNI_CallMethod<jdouble>,         // CallDoubleMethod
+  _Jv_JNI_CallMethodV<jdouble>,                // CallDoubleMethodV
+  _Jv_JNI_CallMethodA<jdouble>,                // CallDoubleMethodA
+  _Jv_JNI_CallVoidMethod,              // CallVoidMethod
+  _Jv_JNI_CallVoidMethodV,             // CallVoidMethodV
+  _Jv_JNI_CallVoidMethodA,             // CallVoidMethodA
 
   // Nonvirtual method invocation functions follow.
-  _Jv_JNI_CallAnyMethod<jobject, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jobject, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jobject, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jboolean, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jboolean, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jboolean, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jbyte, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jbyte, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jbyte, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jchar, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jchar, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jchar, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jshort, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jshort, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jshort, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jint, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jint, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jint, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jlong, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jlong, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jlong, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jfloat, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jfloat, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jfloat, nonvirtual>,
-  _Jv_JNI_CallAnyMethod<jdouble, nonvirtual>,
-  _Jv_JNI_CallAnyMethodV<jdouble, nonvirtual>,
-  _Jv_JNI_CallAnyMethodA<jdouble, nonvirtual>,
-  _Jv_JNI_CallAnyVoidMethod<nonvirtual>,
-  _Jv_JNI_CallAnyVoidMethodV<nonvirtual>,
-  _Jv_JNI_CallAnyVoidMethodA<nonvirtual>,
-
-  _Jv_JNI_GetAnyFieldID<false>,
-  _Jv_JNI_GetField<jobject>,
-  _Jv_JNI_GetField<jboolean>,
-  _Jv_JNI_GetField<jbyte>,
-  _Jv_JNI_GetField<jchar>,
-  _Jv_JNI_GetField<jshort>,
-  _Jv_JNI_GetField<jint>,
-  _Jv_JNI_GetField<jlong>,
-  _Jv_JNI_GetField<jfloat>,
-  _Jv_JNI_GetField<jdouble>,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_SetField,
-  _Jv_JNI_GetAnyMethodID<true>,
-
-  _Jv_JNI_CallStaticMethod<jobject>,
-  _Jv_JNI_CallStaticMethodV<jobject>,
-  _Jv_JNI_CallStaticMethodA<jobject>,
-  _Jv_JNI_CallStaticMethod<jboolean>,
-  _Jv_JNI_CallStaticMethodV<jboolean>,
-  _Jv_JNI_CallStaticMethodA<jboolean>,
-  _Jv_JNI_CallStaticMethod<jbyte>,
-  _Jv_JNI_CallStaticMethodV<jbyte>,
-  _Jv_JNI_CallStaticMethodA<jbyte>,
-  _Jv_JNI_CallStaticMethod<jchar>,
-  _Jv_JNI_CallStaticMethodV<jchar>,
-  _Jv_JNI_CallStaticMethodA<jchar>,
-  _Jv_JNI_CallStaticMethod<jshort>,
-  _Jv_JNI_CallStaticMethodV<jshort>,
-  _Jv_JNI_CallStaticMethodA<jshort>,
-  _Jv_JNI_CallStaticMethod<jint>,
-  _Jv_JNI_CallStaticMethodV<jint>,
-  _Jv_JNI_CallStaticMethodA<jint>,
-  _Jv_JNI_CallStaticMethod<jlong>,
-  _Jv_JNI_CallStaticMethodV<jlong>,
-  _Jv_JNI_CallStaticMethodA<jlong>,
-  _Jv_JNI_CallStaticMethod<jfloat>,
-  _Jv_JNI_CallStaticMethodV<jfloat>,
-  _Jv_JNI_CallStaticMethodA<jfloat>,
-  _Jv_JNI_CallStaticMethod<jdouble>,
-  _Jv_JNI_CallStaticMethodV<jdouble>,
-  _Jv_JNI_CallStaticMethodA<jdouble>,
-  _Jv_JNI_CallStaticVoidMethod,
-  _Jv_JNI_CallStaticVoidMethodV,
-  _Jv_JNI_CallStaticVoidMethodA,
-
-  _Jv_JNI_GetAnyFieldID<true>,
-  _Jv_JNI_GetStaticField<jobject>,
-  _Jv_JNI_GetStaticField<jboolean>,
-  _Jv_JNI_GetStaticField<jbyte>,
-  _Jv_JNI_GetStaticField<jchar>,
-  _Jv_JNI_GetStaticField<jshort>,
-  _Jv_JNI_GetStaticField<jint>,
-  _Jv_JNI_GetStaticField<jlong>,
-  _Jv_JNI_GetStaticField<jfloat>,
-  _Jv_JNI_GetStaticField<jdouble>,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_SetStaticField,
-  _Jv_JNI_NewString,
-  _Jv_JNI_GetStringLength,
-  _Jv_JNI_GetStringChars,
-  _Jv_JNI_ReleaseStringChars,
-  _Jv_JNI_NewStringUTF,
-  _Jv_JNI_GetStringUTFLength,
-  _Jv_JNI_GetStringUTFChars,
-  _Jv_JNI_ReleaseStringUTFChars,
-  _Jv_JNI_GetArrayLength,
-  _Jv_JNI_NewObjectArray,
-  _Jv_JNI_GetObjectArrayElement,
-  _Jv_JNI_SetObjectArrayElement,
+  _Jv_JNI_CallAnyMethod<jobject, nonvirtual>,  // CallNonvirtualObjectMethod
+  _Jv_JNI_CallAnyMethodV<jobject, nonvirtual>, // CallNonvirtualObjectMethodV
+  _Jv_JNI_CallAnyMethodA<jobject, nonvirtual>, // CallNonvirtualObjectMethodA
+  _Jv_JNI_CallAnyMethod<jboolean, nonvirtual>, // CallNonvirtualBooleanMethod
+  _Jv_JNI_CallAnyMethodV<jboolean, nonvirtual>,        // CallNonvirtualBooleanMethodV
+  _Jv_JNI_CallAnyMethodA<jboolean, nonvirtual>,        // CallNonvirtualBooleanMethodA
+  _Jv_JNI_CallAnyMethod<jbyte, nonvirtual>,    // CallNonvirtualByteMethod
+  _Jv_JNI_CallAnyMethodV<jbyte, nonvirtual>,   // CallNonvirtualByteMethodV
+  _Jv_JNI_CallAnyMethodA<jbyte, nonvirtual>,   // CallNonvirtualByteMethodA
+  _Jv_JNI_CallAnyMethod<jchar, nonvirtual>,    // CallNonvirtualCharMethod
+  _Jv_JNI_CallAnyMethodV<jchar, nonvirtual>,   // CallNonvirtualCharMethodV
+  _Jv_JNI_CallAnyMethodA<jchar, nonvirtual>,   // CallNonvirtualCharMethodA
+  _Jv_JNI_CallAnyMethod<jshort, nonvirtual>,   // CallNonvirtualShortMethod
+  _Jv_JNI_CallAnyMethodV<jshort, nonvirtual>,  // CallNonvirtualShortMethodV
+  _Jv_JNI_CallAnyMethodA<jshort, nonvirtual>,  // CallNonvirtualShortMethodA
+  _Jv_JNI_CallAnyMethod<jint, nonvirtual>,     // CallNonvirtualIntMethod
+  _Jv_JNI_CallAnyMethodV<jint, nonvirtual>,    // CallNonvirtualIntMethodV
+  _Jv_JNI_CallAnyMethodA<jint, nonvirtual>,    // CallNonvirtualIntMethodA
+  _Jv_JNI_CallAnyMethod<jlong, nonvirtual>,    // CallNonvirtualLongMethod
+  _Jv_JNI_CallAnyMethodV<jlong, nonvirtual>,   // CallNonvirtualLongMethodV
+  _Jv_JNI_CallAnyMethodA<jlong, nonvirtual>,   // CallNonvirtualLongMethodA
+  _Jv_JNI_CallAnyMethod<jfloat, nonvirtual>,   // CallNonvirtualFloatMethod
+  _Jv_JNI_CallAnyMethodV<jfloat, nonvirtual>,  // CallNonvirtualFloatMethodV
+  _Jv_JNI_CallAnyMethodA<jfloat, nonvirtual>,  // CallNonvirtualFloatMethodA
+  _Jv_JNI_CallAnyMethod<jdouble, nonvirtual>,  // CallNonvirtualDoubleMethod
+  _Jv_JNI_CallAnyMethodV<jdouble, nonvirtual>, // CallNonvirtualDoubleMethodV
+  _Jv_JNI_CallAnyMethodA<jdouble, nonvirtual>, // CallNonvirtualDoubleMethodA
+  _Jv_JNI_CallAnyVoidMethod<nonvirtual>,       // CallNonvirtualVoidMethod
+  _Jv_JNI_CallAnyVoidMethodV<nonvirtual>,      // CallNonvirtualVoidMethodV
+  _Jv_JNI_CallAnyVoidMethodA<nonvirtual>,      // CallNonvirtualVoidMethodA
+
+  _Jv_JNI_GetAnyFieldID<false>,        // GetFieldID
+  _Jv_JNI_GetField<jobject>,   // GetObjectField
+  _Jv_JNI_GetField<jboolean>,  // GetBooleanField
+  _Jv_JNI_GetField<jbyte>,     // GetByteField
+  _Jv_JNI_GetField<jchar>,     // GetCharField
+  _Jv_JNI_GetField<jshort>,    // GetShortField
+  _Jv_JNI_GetField<jint>,      // GetIntField
+  _Jv_JNI_GetField<jlong>,     // GetLongField
+  _Jv_JNI_GetField<jfloat>,    // GetFloatField
+  _Jv_JNI_GetField<jdouble>,   // GetDoubleField
+  _Jv_JNI_SetField,            // SetObjectField
+  _Jv_JNI_SetField,            // SetBooleanField
+  _Jv_JNI_SetField,            // SetByteField
+  _Jv_JNI_SetField,            // SetCharField
+  _Jv_JNI_SetField,            // SetShortField
+  _Jv_JNI_SetField,            // SetIntField
+  _Jv_JNI_SetField,            // SetLongField
+  _Jv_JNI_SetField,            // SetFloatField
+  _Jv_JNI_SetField,            // SetDoubleField
+  _Jv_JNI_GetAnyMethodID<true>,        // GetStaticMethodID
+
+  _Jv_JNI_CallStaticMethod<jobject>,     // CallStaticObjectMethod
+  _Jv_JNI_CallStaticMethodV<jobject>,    // CallStaticObjectMethodV
+  _Jv_JNI_CallStaticMethodA<jobject>,    // CallStaticObjectMethodA
+  _Jv_JNI_CallStaticMethod<jboolean>,    // CallStaticBooleanMethod
+  _Jv_JNI_CallStaticMethodV<jboolean>,   // CallStaticBooleanMethodV
+  _Jv_JNI_CallStaticMethodA<jboolean>,   // CallStaticBooleanMethodA
+  _Jv_JNI_CallStaticMethod<jbyte>,       // CallStaticByteMethod
+  _Jv_JNI_CallStaticMethodV<jbyte>,      // CallStaticByteMethodV
+  _Jv_JNI_CallStaticMethodA<jbyte>,      // CallStaticByteMethodA
+  _Jv_JNI_CallStaticMethod<jchar>,       // CallStaticCharMethod
+  _Jv_JNI_CallStaticMethodV<jchar>,      // CallStaticCharMethodV
+  _Jv_JNI_CallStaticMethodA<jchar>,      // CallStaticCharMethodA
+  _Jv_JNI_CallStaticMethod<jshort>,      // CallStaticShortMethod
+  _Jv_JNI_CallStaticMethodV<jshort>,     // CallStaticShortMethodV
+  _Jv_JNI_CallStaticMethodA<jshort>,     // CallStaticShortMethodA
+  _Jv_JNI_CallStaticMethod<jint>,        // CallStaticIntMethod
+  _Jv_JNI_CallStaticMethodV<jint>,       // CallStaticIntMethodV
+  _Jv_JNI_CallStaticMethodA<jint>,       // CallStaticIntMethodA
+  _Jv_JNI_CallStaticMethod<jlong>,       // CallStaticLongMethod
+  _Jv_JNI_CallStaticMethodV<jlong>,      // CallStaticLongMethodV
+  _Jv_JNI_CallStaticMethodA<jlong>,      // CallStaticLongMethodA
+  _Jv_JNI_CallStaticMethod<jfloat>,      // CallStaticFloatMethod
+  _Jv_JNI_CallStaticMethodV<jfloat>,     // CallStaticFloatMethodV
+  _Jv_JNI_CallStaticMethodA<jfloat>,     // CallStaticFloatMethodA
+  _Jv_JNI_CallStaticMethod<jdouble>,     // CallStaticDoubleMethod
+  _Jv_JNI_CallStaticMethodV<jdouble>,    // CallStaticDoubleMethodV
+  _Jv_JNI_CallStaticMethodA<jdouble>,    // CallStaticDoubleMethodA
+  _Jv_JNI_CallStaticVoidMethod,                  // CallStaticVoidMethod
+  _Jv_JNI_CallStaticVoidMethodV,         // CallStaticVoidMethodV
+  _Jv_JNI_CallStaticVoidMethodA,         // CallStaticVoidMethodA
+
+  _Jv_JNI_GetAnyFieldID<true>,        // GetStaticFieldID
+  _Jv_JNI_GetStaticField<jobject>,     // GetStaticObjectField
+  _Jv_JNI_GetStaticField<jboolean>,    // GetStaticBooleanField
+  _Jv_JNI_GetStaticField<jbyte>,       // GetStaticByteField
+  _Jv_JNI_GetStaticField<jchar>,       // GetStaticCharField
+  _Jv_JNI_GetStaticField<jshort>,      // GetStaticShortField
+  _Jv_JNI_GetStaticField<jint>,               // GetStaticIntField
+  _Jv_JNI_GetStaticField<jlong>,       // GetStaticLongField
+  _Jv_JNI_GetStaticField<jfloat>,      // GetStaticFloatField
+  _Jv_JNI_GetStaticField<jdouble>,     // GetStaticDoubleField
+  _Jv_JNI_SetStaticField,             // SetStaticObjectField
+  _Jv_JNI_SetStaticField,             // SetStaticBooleanField
+  _Jv_JNI_SetStaticField,             // SetStaticByteField
+  _Jv_JNI_SetStaticField,             // SetStaticCharField
+  _Jv_JNI_SetStaticField,             // SetStaticShortField
+  _Jv_JNI_SetStaticField,             // SetStaticIntField
+  _Jv_JNI_SetStaticField,             // SetStaticLongField
+  _Jv_JNI_SetStaticField,             // SetStaticFloatField
+  _Jv_JNI_SetStaticField,             // SetStaticDoubleField
+  _Jv_JNI_NewString,                  // NewString
+  _Jv_JNI_GetStringLength,            // GetStringLength
+  _Jv_JNI_GetStringChars,             // GetStringChars
+  _Jv_JNI_ReleaseStringChars,         // ReleaseStringChars
+  _Jv_JNI_NewStringUTF,                       // NewStringUTF
+  _Jv_JNI_GetStringUTFLength,         // GetStringUTFLength
+  _Jv_JNI_GetStringUTFChars,          // GetStringUTFLength
+  _Jv_JNI_ReleaseStringUTFChars,       // ReleaseStringUTFChars
+  _Jv_JNI_GetArrayLength,             // GetArrayLength
+  _Jv_JNI_NewObjectArray,             // NewObjectArray
+  _Jv_JNI_GetObjectArrayElement,       // GetObjectArrayElement
+  _Jv_JNI_SetObjectArrayElement,       // SetObjectArrayElement
   _Jv_JNI_NewPrimitiveArray<jboolean, JvPrimClass (boolean)>,
-  _Jv_JNI_NewPrimitiveArray<jbyte, JvPrimClass (byte)>,
-  _Jv_JNI_NewPrimitiveArray<jchar, JvPrimClass (char)>,
-  _Jv_JNI_NewPrimitiveArray<jshort, JvPrimClass (short)>,
-  _Jv_JNI_NewPrimitiveArray<jint, JvPrimClass (int)>,
-  _Jv_JNI_NewPrimitiveArray<jlong, JvPrimClass (long)>,
-  _Jv_JNI_NewPrimitiveArray<jfloat, JvPrimClass (float)>,
-  _Jv_JNI_NewPrimitiveArray<jdouble, JvPrimClass (double)>,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_ReleasePrimitiveArrayElements,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_GetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_SetPrimitiveArrayRegion,
-  _Jv_JNI_RegisterNatives,
-  _Jv_JNI_UnregisterNatives,
-  _Jv_JNI_MonitorEnter,
-  _Jv_JNI_MonitorExit,
-  _Jv_JNI_GetJavaVM,
-
-  _Jv_JNI_GetStringRegion,
-  _Jv_JNI_GetStringUTFRegion,
-  _Jv_JNI_GetPrimitiveArrayCritical,
-  _Jv_JNI_ReleasePrimitiveArrayCritical,
-  _Jv_JNI_GetStringCritical,
-  _Jv_JNI_ReleaseStringCritical,
-
-  NOT_IMPL /* newweakglobalref */,
-  NOT_IMPL /* deleteweakglobalref */,
+                                                           // NewBooleanArray
+  _Jv_JNI_NewPrimitiveArray<jbyte, JvPrimClass (byte)>,            // NewByteArray
+  _Jv_JNI_NewPrimitiveArray<jchar, JvPrimClass (char)>,            // NewCharArray
+  _Jv_JNI_NewPrimitiveArray<jshort, JvPrimClass (short)>,   // NewShortArray
+  _Jv_JNI_NewPrimitiveArray<jint, JvPrimClass (int)>,      // NewIntArray
+  _Jv_JNI_NewPrimitiveArray<jlong, JvPrimClass (long)>,            // NewLongArray
+  _Jv_JNI_NewPrimitiveArray<jfloat, JvPrimClass (float)>,   // NewFloatArray
+  _Jv_JNI_NewPrimitiveArray<jdouble, JvPrimClass (double)>, // NewDoubleArray
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetBooleanArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetByteArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetCharArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetShortArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetIntArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetLongArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetFloatArrayElements
+  _Jv_JNI_GetPrimitiveArrayElements,       // GetDoubleArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseBooleanArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseByteArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseCharArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseShortArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseIntArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseLongArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseFloatArrayElements
+  _Jv_JNI_ReleasePrimitiveArrayElements,    // ReleaseDoubleArrayElements
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetBooleanArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetByteArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetCharArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetShortArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetIntArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetLongArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetFloatArrayRegion
+  _Jv_JNI_GetPrimitiveArrayRegion,         // GetDoubleArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetBooleanArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetByteArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetCharArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetShortArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetIntArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetLongArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetFloatArrayRegion
+  _Jv_JNI_SetPrimitiveArrayRegion,         // SetDoubleArrayRegion
+  _Jv_JNI_RegisterNatives,                 // RegisterNatives
+  _Jv_JNI_UnregisterNatives,               // UnregisterNatives
+  _Jv_JNI_MonitorEnter,                            // MonitorEnter
+  _Jv_JNI_MonitorExit,                     // MonitorExit
+  _Jv_JNI_GetJavaVM,                       // GetJavaVM
+
+  _Jv_JNI_GetStringRegion,                 // GetStringRegion
+  _Jv_JNI_GetStringUTFRegion,              // GetStringUTFRegion
+  _Jv_JNI_GetPrimitiveArrayCritical,       // GetPrimitiveArrayCritical
+  _Jv_JNI_ReleasePrimitiveArrayCritical,    // ReleasePrimitiveArrayCritical
+  _Jv_JNI_GetStringCritical,               // GetStringCritical
+  _Jv_JNI_ReleaseStringCritical,           // ReleaseStringCritical
+
+  _Jv_JNI_NewWeakGlobalRef,                // NewWeakGlobalRef
+  _Jv_JNI_DeleteWeakGlobalRef,             // DeleteWeakGlobalRef
 
   _Jv_JNI_ExceptionCheck
 };