From bc71e4a22b8d2b894a283f34974aeba11a28bb96 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Wed, 23 Feb 2005 17:36:26 +0000 Subject: re PR libgcj/16923 (-D* Options passed to JNI_CreateJavaVM are ignored) 2005-02-23 Thomas Fitzsimmons PR libgcj/16923 * gcj.texi (Invocation): Add descriptions of JvVMInitArgs and JvVMOption. 2005-02-23 Thomas Fitzsimmons PR libgcj/16923 * jni.cc (JNI_CreateJavaVM): Check JNI version. Cast args to JvVMInitArgs. Pass args to _Jv_CreateJavaVM and check return value. Move argument parsing code to prims.cc. * prims.cc (no_properties): Remove. (_Jv_Compiler_Properties): Initialize to NULL. (_Jv_Properties_Count): Initialize to 0. (parse_verbose_args): New function. (parse_init_args): New function. (_Jv_CreateJavaVM): Call parse_init_args. (_Jv_RunMain): Check return value of _Jv_CreateJavaVM. * gcj/cni.h (JvVMOption): New struct. (JvVMInitArgs): Likewise. (JvCreateJavaVM): Declare vm_args as JvVMInitArgs* rather than void*. * libjava/gcj/javaprims.h (_Jv_VMOption): New struct. (_Jv_VMInitArgs): Likewise. * include/java-props.h (_Jv_Properties_Count): Declare. * java/lang/natRuntime.cc (insertSystemProperties): Use _Jv_Properties_Count in for loop exit condition. * testsuite/libjava.jni/jni.exp (gcj_invocation_compile_c_to_binary): New procedure. (gcj_invocation_test_one): Likewise. (gcj_jni_run): Run JNI invocation API tests. * testsuite/libjava.jni/invocation/PR16923.c, testsuite/libjava.jni/invocation/PR16923.java, testsuite/libjava.jni/invocation/PR16923.out: New test. From-SVN: r95459 --- gcc/java/ChangeLog | 6 ++++++ gcc/java/gcj.texi | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 54dc009..5f9cd4a 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2005-02-23 Thomas Fitzsimmons + + PR libgcj/16923 + * gcj.texi (Invocation): Add descriptions of JvVMInitArgs and + JvVMOption. + 2005-02-22 Tom Tromey PR java/20056: diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi index 6853156..b270b6f 100644 --- a/gcc/java/gcj.texi +++ b/gcc/java/gcj.texi @@ -2110,7 +2110,8 @@ CNI permits C++ applications to make calls into Java classes, in addition to allowing Java code to call into C++. Several functions, known as the @dfn{invocation API}, are provided to support this. -@deftypefun jint JvCreateJavaVM (void* @var{vm_args}) +@deftypefun jint JvCreateJavaVM (JvVMInitArgs* @var{vm_args}) + Initializes the Java runtime. This function performs essential initialization of the threads interface, garbage collector, exception handling and other key aspects of the runtime. It must be called once by an application with @@ -2119,11 +2120,40 @@ It is safe, but not recommended, to call @code{JvCreateJavaVM()} more than once provided it is only called from a single thread. The @var{vmargs} parameter can be used to specify initialization parameters for the Java runtime. It may be @code{NULL}. -This function returns @code{0} upon success, or @code{-1} if the runtime is -already initialized. -@emph{Note:} In GCJ 3.1, the @code{vm_args} parameter is ignored. It may be -used in a future release. +JvVMInitArgs represents a list of virtual machine initialization +arguments. @code{JvCreateJavaVM()} ignores the version field. + +@example +typedef struct JvVMOption +@{ + // a VM initialization option + char* optionString; + // extra information associated with this option + void* extraInfo; +@} JvVMOption; + +typedef struct JvVMInitArgs +@{ + // for compatibility with JavaVMInitArgs + jint version; + + // number of VM initialization options + jint nOptions; + + // an array of VM initialization options + JvVMOption* options; + + // true if the option parser should ignore unrecognized options + jboolean ignoreUnrecognized; +@} JvVMInitArgs; +@end example + +@code{JvCreateJavaVM()} returns @code{0} upon success, or @code{-1} if +the runtime is already initialized. + +@emph{Note:} In GCJ 3.1, the @code{vm_args} parameter is ignored. It +is recognized and used as of release 4.0. @end deftypefun @deftypefun java::lang::Thread* JvAttachCurrentThread (jstring @var{name}, java::lang::ThreadGroup* @var{group}) -- cgit v1.1