Skip to content

Commit

Permalink
Make stack context saving macros equivalent to NOP, and remove the AV…
Browse files Browse the repository at this point in the history
…ER which guards stack context save pre scan.
  • Loading branch information
thejayps committed Nov 9, 2024
1 parent e2f9497 commit 1034444
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion code/ss.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ Res StackScan(ScanState ss, void *stackCold,

arena = ss->arena;

AVER(arena->stackWarm != NULL);
/* If we save stack context efficiently at all entry points to the MPS,
we should not need to save the stack context here, and so we should
AVER(arena->stackWarm != NULL) here , to make sure that we have
succeeded in writing the correct code at every entry point; However,
we do not save stack context at entry points, as the performance
penalty is too great. So we expect arena->stackWarm to be NULL at
this point, and the stack context is saved here */

warmest = arena->stackWarm;
if (warmest == NULL) {
/* Somehow missed saving the context at the entry point
Expand Down
12 changes: 10 additions & 2 deletions code/ss.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ void StackHot(void **stackOut);

/* STACK_CONTEXT_BEGIN -- save context */

#define STACK_CONTEXT_BEGIN(arena) \
#define STACK_CONTEXT_BEGIN(arena) STACK_CONTEXT_BEGIN_NOP

#define STACK_CONTEXT_BEGIN_NOP BEGIN

#define STACK_CONTEXT_BEGIN_SETJMP(arena) \
BEGIN \
StackContextStruct _sc; \
STACK_CONTEXT_SAVE(&_sc); \
Expand All @@ -50,7 +54,11 @@ void StackHot(void **stackOut);

/* STACK_CONTEXT_END -- clear context */

#define STACK_CONTEXT_END(arena) \
#define STACK_CONTEXT_END(arena) STACK_CONTEXT_END_NOP

#define STACK_CONTEXT_END_NOP END

#define STACK_CONTEXT_END_SETJMP(arena) \
END; \
AVER(arena->stackWarm != NULL); \
arena->stackWarm = NULL; \
Expand Down

0 comments on commit 1034444

Please sign in to comment.