diff options
author | Andy Wingo <wingo@pobox.com> | 2010-07-17 12:22:17 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-07-17 13:31:06 +0200 |
commit | 1c05a2a16d845a261bcb0804e7162f31533d674f (patch) | |
tree | ed30191b33e6247ffda6a03b1e6eee8910e4a901 | |
parent | 6f8d7b12bbcc5be470bb6421bcd70d5806bce04b (diff) | |
download | guile-1c05a2a16d845a261bcb0804e7162f31533d674f.tar.gz |
use scm_malloc_pointerless to alloc aligned blocks in fallback
* libguile/continuations.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
(SCM_STATIC_ALIGNED_ARRAY)
* libguile/control.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY)
(SCM_STATIC_ALIGNED_ARRAY): Tweak backslashes. Use
scm_malloc_pointerless to ensure alignment.
-rw-r--r-- | libguile/continuations.c | 9 | ||||
-rw-r--r-- | libguile/control.c | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/libguile/continuations.c b/libguile/continuations.c index dc504f0d1..b4789635f 100644 --- a/libguile/continuations.c +++ b/libguile/continuations.c @@ -74,16 +74,15 @@ static scm_t_bits tc16_continuation; #define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align)) #ifdef SCM_ALIGNED -#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\ +#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \ static const type sym[] -#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)\ +#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \ static SCM_ALIGNED (alignment) const type sym[] #else -#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\ +#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \ static type *sym #define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \ -SCM_SNARF_INIT(sym = scm_malloc (sizeof(sym##__unaligned) + alignment - 1); \ - sym = ALIGN_PTR (type, sym, alignment); \ +SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned)); \ memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \ static type *sym = NULL; \ static const type sym##__unaligned[] diff --git a/libguile/control.c b/libguile/control.c index 6c206756a..99bc846cb 100644 --- a/libguile/control.c +++ b/libguile/control.c @@ -82,16 +82,15 @@ scm_i_prompt_pop_abort_args_x (SCM prompt) #define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align)) #ifdef SCM_ALIGNED -#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\ +#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \ static const type sym[] -#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym)\ +#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \ static SCM_ALIGNED (alignment) const type sym[] #else -#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym)\ +#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \ static type *sym #define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \ -SCM_SNARF_INIT(sym = scm_malloc (sizeof(sym##__unaligned) + alignment - 1); \ - sym = ALIGN_PTR (type, sym, alignment); \ +SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned); \ memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \ static type *sym = NULL; \ static const type sym##__unaligned[] |