From b8c3c4f0146f82c900a995c8e98b83a2147115fd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 22 Oct 1999 19:43:41 +0000 Subject: Makefile.in: Rebuilt. * Makefile.in: Rebuilt. * Makefile.am (java/lang/ClassLoader.h): New target. * java/lang/natClassLoader.cc (_Jv_FindClass): Removed reference to `redirect'. * include/java-props.h (_Jv_Compiler_Properties): Changed declaration. * gcj/array.h (JvRunMain, _Jv_RunMain): Don't declare. * include/jvm.h (_Jv_GCSetInitialHeapSize, _Jv_GCSetMaximumHeapSize): Declare. (JvRunMain, _Jv_RunMain): Declare. (_Jv_SetMaximumHeapSize, _Jv_SetInitialHeapSize): Declare. * nogc.cc (_Jv_GCSetInitialHeapSize): New function. (_Jv_GCSetMaximumHeapSize): Likewise. * boehm.cc (_Jv_GCSetInitialHeapSize): New function. (_Jv_GCSetMaximumHeapSize): Likewise. * prims.cc (parse_heap_size): New function. (_Jv_SetInitialHeapSize): Likewise. (_Jv_SetMaximumHeapSize): Likewise. (_Jv_Compiler_Properties): New global. * gij.cc (help): New function. (version): Likewise. (heap_size): Likewise. (heap_max_size): Likewise. (main): Parse arguments. Set _Jv_Compiler_Properties. Include , . (_Jv_Compiler_Properties): Removed. From-SVN: r30133 --- libjava/prims.cc | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'libjava/prims.cc') diff --git a/libjava/prims.cc b/libjava/prims.cc index e694e13..6e6c633 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -63,6 +63,9 @@ static java::lang::OutOfMemoryError *no_memory; // Largest representable size_t. #define SIZE_T_MAX ((size_t) (~ (size_t) 0)) +// Properties set at compile time. +const char **_Jv_Compiler_Properties; + #ifndef DISABLE_GETENV_PROPERTIES // Property key/value pairs. property_pair *_Jv_Environment_Properties; @@ -811,6 +814,38 @@ _Jv_RunMain (const char *class_name, int argc, const char **argv) java::lang::Runtime::getRuntime ()->exit (0); } + + +// Parse a string and return a heap size. +static size_t +parse_heap_size (const char *spec) +{ + char *end; + unsigned long val = strtoul (spec, &end, 10); + if (*spec == 'k' || *spec == 'K') + val *= 1000; + else if (*spec == 'm' || *spec == 'M') + val *= 1000000; + return (size_t) val; +} + +// Set the initial heap size. This might be ignored by the GC layer. +// This must be called before _Jv_RunMain. +void +_Jv_SetInitialHeapSize (const char *arg) +{ + size_t size = parse_heap_size (arg); + _Jv_GCSetInitialHeapSize (size); +} + +// Set the maximum heap size. This might be ignored by the GC layer. +// This must be called before _Jv_RunMain. +void +_Jv_SetMaximumHeapSize (const char *arg) +{ + size_t size = parse_heap_size (arg); + _Jv_GCSetMaximumHeapSize (size); +} @@ -885,10 +920,3 @@ _Jv_remJ (jlong dividend, jlong divisor) return dividend % divisor; } - - - - - - - -- cgit v1.1