Skip to content

Commit

Permalink
Change type of size arguments of GC_register_altstack from word to si…
Browse files Browse the repository at this point in the history
…ze_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.
  • Loading branch information
ivmai committed Apr 15, 2024
1 parent 10af6eb commit 4236271
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/gc/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down
8 changes: 4 additions & 4 deletions include/private/pthread_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pthread_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 4236271

Please sign in to comment.