From b6121641fcd1aad93643d1f56440217ee9dc1c1c Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sat, 2 Apr 2005 02:26:51 +0000 Subject: re PR libgcj/20090 (gij should be implemented in Java) 2005-04-01 Thomas Fitzsimmons * gcj.texi (Invoking gij): Add descriptions of new -X options. Mention recognized-and-ignored compatibility options. (Memory allocation): Add descriptions of JvMalloc, JvRealloc and JvFree. (About CNI): Add Memory allocation section. 2005-04-01 Thomas Fitzsimmons PR libgcj/20090, PR libgcj/20526 * gij.cc (nonstandard_opts_help): New function. (add_option): New function. (main): Support java options. Set java.class.path. Don't set _Jv_Jar_Class_Path. * prims.cc (parse_x_arg): New function. (parse_init_args): Call parse_x_arg for -X and _ options, when ignoreUnrecognized is true. (new _Jv_RunMain): New vm_args variant. (old _Jv_RunMain): Call new vm_args _Jv_RunMain. (_Jv_Jar_Class_Path): Remove variable. * include/java-props.h: Likewise. * include/cni.h (JvRealloc): New function. * include/jvm.h (_Jv_RunMain): Declare vm_args variant. * java/lang/natRuntime.cc (insertSystemProperties): Remove _Jv_Jar_Class_Path logic. Use JV_VERSION and JV_API_VERSION macros. * configure.ac (JV_VERSION): Define. (JV_API_VERSION): Likewise. * configure: Regenerate. * include/config.h.in: Regenerate. From-SVN: r97429 --- gcc/java/ChangeLog | 8 ++++++++ gcc/java/gcj.texi | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) (limited to 'gcc/java') diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 773a5fc..e45415e 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2005-04-01 Thomas Fitzsimmons + + * gcj.texi (Invoking gij): Add descriptions of new -X options. + Mention recognized-and-ignored compatibility options. + (Memory allocation): Add descriptions of JvMalloc, JvRealloc and + JvFree. + (About CNI): Add Memory allocation section. + 2005-04-01 Tom Tromey * decl.c (java_init_decl_processing): Fix types of diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi index df693c0..e71511a 100644 --- a/gcc/java/gcj.texi +++ b/gcc/java/gcj.texi @@ -949,16 +949,26 @@ be retrieved at runtime using the @code{java.lang.System.getProperty} method. @item -ms=@var{number} -This sets the initial heap size. +Equivalent to @code{-Xms}. @item -mx=@var{number} -This sets the maximum heap size. +Equivalent to @code{-Xmx}. @item -X @itemx -X@var{argument} Supplying @code{-X} by itself will cause @code{gij} to list all the -supported @code{-X} options. Currently there are none. Unrecognized -@code{-X} options are ignored, for compatibility with other runtimes. +supported @code{-X} options. Currently these options are supported: + +@table @gcctabopt +@item -Xms@var{size} +Set the initial heap size. + +@item -Xmx@var{size} +Set the maximum heap size. +@end table + +Unrecognized @code{-X} options are ignored, for compatibility with +other runtimes. @item -jar This indicates that the name passed to @code{gij} should be interpreted @@ -971,6 +981,9 @@ Print help, then exit. @item --showversion Print version number and continue. +@item --fullversion +Print detailed version information, then exit. + @item --version Print version number, then exit. @@ -979,6 +992,12 @@ Print version number, then exit. Each time a class is initialized, print a short message on standard error. @end table +@code{gij} also recognizes and ignores the following options, for +compatibility with existing application launch scripts: +@code{-client}, @code{-server}, @code{-hotspot}, @code{-jrockit}, +@code{-agentlib}, @code{-agentpath}, @code{-debug}, @code{-d32}, +@code{-d64}, @code{-javaagent} and @code{-noclassgc}. + @c man end @node Invoking gcj-dbtool @@ -1250,6 +1269,7 @@ alternative to the standard JNI (Java Native Interface). * Objects and Classes:: C++ and Java classes. * Class Initialization:: How objects are initialized. * Object allocation:: How to create Java objects in C++. +* Memory allocation:: How to allocate and free memory. * Arrays:: Dealing with Java arrays in C++. * Methods:: Java methods in C++. * Strings:: Information about Java Strings. @@ -1630,6 +1650,27 @@ java::util::Hashtable *ht = new java::util::Hashtable(120); @end example +@node Memory allocation +@section Memory allocation + +When allocting memory in @acronym{CNI} methods it is best to handle +out-of-memory conditions by throwing a Java exception. These +functions are provided for that purpose: + +@deftypefun void* JvMalloc (jsize @var{size}) +Calls malloc. Throws @code{java.lang.OutOfMemoryError} if allocation +fails. +@end deftypefun + +@deftypefun void* JvRealloc (void* @var{ptr}, jsize @var{size}) +Calls realloc. Throws @code{java.lang.OutOfMemoryError} if +reallocation fails. +@end deftypefun + +@deftypefun void JvFree (void* @var{ptr}) +Calls free. +@end deftypefun + @node Arrays @section Arrays -- cgit v1.1