File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 314314#define ATTRIBUTE_UNUSED
315315#endif
316316
317+ /* Attribute for data structures that need to be allocated at
318+ * addresses with a particular alignment.
319+ * GCC: <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-aligned-function-attribute>
320+ */
321+ #if defined(MPS_BUILD_GC ) || defined(MPS_BUILD_LL )
322+ #define ATTRIBUTE_ALIGNED (ALIGNMENT ) __attribute__((__aligned__(ALIGNMENT)))
323+ #else
324+ #define ATTRIBUTE_ALIGNED (ALIGNMENT )
325+ #endif
326+
317327
318328/* Compiler extensions */
319329
Original file line number Diff line number Diff line change 1919 * The jumpBuffer is used to capture most of the mutator's state on
2020 * entry to the MPS, but can't capture it all. See
2121 * <design/stack-scan#.sol.setjmp.scan>.
22+ *
23+ * The stack capturing mechanism in STACK_CONTEXT_BEGIN puts the
24+ * StackContextStruct on the stack, where it will later be scanned
25+ * using TraceScanArea. The jumpBuffer must be allocated on the stack
26+ * at an address with suitable alignment so that TraceScanArea will
27+ * correctly fix any addresses therein. This is vital on platform XCA6
28+ * where jmp_buf is declared as an array of int, which has 4-byte
29+ * alignment, but we need it to have 8-byte alignment.
2230 */
2331
2432#include <setjmp.h>
2533
2634typedef struct StackContextStruct {
27- jmp_buf jumpBuffer ;
35+ ATTRIBUTE_ALIGNED ( MPS_PF_ALIGN ) jmp_buf jumpBuffer ;
2836} StackContextStruct ;
2937
3038
You can’t perform that action at this time.
0 commit comments