/* 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))
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);
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);
}
/* 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));
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));
/* 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;
}
/* 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];
#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;