diff options
author | Andy Wingo <wingo@pobox.com> | 2011-10-24 18:22:35 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-10-24 18:59:35 +0200 |
commit | 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3 (patch) | |
tree | ef4afe3a80f6441aeda3bf14ae20ab1ee07824c6 /libguile/gc.h | |
parent | 8c5bb72920a41d165726a1b5a610d823971f1ca8 (diff) | |
download | guile-47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3.tar.gz |
add SCM_HEAP_OBJECT_BASE
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM,
returns a pointer to the start of its memory area on the heap.
* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
Diffstat (limited to 'libguile/gc.h')
-rw-r--r-- | libguile/gc.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libguile/gc.h b/libguile/gc.h index b4b725c23..a7f3b7343 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -45,12 +45,13 @@ typedef struct scm_t_cell * in debug mode. In particular these macros will even work for free cells, * which should never be encountered by user code. */ -#define SCM_GC_CELL_OBJECT(x, n) (((SCM *)SCM2PTR (x)) [n]) -#define SCM_GC_CELL_WORD(x, n) (SCM_UNPACK (SCM_GC_CELL_OBJECT ((x), (n)))) +#define SCM_GC_CELL_OBJECT(x, n) (SCM_PACK (SCM_HEAP_OBJECT_BASE (x)[n])) +#define SCM_GC_CELL_WORD(x, n) (SCM_HEAP_OBJECT_BASE (x)[n]) -#define SCM_GC_SET_CELL_OBJECT(x, n, v) ((((SCM *)SCM2PTR (x)) [n]) = (v)) +#define SCM_GC_SET_CELL_OBJECT(x, n, v) \ + (SCM_HEAP_OBJECT_BASE (x)[n] = SCM_UNPACK (v)) #define SCM_GC_SET_CELL_WORD(x, n, v) \ - (SCM_GC_SET_CELL_OBJECT ((x), (n), SCM_PACK (v))) + (SCM_HEAP_OBJECT_BASE (x)[n] = (v)) #define SCM_GC_CELL_TYPE(x) (SCM_GC_CELL_OBJECT ((x), 0)) @@ -96,7 +97,8 @@ typedef struct scm_t_cell #define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT ((x), 2, (v)) #define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT ((x), 3, (v)) -#define SCM_CELL_OBJECT_LOC(x, n) (SCM_VALIDATE_CELL((x), &SCM_GC_CELL_OBJECT ((x), (n)))) +#define SCM_CELL_WORD_LOC(x, n) (SCM_VALIDATE_CELL((x), &SCM_GC_CELL_WORD ((x), (n)))) +#define SCM_CELL_OBJECT_LOC(x, n) ((SCM *) SCM_CELL_WORD_LOC (x, n)) #define SCM_CARLOC(x) (SCM_CELL_OBJECT_LOC ((x), 0)) #define SCM_CDRLOC(x) (SCM_CELL_OBJECT_LOC ((x), 1)) |