Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce SetExtraMarkFuncBags #2706

Merged
merged 1 commit into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/gasman.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,17 @@ void FinishBags( void )
** in global variables. It also allocates the initial workspace, and sets up
** the linked list of available masterpointer.
*/
TNumExtraMarkFuncBags ExtraMarkFuncBags;

static Bag * StackBottomBags;

static UInt StackAlignBags;

static TNumExtraMarkFuncBags ExtraMarkFuncBags;
void SetExtraMarkFuncBags(TNumExtraMarkFuncBags func)
{
ExtraMarkFuncBags = func;
}


void InitBags (
UInt initial_size,
Bag * stack_bottom,
Expand Down
8 changes: 6 additions & 2 deletions src/gasman.h
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,12 @@ extern void InitCollectFuncBags (
TNumCollectFuncBags after_func );
#endif

// ExtraMarkFuncBags, if not NULL, is called during garbage collection
// This is used for integrating GAP (possibly linked as a shared library) with
// other code bases which use their own form of garbage collection. For
// example, with Python (for SageMath).
typedef void (*TNumExtraMarkFuncBags)(void);
extern void SetExtraMarkFuncBags(TNumExtraMarkFuncBags func);

/****************************************************************************
**
Expand Down Expand Up @@ -1030,8 +1036,6 @@ extern void InitCollectFuncBags (
** only be at addresses that are a multiple of 'sizeof(Bag)'. This value
** depends on the machine, the operating system, and the compiler.
*/
typedef void (*TNumExtraMarkFuncBags)(void);

extern void InitBags(UInt initialSize, Bag * stackStart, UInt stackAlign);

/****************************************************************************
Expand Down