mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Add `scm_t_aligned_cell' internal type.
* libguile/_scm.h (struct scm_aligned_cell)[__GNUC__]: New type. (union scm_aligned_cell)[!__GNUC__]: New type. (scm_t_aligned_cell): New type. * libguile/vm.c (vm_dispatch_hook): Use it.
This commit is contained in:
parent
04186f2006
commit
405a79ca7f
2 changed files with 31 additions and 5 deletions
|
@ -63,6 +63,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <verify.h>
|
||||
#include <alignof.h>
|
||||
#include "libguile/__scm.h"
|
||||
|
||||
/* Include headers for those files central to the implementation. The
|
||||
|
@ -192,6 +193,35 @@
|
|||
#define SCM_OBJCODE_COOKIE \
|
||||
"GOOF-" SCM_OBJCODE_MACHINE_VERSION_STRING "---"
|
||||
|
||||
|
||||
/* Cells have to be 8-byte aligned. Use `scm_t_aligned_cell' when not
|
||||
allocating on the heap to have this guarantee. This is similar to the
|
||||
`SCM_ALIGNED' macro but provides an option likely to work with compilers
|
||||
other than GCC. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
struct scm_aligned_cell
|
||||
{
|
||||
scm_t_cell cell __attribute__ ((__aligned__ (8)));
|
||||
};
|
||||
|
||||
typedef struct scm_aligned_cell scm_t_aligned_cell;
|
||||
|
||||
#else /* !__GNUC__ */
|
||||
|
||||
union scm_aligned_cell
|
||||
{
|
||||
double alignment;
|
||||
scm_t_cell cell;
|
||||
};
|
||||
|
||||
typedef union scm_aligned_cell scm_t_aligned_cell;
|
||||
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* Make sure we get the right alignment. */
|
||||
verify (alignof (scm_t_aligned_cell) >= 8);
|
||||
|
||||
#endif /* SCM__SCM_H */
|
||||
|
||||
|
|
|
@ -190,11 +190,7 @@ vm_dispatch_hook (SCM vm, int hook_num)
|
|||
struct scm_vm *vp;
|
||||
SCM hook;
|
||||
struct scm_frame c_frame;
|
||||
union
|
||||
{
|
||||
double alignment;
|
||||
scm_t_cell cell;
|
||||
} frame;
|
||||
scm_t_aligned_cell frame;
|
||||
SCM args[1];
|
||||
|
||||
vp = SCM_VM_DATA (vm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue