summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-11-15 15:24:33 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-11-15 15:24:33 +0400
commitfd9236f1329dfb977de983edd7f4c2200c94927b (patch)
treee9ff875d4e90f29d9c53ef54635964d3e4d775f9
parentf35de88159cc331f5d663e047f21605006937c27 (diff)
downloadbdwgc-fd9236f1329dfb977de983edd7f4c2200c94927b.tar.gz
Remove PREFIXED in specific.c/h; mark "specific" functions as GC_INNER
* include/private/specific.h (PREFIXED): Remove. * include/private/specific.h (key_t, key_create, setspecific, remove_specific, slow_getspecific, getspecific): Expand PREFIXED macro (add "GC_" prefix). * specific.c (key_create, setspecific, remove_specific, slow_getspecific, check_tsd_marks): Likewise. * include/private/specific.h (GC_key_create, GC_setspecific, GC_remove_specific, GC_slow_getspecific): Use GC_INNER for function. * specific.c (GC_key_create, GC_setspecific, GC_remove_specific, GC_slow_getspecific): Likewise.
-rw-r--r--include/private/specific.h17
-rw-r--r--specific.c16
2 files changed, 18 insertions, 15 deletions
diff --git a/include/private/specific.h b/include/private/specific.h
index 8b5cf847..e6b1cd23 100644
--- a/include/private/specific.h
+++ b/include/private/specific.h
@@ -21,7 +21,6 @@
/* That's hard to fix, but OK if we allocate garbage */
/* collected memory. */
#define MALLOC_CLEAR(n) GC_INTERNAL_MALLOC(n, NORMAL)
-#define PREFIXED(name) GC_##name
#define TS_CACHE_SIZE 1024
#define CACHE_HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1))
@@ -65,18 +64,18 @@ typedef struct thread_specific_data {
pthread_mutex_t lock;
} tsd;
-typedef tsd * PREFIXED(key_t);
+typedef tsd * GC_key_t;
-int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *));
-int PREFIXED(setspecific) (tsd * key, void * value);
-void PREFIXED(remove_specific) (tsd * key);
+GC_INNER int GC_key_create(tsd ** key_ptr, void (* destructor)(void *));
+GC_INNER int GC_setspecific(tsd * key, void * value);
+GC_INNER void GC_remove_specific(tsd * key);
/* An internal version of getspecific that assumes a cache miss. */
-void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid,
- tse * volatile * cache_entry);
+GC_INNER void * GC_slow_getspecific(tsd * key, unsigned long qtid,
+ tse * volatile * cache_entry);
/* GC_INLINE is defined in gc_priv.h. */
-GC_INLINE void * PREFIXED(getspecific) (tsd * key)
+GC_INLINE void * GC_getspecific(tsd * key)
{
unsigned long qtid = quick_thread_id();
unsigned hash_val = CACHE_HASH(qtid);
@@ -86,5 +85,5 @@ GC_INLINE void * PREFIXED(getspecific) (tsd * key)
GC_ASSERT(entry -> thread == pthread_self());
return entry -> value;
}
- return PREFIXED(slow_getspecific) (key, qtid, entry_ptr);
+ return GC_slow_getspecific(key, qtid, entry_ptr);
}
diff --git a/specific.c b/specific.c
index 98d86c31..2f6facf7 100644
--- a/specific.c
+++ b/specific.c
@@ -26,7 +26,8 @@ static tse invalid_tse = {INVALID_QTID, 0, 0, INVALID_THREADID};
/* appear valid to a reader. Used to fill in empty */
/* cache entries to avoid a check for 0. */
-int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)) {
+GC_INNER int GC_key_create(tsd ** key_ptr, void (* destructor)(void *))
+{
int i;
tsd * result = (tsd *)MALLOC_CLEAR(sizeof(tsd));
@@ -46,7 +47,8 @@ int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)) {
return 0;
}
-int PREFIXED(setspecific) (tsd * key, void * value) {
+GC_INNER int GC_setspecific(tsd * key, void * value)
+{
pthread_t self = pthread_self();
int hash_val = HASH(self);
volatile tse * entry = (volatile tse *)MALLOC_CLEAR(sizeof (tse));
@@ -68,7 +70,8 @@ int PREFIXED(setspecific) (tsd * key, void * value) {
/* Remove thread-specific data for this thread. Should be called on */
/* thread exit. */
-void PREFIXED(remove_specific) (tsd * key) {
+GC_INNER void GC_remove_specific(tsd * key)
+{
pthread_t self = pthread_self();
unsigned hash_val = HASH(self);
tse *entry;
@@ -106,8 +109,9 @@ void PREFIXED(remove_specific) (tsd * key) {
}
/* Note that even the slow path doesn't lock. */
-void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid,
- tse * volatile * cache_ptr) {
+GC_INNER void * GC_slow_getspecific(tsd * key, unsigned long qtid,
+ tse * volatile * cache_ptr)
+{
pthread_t self = pthread_self();
unsigned hash_val = HASH(self);
tse *entry = key -> hash[hash_val];
@@ -132,7 +136,7 @@ void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid,
#ifdef GC_ASSERTIONS
/* Check that that all elements of the data structure associated */
/* with key are marked. */
- void PREFIXED(check_tsd_marks) (tsd *key)
+ void GC_check_tsd_marks(tsd *key)
{
int i;
tse *p;