* pairs.h (SCM_NEWCELL2): double-cell variants of SCM_NEWCELL.
(SCM_CELL_WORD, SCM_CELL_WORDLOC, SCM_SET_CELL_WORD): primitive multi-cell access macros (used by the ones below). (SCM_CELL_WORD[0-3], SCM_SET_CELL_WORD[0-3]): multi-cell access macros.
This commit is contained in:
parent
88eb68523a
commit
742dd4b21b
1 changed files with 45 additions and 14 deletions
|
|
@ -70,7 +70,8 @@ typedef SCM *SCMPTR;
|
|||
|
||||
# ifdef nosve
|
||||
# define SCM_PTR_MASK 0xffffffffffff
|
||||
# define SCM_PTR_LT(x, y) (((int)(x)&SCM_PTR_MASK) < ((int)(y)&SCM_PTR_MASK))
|
||||
# define SCM_PTR_LT(x, y)\
|
||||
(((int) (x) &SCM_PTR_MASK) < ((int) (y) & SCM_PTR_MASK))
|
||||
# else
|
||||
# define SCM_PTR_LT(x, y) ((x) < (y))
|
||||
# endif /* def nosve */
|
||||
|
|
@ -151,6 +152,23 @@ typedef SCM huge *SCMPTR;
|
|||
#define SCM_CADDDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ))))
|
||||
#define SCM_CDDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ))))
|
||||
|
||||
/* Multi-cells
|
||||
*/
|
||||
|
||||
#define SCM_CELL_WORD(x, n) (((SCM *) (SCM2PTR (x)))[n])
|
||||
#define SCM_SET_CELL_WORD(x, n, v) (SCM_CELL_WORD (x, n) = (SCM) (v))
|
||||
#define SCM_CELL_WORD_LOC(x, n) (&SCM_CELL_WORD (x, n))
|
||||
|
||||
#define SCM_CELL_WORD0(x) SCM_CELL_WORD (x, 0)
|
||||
#define SCM_CELL_WORD1(x) SCM_CELL_WORD (x, 1)
|
||||
#define SCM_CELL_WORD2(x) SCM_CELL_WORD (x, 2)
|
||||
#define SCM_CELL_WORD3(x) SCM_CELL_WORD (x, 3)
|
||||
|
||||
#define SCM_SET_CELL_WORD0(x, v) SCM_SET_CELL_WORD(x, 0, v)
|
||||
#define SCM_SET_CELL_WORD1(x, v) SCM_SET_CELL_WORD(x, 1, v)
|
||||
#define SCM_SET_CELL_WORD2(x, v) SCM_SET_CELL_WORD(x, 2, v)
|
||||
#define SCM_SET_CELL_WORD3(x, v) SCM_SET_CELL_WORD(x, 3, v)
|
||||
|
||||
/* the allocated thing: The car of newcells are set to
|
||||
scm_tc16_allocated to avoid the fragile state of newcells wrt the
|
||||
gc. If it stays as a freecell, any allocation afterwards could
|
||||
|
|
@ -159,11 +177,12 @@ typedef SCM huge *SCMPTR;
|
|||
|
||||
#ifdef GUILE_DEBUG_FREELIST
|
||||
#define SCM_NEWCELL(_into) do { _into = scm_debug_newcell (); } while (0)
|
||||
#define SCM_NEWCELL2(_into) do { _into = scm_debug_newcell2 (); } while (0)
|
||||
#else
|
||||
#define SCM_NEWCELL(_into) \
|
||||
do { \
|
||||
if (SCM_IMP (scm_freelist)) \
|
||||
_into = scm_gc_for_newcell();\
|
||||
_into = scm_gc_for_newcell (1, &scm_freelist);\
|
||||
else \
|
||||
{ \
|
||||
_into = scm_freelist; \
|
||||
|
|
@ -172,6 +191,18 @@ typedef SCM huge *SCMPTR;
|
|||
++scm_cells_allocated; \
|
||||
} \
|
||||
} while(0)
|
||||
#define SCM_NEWCELL2(_into) \
|
||||
do { \
|
||||
if (SCM_IMP (scm_freelist2)) \
|
||||
_into = scm_gc_for_newcell (2, &scm_freelist2);\
|
||||
else \
|
||||
{ \
|
||||
_into = scm_freelist2; \
|
||||
scm_freelist2 = SCM_CDR (scm_freelist2);\
|
||||
SCM_SETCAR (_into, scm_tc16_allocated); \
|
||||
scm_cells_allocated += 2; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue