1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-24 07:41:54 -07:00

Restore assembly code (removed in change 194595) for spilling callee-save registers on fr and li platforms.

Copied from Perforce
 Change: 196178
This commit is contained in:
Gareth Rees 2019-06-04 14:09:05 +01:00
parent e410c28276
commit 6e116da468

View file

@ -1,7 +1,7 @@
/* ss.h: STACK SCANNING
*
* $Id$
* Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2019 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,21 +13,12 @@
#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
* <design/stack-scan#.sol.setjmp.scan>.
*/
#include <setjmp.h>
typedef struct StackContextStruct {
jmp_buf jumpBuffer;
} StackContextStruct;
/* StackHot -- capture a hot stack pointer
*
* Sets *stackOut to a stack pointer that includes the current frame.
@ -59,6 +50,44 @@ 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 <setjmp.h>
struct StackContextStruct {
jmp_buf jumpBuffer;
};
#if defined(MPS_OS_XC)
/* We call _setjmp rather than setjmp because we can be confident what
@ -74,7 +103,9 @@ void StackHot(void **stackOut);
#define STACK_CONTEXT_SAVE(sc) ((void)setjmp((sc)->jumpBuffer))
#endif /* platform defines */
#endif /* jmp_buf platforms */
#endif /* platform specific code */
/* StackScan -- scan the mutator's stack and registers
@ -92,7 +123,7 @@ extern Res StackScan(ScanState ss, void *stackCold,
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2018 Ravenbrook Limited <https://www.ravenbrook.com/>.
* Copyright (C) 2001-2019 Ravenbrook Limited <https://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*