From 4236271b2a9d300a2e670dad5cf2ef5f5927869d Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 14 Apr 2024 23:27:44 +0300 Subject: [PATCH] Change type of size arguments of GC_register_altstack from word to size_t Issue #627 (bdwgc). * include/gc/gc.h [GC_THREADS] (GC_register_altstack): Change type of normstack_size and altstack_size arguments from GC_word to size_t. * pthread_support.c [!GC_WIN32_THREADS] (GC_register_altstack): Likewise. * include/private/pthread_support.h [!GC_WIN32_THREADS] (GC_StackContext_Rep): Reorder normstack and altstack_size fields. * include/private/pthread_support.h [!GC_WIN32_THREADS] (GC_StackContext_Rep.altstack_size, GC_StackContext_Rep.normstack): Change type from word to size_t. --- include/gc/gc.h | 4 ++-- include/private/pthread_support.h | 8 ++++---- pthread_support.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/gc/gc.h b/include/gc/gc.h index 860739271..3a69ed69f 100644 --- a/include/gc/gc.h +++ b/include/gc/gc.h @@ -1740,9 +1740,9 @@ GC_API void GC_CALL GC_start_mark_threads(void); /* while it is on an alt-stack. Acquires the allocator lock in the */ /* reader mode. */ GC_API void GC_CALL GC_register_altstack(void * /* normstack */, - GC_word /* normstack_size */, + size_t /* normstack_size */, void * /* altstack */, - GC_word /* altstack_size */); + size_t /* altstack_size */); /* Unregister the current thread. Only an explicitly registered */ /* thread (i.e. for which GC_register_my_thread() returns GC_SUCCESS) */ diff --git a/include/private/pthread_support.h b/include/private/pthread_support.h index 31dda8da5..1550f6cc6 100644 --- a/include/private/pthread_support.h +++ b/include/private/pthread_support.h @@ -89,10 +89,10 @@ typedef struct GC_StackContext_Rep { # else ptr_t altstack; /* The start of the alt-stack if there */ /* is one, NULL otherwise. */ - word altstack_size; /* The size of the alt-stack if exists. */ - ptr_t normstack; /* The start and size of the "normal" */ - /* stack (set by GC_register_altstack). */ - word normstack_size; + ptr_t normstack; /* Same for the "normal" stack (set by */ + /* GC_register_altstack). */ + size_t altstack_size; /* The size of the alt-stack if exists. */ + size_t normstack_size; # endif # ifdef E2K diff --git a/pthread_support.c b/pthread_support.c index d04cd7367..018a8538c 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -932,7 +932,8 @@ GC_API int GC_CALL GC_thread_is_registered(void) } GC_API void GC_CALL GC_register_altstack(void *normstack, - GC_word normstack_size, void *altstack, GC_word altstack_size) + size_t normstack_size, + void *altstack, size_t altstack_size) { #ifdef GC_WIN32_THREADS /* TODO: Implement */