diff options
author | Geoff Norton <grompf@gmail.com> | 2011-08-03 05:45:49 +0400 |
---|---|---|
committer | Geoff Norton <grompf@gmail.com> | 2011-08-03 05:45:49 +0400 |
commit | 7f799370ec85fb9d5a539b05b084eae4ca6956ed (patch) | |
tree | 459f291ae73108d880a3118781c8572211bc0dd0 /libgc | |
parent | 5fc5f02c461b45fdf562993591289ea003578ec4 (diff) |
[gc] Darwin/AMD64 can have 64-bit thread id's, so we need to ensure
we cast properly to make sure the modulus has a valid result.
Additionally add support for x86_THREAD_STATE64.
Diffstat (limited to 'libgc')
-rw-r--r-- | libgc/include/private/gc_priv.h | 2 | ||||
-rw-r--r-- | libgc/pthread_support.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libgc/include/private/gc_priv.h b/libgc/include/private/gc_priv.h index d1993d44259..da49c0a4952 100644 --- a/libgc/include/private/gc_priv.h +++ b/libgc/include/private/gc_priv.h @@ -371,6 +371,8 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES])); # define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE # elif defined(I386) # define GC_MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE +# elif defined(X86_64) +# define GC_MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64 # else # define GC_MACH_THREAD_STATE_FLAVOR MACHINE_THREAD_STATE # endif diff --git a/libgc/pthread_support.c b/libgc/pthread_support.c index 3e588ace211..96e8a011b2c 100644 --- a/libgc/pthread_support.c +++ b/libgc/pthread_support.c @@ -729,7 +729,7 @@ void nacl_shutdown_gc_thread() /* Caller holds allocation lock. */ GC_thread GC_new_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; GC_thread result; static GC_bool first_thread_used = FALSE; @@ -760,7 +760,7 @@ GC_thread GC_new_thread(pthread_t id) /* Caller holds allocation lock. */ void GC_delete_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; @@ -796,7 +796,7 @@ void GC_delete_thread(pthread_t id) /* This is OK, but we need a way to delete a specific one. */ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; @@ -825,7 +825,7 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id) /* return the most recent one. */ GC_thread GC_lookup_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next; |