]> granicus.if.org Git - gc/commitdiff
Remove PREFIXED in specific.c/h; mark "specific" functions as GC_INNER
authorIvan Maidanski <ivmai@mail.ru>
Tue, 15 Nov 2011 11:24:33 +0000 (15:24 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 15 Nov 2011 11:24:33 +0000 (15:24 +0400)
* 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.

include/private/specific.h
specific.c

index 8b5cf847713d25403568a5fab442bb61550938d1..e6b1cd23574845b6ee206d359d70434462187eb1 100644 (file)
@@ -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);
 }
index 98d86c3101fd1ddb5ec78f841a30d6565e0ac7c1..2f6facf76f329ff13d022cfd83a7c0ab39bb8e7f 100644 (file)
@@ -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;