]> granicus.if.org Git - gc/commitdiff
2009-06-12 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidanski and George Talbot)
authorhboehm <hboehm>
Fri, 12 Jun 2009 18:59:14 +0000 (18:59 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:45 +0000 (21:06 +0400)
(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.

ChangeLog
include/private/gcconfig.h
misc.c

index 8783963cb6a34aaec65fa6a6b91ec9690e74df55..07f7a184f6c7f1b20089bf9c6b218d41599acb56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
index 98d61f9e8b1b1806a438407f90010f123c9ca1cb..75190dd2e55b59bd8764f4048e14c8a6b1c7d470 100644 (file)
 #       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. */
diff --git a/misc.c b/misc.c
index 957c6ef49a902172c52dab3a4322b6a1f2523561..9bb8a165cde04d6ef56e5dda9058d49eccfebb7a 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -578,11 +578,7 @@ void GC_init_inner(void)
 #       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;
@@ -717,7 +713,7 @@ void GC_init_inner(void)
     {
        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);
@@ -728,7 +724,7 @@ void GC_init_inner(void)
     {
        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);