From 1442df6958023d8cb264a9aceaec883ededfd77d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 5 Jun 2019 10:36:50 +0100 Subject: [PATCH] Revert change 196178, submitted on wrong branch. Copied from Perforce Change: 196185 --- mps/code/ss.h | 65 ++++++++++++++------------------------------------- 1 file changed, 17 insertions(+), 48 deletions(-) diff --git a/mps/code/ss.h b/mps/code/ss.h index 513b4e73237..59543ae7048 100644 --- a/mps/code/ss.h +++ b/mps/code/ss.h @@ -1,7 +1,7 @@ /* ss.h: STACK SCANNING * * $Id$ - * Copyright (c) 2001-2019 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * This module saves the mutator context on entry to the MPS, and * provides functions for decoding the context and scanning the root @@ -13,12 +13,21 @@ #include "mpm.h" - -/* StackContext -- some of the mutator's state */ - -typedef struct StackContextStruct StackContextStruct; - +/* StackContext -- some of the mutator's state + * + * The jumpBuffer is used to capture most of the mutator's state on + * entry to the MPS, but can't capture it all. See + * . + */ + +#include + +typedef struct StackContextStruct { + jmp_buf jumpBuffer; +} StackContextStruct; + + /* StackHot -- capture a hot stack pointer * * Sets *stackOut to a stack pointer that includes the current frame. @@ -50,44 +59,6 @@ void StackHot(void **stackOut); /* STACK_CONTEXT_SAVE -- save the callee-saves and stack pointer */ -#if (defined(MPS_OS_FR) || defined(MPS_OS_LI)) && defined(MPS_ARCH_I3) - -struct StackContextStruct { - Word calleeSave[4]; -}; - -#define STACK_CONTEXT_SAVE(sc) \ - BEGIN \ - __asm__ volatile ("mov %%ebx, %0" : "=m" ((sc)->calleeSave[0])); \ - __asm__ volatile ("mov %%esi, %0" : "=m" ((sc)->calleeSave[1])); \ - __asm__ volatile ("mov %%edi, %0" : "=m" ((sc)->calleeSave[2])); \ - __asm__ volatile ("mov %%ebp, %0" : "=m" ((sc)->calleeSave[3])); \ - END - -#elif (defined(MPS_OS_FR) || defined(MPS_OS_LI)) && defined(MPS_ARCH_I6) - -struct StackContextStruct { - Word calleeSave[6]; -}; - -#define STACK_CONTEXT_SAVE(sc) \ - BEGIN \ - __asm__ volatile ("mov %%rbp, %0" : "=m" ((sc)->calleeSave[0])); \ - __asm__ volatile ("mov %%rbx, %0" : "=m" ((sc)->calleeSave[1])); \ - __asm__ volatile ("mov %%r12, %0" : "=m" ((sc)->calleeSave[2])); \ - __asm__ volatile ("mov %%r13, %0" : "=m" ((sc)->calleeSave[3])); \ - __asm__ volatile ("mov %%r14, %0" : "=m" ((sc)->calleeSave[4])); \ - __asm__ volatile ("mov %%r15, %0" : "=m" ((sc)->calleeSave[5])); \ - END - -#else /* jmp_buf platforms */ - -#include - -struct StackContextStruct { - jmp_buf jumpBuffer; -}; - #if defined(MPS_OS_XC) /* We call _setjmp rather than setjmp because we can be confident what @@ -103,9 +74,7 @@ struct StackContextStruct { #define STACK_CONTEXT_SAVE(sc) ((void)setjmp((sc)->jumpBuffer)) -#endif /* jmp_buf platforms */ - -#endif /* platform specific code */ +#endif /* platform defines */ /* StackScan -- scan the mutator's stack and registers @@ -123,7 +92,7 @@ extern Res StackScan(ScanState ss, void *stackCold, /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2019 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. *