]> granicus.if.org Git - gc/commitdiff
2008-02-08 Hans Boehm <Hans.Boehm@hp.com>
authorhboehm <hboehm>
Sun, 10 Feb 2008 00:49:33 +0000 (00:49 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:42 +0000 (21:06 +0400)
* misc.c (GC_init_inner): Assert !GC_need_to_lock only when
defined.  (GC_call_with_stack_base): Add GC_API.
* os_dep.c (GC_get_stack_base): Add GC_API.
* win32_threads.c: (GC_register_my_thread, GC_unregister_my_thread):
Add GC_API.
* include/gc.h: Add GC_API annotations.
* include/private/gc_locks.h: Define UNCOND_LOCK etc. also for
PCR.
* include/private/gc_pmark.h: Fix comments.

ChangeLog
include/gc.h
include/private/gc_locks.h
include/private/gc_pmark.h
misc.c
os_dep.c
win32_threads.c

index ff04f5c55c20609162345925bf87fdffb5f18510..a9194f75296c19523774b1e56cffb063f0256b6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-02-08  Hans Boehm <Hans.Boehm@hp.com>
+
+       * misc.c (GC_init_inner): Assert !GC_need_to_lock only when
+       defined.  (GC_call_with_stack_base): Add GC_API.
+       * os_dep.c (GC_get_stack_base): Add GC_API.
+       * win32_threads.c: (GC_register_my_thread, GC_unregister_my_thread):
+       Add GC_API.
+       * include/gc.h: Add GC_API annotations.
+       * include/private/gc_locks.h: Define UNCOND_LOCK etc. also for
+       PCR.
+       * include/private/gc_pmark.h: Fix comments.
+
 2008-02-06  Hans Boehm <Hans.Boehm@hp.com> (mostly from Henning Makholm)
 
        * include/private/gc_priv.h, mark_rts.c, typd_mlc.c:
index 14bfa4c3b8fc288dd8063a0ada4dc9781a4eb1be..529481f25e76f71b9ef2e02325a6f063159a6ca9 100644 (file)
@@ -856,7 +856,7 @@ typedef void * (*GC_stack_base_func)(struct GC_stack_base *sb, void *arg);
 /* somewhere in the GC_call_with_stack_base frame.  This often can     */
 /* be used to provide a sufficiently accurate stack base.  And we      */
 /* implement it everywhere.                                            */
-void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg);
+GC_API void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg);
 
 /* Register the current thread, with the indicated stack base, as      */
 /* a new thread whose stack(s) should be traced by the GC.  If a       */
@@ -869,7 +869,7 @@ void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg);
 #define GC_DUPLICATE 1 /* Was already registered.      */
 #define GC_NO_THREADS 2        /* No thread support in GC.     */
 #define GC_UNIMPLEMENTED 3     /* Not yet implemented on this platform. */
-int GC_register_my_thread(struct GC_stack_base *);
+GC_API int GC_register_my_thread(struct GC_stack_base *);
 
 /* Unregister the current thread.  The thread may no longer allocate   */
 /* garbage collected memory or manipulate pointers to the              */
@@ -878,7 +878,7 @@ int GC_register_my_thread(struct GC_stack_base *);
 /* pointer to the garbage-collected heap to another thread, it must    */
 /* do this before calling GC_unregister_my_thread, most probably       */
 /* by saving it in a global data structure.                            */
-int GC_unregister_my_thread(void);
+GC_API int GC_unregister_my_thread(void);
 
 /* Attempt to fill in the GC_stack_base structure with the stack base  */
 /* for this thread.  This appears to be required to implement anything */
@@ -886,7 +886,7 @@ int GC_unregister_my_thread(void);
 /* threads are not automatically registered with the collector.                */
 /* It is also unfortunately hard to implement well on many platforms.  */
 /* Returns GC_SUCCESS or GC_UNIMPLEMENTED.                             */
-int GC_get_stack_base(struct GC_stack_base *);
+GC_API int GC_get_stack_base(struct GC_stack_base *);
 
 /* The following routines are primarily intended for use with a        */
 /* preprocessor which inserts calls to check C pointer arithmetic.     */
index d7c83b07b9129ea6ab604a456df04a83479a867c..57c7c4160b32b5a540c5445927360daeba114edb 100644 (file)
@@ -36,8 +36,8 @@
      extern PCR_Th_ML GC_allocate_ml;
 #    define DCL_LOCK_STATE \
         PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask
-#    define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
-#    define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
+#    define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
+#    define UNCOND_UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
 #  endif
 
 #  if !defined(AO_HAVE_test_and_set_acquire) && defined(GC_PTHREADS)
index 1558dd39a21fabdc3fe966d5552ea49927c1e03e..81c260be31be01655129ede82e986ef90879f198 100644 (file)
@@ -60,10 +60,9 @@ extern unsigned GC_n_mark_procs;
 #define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8)
 
 typedef struct GC_ms_entry {
-    ptr_t mse_start;   /* First word of object */
+    ptr_t mse_start;   /* First word of object, word aligned  */
     GC_word mse_descr; /* Descriptor; low order two bits are tags,     */
-                       /* identifying the upper 30 bits as one of the  */
-                       /* following:                                   */
+                       /* as described in gc_mark.h.                   */
 } mse;
 
 extern size_t GC_mark_stack_size;
diff --git a/misc.c b/misc.c
index bcaab3f43c8a025cf4b113b094021f189b3a1db0..3b4310352d30aca312c1df83227e6a1de791cb0f 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -483,7 +483,9 @@ void GC_init_inner()
     /* And the initialization code needs to run before     */
     /* then.  Thus we really don't hold any locks, and can */
     /* in fact safely initialize them here.               */
-    GC_ASSERT(!GC_need_to_lock);
+#   ifdef THREADS
+      GC_ASSERT(!GC_need_to_lock);
+#   endif
 #   if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS)
       if (!GC_is_initialized) {
         BOOL (WINAPI *pfn) (LPCRITICAL_SECTION, DWORD) = NULL;
@@ -1146,7 +1148,7 @@ unsigned GC_new_proc(GC_mark_proc proc)
     return result;
 }
 
-void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg)
+GC_API void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg)
 {
     int dummy;
     struct GC_stack_base base;
index cba653b2b50bd5f0c2bc11f64ff862947964f947..fbcd15d85a5bda3bd1131bc527a760e271e8315b 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -752,7 +752,7 @@ word GC_get_writable_length(ptr_t p, ptr_t *base)
     return(buf.RegionSize);
 }
 
-int GC_get_stack_base(struct GC_stack_base *sb)
+GC_API int GC_get_stack_base(struct GC_stack_base *sb)
 {
     int dummy;
     ptr_t sp = (ptr_t)(&dummy);
index 4805a5b8aa2f3e90517482fd24c1d4485c881542..3d9806ea3543c785f28f7c0e4ff951c140f15033 100644 (file)
@@ -559,7 +559,7 @@ void GC_delete_thread(DWORD id)
   }
 }
 
-int GC_register_my_thread(struct GC_stack_base *sb) {
+GC_API int GC_register_my_thread(struct GC_stack_base *sb) {
   DWORD t = GetCurrentThreadId();
 
   if (0 == GC_lookup_thread(t)) {
@@ -573,7 +573,7 @@ int GC_register_my_thread(struct GC_stack_base *sb) {
   }
 }
 
-int GC_unregister_my_thread(void)
+GC_API int GC_unregister_my_thread(void)
 {
     DWORD t = GetCurrentThreadId();