You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/04 10:52:29 UTC

svn commit: r811290 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_vm.h test/testsuite.c

Author: mturk
Date: Fri Sep  4 08:52:29 2009
New Revision: 811290

URL: http://svn.apache.org/viewvc?rev=811290&view=rev
Log:
Add JNI invocation API function prototypes

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_vm.h
    commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_vm.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_vm.h?rev=811290&r1=811289&r2=811290&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_vm.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_vm.h Fri Sep  4 08:52:29 2009
@@ -32,6 +32,36 @@
  */
 
 /**
+ * @brief
+ * JVM invocation API prototypes.
+ * Function pointers are loaded from JVM DSO at runtime.
+ */
+
+/**
+ * Returns a default configuration for the Java VM.
+ * Before calling this function, native code must set the vm_args->version
+ * field to the JNI version it expects the VM to support.
+ * After this function returns, vm_args->version will be set to the actual
+ * JNI version the VM supports.
+ */
+typedef jint (JNICALL *fpJNI_GetDefaultJavaVMInitArgs)(void *);
+
+/**
+ * Loads and initializes a Java VM. The current thread becomes
+ * the main thread. Sets the env argument to the JNI interface pointer
+ * of the main thread.
+ */
+typedef jint (JNICALL *fpJNI_CreateJavaVM)(JavaVM **, void **, void *);
+
+/**
+ * Returns all Java VMs that have been created.
+ * Pointers to VMs are written in the buffer vmBuf in the order they
+ * are created. At most bufLen number of entries will be written.
+ * The total number of created VMs is returned in *nVMs.
+ */
+typedef jint (JNICALL *fpJNI_GetCreatedJavaVMs)(JavaVM **, jsize, jsize *);
+
+/**
  * Get current thread JNI Environment
  * @remark The function will attach to the
  * current JVM thread. This function must be called to obtain the JNIEnv
@@ -41,7 +71,10 @@
 ACR_DECLARE(JNIEnv *) ACR_GetJNIEnv(void);
 
 /**
- * Initialize the ACR
+ * Initialize the ACR.
+ * @param vm Java Virtual Machine instance or NULL if not created yet.
+ * @note The function can be called multiple times depending on the way
+ *       how the ACR is initialized.
  */
 ACR_DECLARE(int) ACR_Initialize(JavaVM *vm);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c?rev=811290&r1=811289&r2=811290&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Fri Sep  4 08:52:29 2009
@@ -19,7 +19,6 @@
 #include "acr.h"
 #include "acr_private.h"
 #include "acr_arch.h"
-#define  ACR_WANT_MEMPROTECT
 #include "acr_error.h"
 #include "acr_string.h"
 #include "acr_memory.h"
@@ -141,9 +140,9 @@
     return 0;
 }
 
-static jint (JNICALL *jni_GetDefaultJavaVMInitArgs)(void *) = NULL;
-static jint (JNICALL *jni_CreateJavaVM)(JavaVM **, void **, void *) = NULL;
-static jint (JNICALL *jni_GetCreatedJavaVMs)(JavaVM **, jsize, jsize *) = NULL;
+static fpJNI_GetDefaultJavaVMInitArgs jni_GetDefaultJavaVMInitArgs = NULL;
+static fpJNI_CreateJavaVM             jni_CreateJavaVM = NULL;
+static fpJNI_GetCreatedJavaVMs        jni_GetCreatedJavaVMs = NULL;
 
 /* Call with something like:
  * ./testsuite -t jvm -- /opt/java/jre/lib/amd64/server/libjvm.so \