summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-02-10 00:49:33 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:42 +0400
commit00a92ef4bd6b34b870df0e651e8dbf5fd600b262 (patch)
treebf48cf4b0180f2e7b87009ea4b4c4bcb079883be
parent0ca3e850f03fa5b4e1ac333b3f67908e7b63b451 (diff)
downloadbdwgc-00a92ef4bd6b34b870df0e651e8dbf5fd600b262.tar.gz
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.
-rw-r--r--ChangeLog12
-rw-r--r--include/gc.h8
-rw-r--r--include/private/gc_locks.h4
-rw-r--r--include/private/gc_pmark.h5
-rw-r--r--misc.c6
-rw-r--r--os_dep.c2
-rw-r--r--win32_threads.c4
7 files changed, 27 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index ff04f5c5..a9194f75 100644
--- 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:
diff --git a/include/gc.h b/include/gc.h
index 14bfa4c3..529481f2 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -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. */
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h
index d7c83b07..57c7c416 100644
--- a/include/private/gc_locks.h
+++ b/include/private/gc_locks.h
@@ -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)
diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h
index 1558dd39..81c260be 100644
--- a/include/private/gc_pmark.h
+++ b/include/private/gc_pmark.h
@@ -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 bcaab3f4..3b431035 100644
--- 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;
diff --git a/os_dep.c b/os_dep.c
index cba653b2..fbcd15d8 100644
--- 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);
diff --git a/win32_threads.c b/win32_threads.c
index 4805a5b8..3d9806ea 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -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();