+2009-06-12 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidanski and George Talbot)
+ (diff95_cvs)
+ * include/private/gcconfig.h (PLATFORM_ANDROID): New macro
+ recognized (for Linux on ARM32 without glibc).
+ * include/private/gcconfig.h (STRTOULL): Define for all targets
+ (define as "strtoul" for most targets except for LLP64/Win64).
+ * misc.c (GC_init_inner): Use STRTOULL instead of atoi/atol()
+ (cast the result to word type) to decode values of "GC_TRACE",
+ "GC_INITIAL_HEAP_SIZE", "GC_MAXIMUM_HEAP_SIZE" environment vars.
+
2009-06-12 Hans Boehm <Hans.Boehm@hp.com> (Really mostly George Talbot)
* include/gc_allocator.h: Add gc_allocator_ignore_off_page.
* tests/test_cpp.cc: Add call to gc_allocator_ignore_off_page.
# define CPP_WORDSZ 32 /* Is this possible? */
# endif
# define ALIGNMENT 8
-# define STRTOULL _strtoui64
# endif
# endif
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if defined(__GLIBC__) && __GLIBC__ >= 2 \
+ || defined(PLATFORM_ANDROID)
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
# define NO_GETENV
# endif
+# ifndef STRTOULL
+# if defined(_WIN64) && !defined(__GNUC__)
+# define STRTOULL _strtoui64
+# elif defined(_LLP64) || defined(__LLP64__) || defined(_WIN64)
+# define STRTOULL strtoull
+# else
+ /* strtoul() fits since sizeof(long) >= sizeof(word). */
+# define STRTOULL strtoul
+# endif
+# endif
+
# if defined(SPARC)
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */
# ifndef ENABLE_TRACE
WARN("Tracing not enabled: Ignoring GC_TRACE value\n", 0);
# else
-# ifdef STRTOULL
- word addr = (word)strtoull(addr_string, NULL, 16);
-# else
- word addr = (word)strtoul(addr_string, NULL, 16);
-# endif
+ word addr = (word)STRTOULL(addr_string, NULL, 16);
if (addr < 0x1000)
WARN("Unlikely trace address: %p\n", addr);
GC_trace_addr = (ptr_t)addr;
{
char * sz_str = GETENV("GC_INITIAL_HEAP_SIZE");
if (sz_str != NULL) {
- initial_heap_sz = atoi(sz_str);
+ initial_heap_sz = (word)STRTOULL(sz_str, NULL, 10);
if (initial_heap_sz <= MINHINCR * HBLKSIZE) {
WARN("Bad initial heap size %s - ignoring it.\n",
sz_str);
{
char * sz_str = GETENV("GC_MAXIMUM_HEAP_SIZE");
if (sz_str != NULL) {
- word max_heap_sz = (word)atol(sz_str);
+ word max_heap_sz = (word)STRTOULL(sz_str, NULL, 10);
if (max_heap_sz < initial_heap_sz * HBLKSIZE) {
WARN("Bad maximum heap size %s - ignoring it.\n",
sz_str);