]> granicus.if.org Git - gc/commitdiff
2011-02-10 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sat, 12 Feb 2011 15:02:35 +0000 (15:02 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:56 +0000 (21:06 +0400)
* NT_MAKEFILE: Define _CRT_SECURE_NO_DEPRECATE for C++ files as
well.
* NT_STATIC_THREADS_MAKEFILE: Ditto.
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Refine.
* include/gc.h (GC_INIT): Document.
* include/private/gc_priv.h (GC_MACH_HEADER, GC_MACH_SECTION,
GC_GETSECTBYNAME): Define depending only on the word size (i.e.,
define these macros also for ARM).
* tests/test.c (check_heap_stats): Print main thread stack bottom
as well (only if verbose mode is on).

ChangeLog
NT_MAKEFILE
NT_STATIC_THREADS_MAKEFILE
doc/README.macros
include/gc.h
include/private/gc_priv.h
tests/test.c

index 42d3ff236298336ab0aa6587e9baa93ecf97198c..ab5224930b1339a6ac0311cb5951a10f4443287b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-02-10  Ivan Maidanski  <ivmai@mail.ru>
+
+       * NT_MAKEFILE: Define _CRT_SECURE_NO_DEPRECATE for C++ files as
+       well.
+       * NT_STATIC_THREADS_MAKEFILE: Ditto.
+       * doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Refine.
+       * include/gc.h (GC_INIT): Document.
+       * include/private/gc_priv.h (GC_MACH_HEADER, GC_MACH_SECTION,
+       GC_GETSECTBYNAME): Define depending only on the word size (i.e.,
+       define these macros also for ARM).
+       * tests/test.c (check_heap_stats): Print main thread stack bottom
+       as well (only if verbose mode is on).
+
 2011-02-09  Ivan Maidanski  <ivmai@mail.ru> (mostly Jean-Claude Beaudoin)
 
        * mach_dep.c (GC_with_callee_saves_pushed): Fix and improve code
index e454b0b0174286c4717f1a82fa3d53c596a09a35..f9077a3de1a3e57ff01af1f6989a318823cd0d39 100644 (file)
@@ -18,7 +18,7 @@ all: gctest.exe cord\de.exe test_cpp.exe
        $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj
 
 .cpp.obj:
-       $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP /Fo$*.obj
+       $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -D_CRT_SECURE_NO_DEPRECATE $*.CPP /Fo$*.obj
 
 $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\private\msvc_dbg.h
 
index dfcc7c6a4107999a58eb37504ce5aafc779c3e8c..6892d291111012015c014e03a96738a23644aef2 100644 (file)
@@ -25,7 +25,7 @@ all: gctest.exe cord\de.exe test_cpp.exe
        $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj
 
 .cpp.obj:
-       $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_THREADS -DTHREAD_LOCAL_ALLOC /Fo$*.obj
+       $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE $*.cpp /Fo$*.obj
 
 $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\private\msvc_dbg.h
 
index c1d8aea6f604c1c1a5fdfff140666fb719d95efe..6e9ebd8b500de9530d3089b12a47ef45577162be 100644 (file)
@@ -529,5 +529,6 @@ PLATFORM_ANDROID        Compile for Android NDK platform.
 SN_TARGET_PS3           Compile for Sony PS/3.
 
 USE_GET_STACKBASE_FOR_MAIN (Linux only)  Use pthread_attr_getstack() instead
-of __libc_stack_end for getting the primordial thread stack base (useful if
-the client modifies the program's address space).
+of __libc_stack_end (or instead of any hard-coded value) for getting the
+primordial thread stack base (useful if the client modifies the program's
+address space).
index 6a3f9ec93f07ddcef573bbd5eed554b5236e466a..d90ba5c5653c00eacd4ff5b4b8d11ab4d0ccbf12 100644 (file)
@@ -1436,6 +1436,9 @@ GC_API int GC_CALL GC_get_force_unmap_on_gcollect(void);
 # define GC_INIT_CONF_INITIAL_HEAP_SIZE /* empty */
 #endif
 
+/* Portable clients should call this at the program start-up.  More     */
+/* over, some platforms require this call to be done strictly from the  */
+/* primordial thread.                                                   */
 #define GC_INIT() { GC_INIT_CONF_DONT_EXPAND; /* pre-init */ \
                     GC_INIT_CONF_FORCE_UNMAP_ON_GCOLLECT; \
                     GC_INIT_CONF_MAX_RETRIES; \
index a10080aa65000ec93532058dba9462b1a7ba84e4..556cf60f19d43e7fc9f6f834a3f9fc2bd8e0806e 100644 (file)
@@ -473,32 +473,20 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
 #     define GC_THREAD_STATE_T          ppc_thread_state_t
 #     define GC_MACH_THREAD_STATE       PPC_THREAD_STATE
 #     define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
-#     define GC_MACH_HEADER             mach_header
-#     define GC_MACH_SECTION            section
-#     define GC_GETSECTBYNAME           getsectbynamefromheader
 #   else
 #     define GC_THREAD_STATE_T          ppc_thread_state64_t
 #     define GC_MACH_THREAD_STATE       PPC_THREAD_STATE64
 #     define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
-#     define GC_MACH_HEADER             mach_header_64
-#     define GC_MACH_SECTION            section_64
-#     define GC_GETSECTBYNAME           getsectbynamefromheader_64
 #   endif
 # elif defined(I386) || defined(X86_64)
 #   if CPP_WORDSZ == 32
 #     define GC_THREAD_STATE_T          x86_thread_state32_t
 #     define GC_MACH_THREAD_STATE       x86_THREAD_STATE32
 #     define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
-#     define GC_MACH_HEADER             mach_header
-#     define GC_MACH_SECTION            section
-#     define GC_GETSECTBYNAME           getsectbynamefromheader
 #   else
 #     define GC_THREAD_STATE_T          x86_thread_state64_t
 #     define GC_MACH_THREAD_STATE       x86_THREAD_STATE64
 #     define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
-#     define GC_MACH_HEADER             mach_header_64
-#     define GC_MACH_SECTION            section_64
-#     define GC_GETSECTBYNAME           getsectbynamefromheader_64
 #   endif
 # else
 #   if defined(ARM32)
@@ -509,6 +497,17 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
 #   define GC_MACH_THREAD_STATE         MACHINE_THREAD_STATE
 #   define GC_MACH_THREAD_STATE_COUNT   MACHINE_THREAD_STATE_COUNT
 # endif
+
+# if CPP_WORDSZ == 32
+#   define GC_MACH_HEADER   mach_header
+#   define GC_MACH_SECTION  section
+#   define GC_GETSECTBYNAME getsectbynamefromheader
+# else
+#   define GC_MACH_HEADER   mach_header_64
+#   define GC_MACH_SECTION  section_64
+#   define GC_GETSECTBYNAME getsectbynamefromheader_64
+# endif
+
   /* Try to work out the right way to access thread state structure     */
   /* members.  The structure has changed its definition in different    */
   /* Darwin versions.  This now defaults to the (older) names           */
index 11816706a1581fb9b349b412b31346689c119da2..d8cf4f68afec4a4ee746733797569b96f18ff8e7 100644 (file)
@@ -1284,6 +1284,10 @@ void check_heap_stats(void)
 #   endif
                 GC_invoke_finalizers();
       }
+      if (GC_print_stats) {
+          GC_log_printf("Primordial thread stack bottom: %p\n",
+                        GC_stackbottom);
+      }
     (void)GC_printf("Completed %u tests\n", n_tests);
     (void)GC_printf("Allocated %d collectable objects\n", collectable_count);
     (void)GC_printf("Allocated %d uncollectable objects\n",