1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 14:50:19 +02:00

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.
This commit is contained in:
Andy Wingo 2010-07-17 12:22:17 +02:00
parent 6f8d7b12bb
commit 1c05a2a16d
2 changed files with 8 additions and 10 deletions

View file

@ -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[]

View file

@ -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[]