From 1034444d55167837c9afd27ad5baecaec649e7ee Mon Sep 17 00:00:00 2001 From: Jonathan Holburn Date: Sat, 9 Nov 2024 22:47:06 +0000 Subject: [PATCH] Make stack context saving macros equivalent to NOP, and remove the AVER which guards stack context save pre scan. --- code/ss.c | 9 ++++++++- code/ss.h | 12 ++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/code/ss.c b/code/ss.c index ce088101f1..bc54571532 100644 --- a/code/ss.c +++ b/code/ss.c @@ -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 diff --git a/code/ss.h b/code/ss.h index f05ff67b62..9c5fa0953c 100644 --- a/code/ss.h +++ b/code/ss.h @@ -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); \ @@ -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; \