* Removed deprecated stuff.
[bpt/guile.git] / libguile / gc.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
61045190
DH
3#ifndef SCM_GC_H
4#define SCM_GC_H
5/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
a00c95d9 6 *
0f2d19dd
JB
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
a00c95d9 11 *
0f2d19dd
JB
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
a00c95d9 16 *
0f2d19dd
JB
17 * You should have received a copy of the GNU General Public License
18 * along with this software; see the file COPYING. If not, write to
82892bed
JB
19 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 * Boston, MA 02111-1307 USA
0f2d19dd
JB
21 *
22 * As a special exception, the Free Software Foundation gives permission
23 * for additional uses of the text contained in its release of GUILE.
24 *
25 * The exception is that, if you link the GUILE library with other files
26 * to produce an executable, this does not by itself cause the
27 * resulting executable to be covered by the GNU General Public License.
28 * Your use of that executable is in no way restricted on account of
29 * linking the GUILE library code into it.
30 *
31 * This exception does not however invalidate any other reasons why
32 * the executable file might be covered by the GNU General Public License.
33 *
34 * This exception applies only to the code released by the
35 * Free Software Foundation under the name GUILE. If you copy
36 * code from other Free Software Foundation releases into a copy of
37 * GUILE, as the General Public License permits, the exception does
38 * not apply to the code that you add in this way. To avoid misleading
39 * anyone as to the status of such modified files, you must delete
40 * this exception notice from them.
41 *
42 * If you write modifications of your own for GUILE, it is your choice
43 * whether to permit this exception to apply to your modifications.
82892bed 44 * If you do not wish that, delete this exception notice. */
d3a6bc94 45
0f2d19dd
JB
46\f
47
b4309c3c 48#include "libguile/__scm.h"
2549a709 49
9b3e180c
MD
50#include "libguile/hooks.h"
51
0f2d19dd
JB
52\f
53
2549a709
DH
54typedef struct scm_cell
55{
92c2555f
MV
56 scm_t_bits word_0;
57 scm_t_bits word_1;
2549a709
DH
58} scm_cell;
59
60
61/* SCM_CELLPTR is a pointer to a cons cell which may be compared or
62 * differenced.
63 */
56100716 64typedef scm_cell * SCM_CELLPTR;
2549a709
DH
65
66
67/* Cray machines have pointers that are incremented once for each word,
68 * rather than each byte, the 3 most significant bits encode the byte
69 * within the word. The following macros deal with this by storing the
70 * native Cray pointers like the ones that looks like scm expects. This
71 * is done for any pointers that might appear in the car of a scm_cell,
e618c9a3 72 * pointers to scm_vector elts, functions, &c are not munged.
2549a709
DH
73 */
74#ifdef _UNICOS
076d6063 75# define SCM2PTR(x) ((SCM_CELLPTR) (SCM_UNPACK (x) >> 3))
92c2555f 76# define PTR2SCM(x) (SCM_PACK (((scm_t_bits) (x)) << 3))
2549a709 77#else
076d6063 78# define SCM2PTR(x) ((SCM_CELLPTR) (SCM_UNPACK (x)))
92c2555f 79# define PTR2SCM(x) (SCM_PACK ((scm_t_bits) (x)))
2549a709
DH
80#endif /* def _UNICOS */
81
e618c9a3 82#define SCM_GC_CARD_N_HEADER_CELLS 1
f91f77e6 83#define SCM_GC_CARD_N_CELLS 256
e618c9a3
ML
84
85#define SCM_GC_CARD_SIZE (SCM_GC_CARD_N_CELLS * sizeof (scm_cell))
86#define SCM_GC_CARD_N_DATA_CELLS (SCM_GC_CARD_N_CELLS - SCM_GC_CARD_N_HEADER_CELLS)
87
88#define SCM_GC_CARD_BVEC_SIZE_IN_LIMBS \
89 ((SCM_GC_CARD_N_CELLS + SCM_C_BVEC_LIMB_BITS - 1) / SCM_C_BVEC_LIMB_BITS)
90
91#define SCM_GC_IN_CARD_HEADERP(x) \
92 SCM_PTR_LT ((scm_cell *) (x), SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS)
93
92c2555f 94#define SCM_GC_CARD_BVEC(card) ((scm_t_c_bvec_limb *) ((card)->word_0))
322ec19d 95#define SCM_GC_SET_CARD_BVEC(card, bvec) \
92c2555f 96 ((card)->word_0 = (scm_t_bits) (bvec))
e618c9a3 97
c014a02e 98#define SCM_GC_GET_CARD_FLAGS(card) ((long) ((card)->word_1))
322ec19d 99#define SCM_GC_SET_CARD_FLAGS(card, flags) \
92c2555f 100 ((card)->word_1 = (scm_t_bits) (flags))
322ec19d 101#define SCM_GC_CLR_CARD_FLAGS(card) (SCM_GC_SET_CARD_FLAGS (card, 0L))
e618c9a3
ML
102
103#define SCM_GC_GET_CARD_FLAG(card, shift) (SCM_GC_GET_CARD_FLAGS (card) & (1L << (shift)))
322ec19d
ML
104#define SCM_GC_SET_CARD_FLAG(card, shift) \
105 (SCM_GC_SET_CARD_FLAGS (card, SCM_GC_GET_CARD_FLAGS(card) | (1L << (shift))))
106#define SCM_GC_CLR_CARD_FLAG(card, shift) \
107 (SCM_GC_SET_CARD_FLAGS (card, SCM_GC_GET_CARD_FLAGS(card) & ~(1L << (shift))))
e618c9a3
ML
108
109#define SCM_GC_CARDF_DOUBLECELL 0
110
111#define SCM_GC_CARD_DOUBLECELLP(card) SCM_GC_GET_CARD_FLAG (card, SCM_GC_CARDF_DOUBLECELL)
112#define SCM_GC_SET_CARD_DOUBLECELL(card) SCM_GC_SET_CARD_FLAG (card, SCM_GC_CARDF_DOUBLECELL)
113
114/* card addressing. for efficiency, cards are *always* aligned to
115 SCM_GC_CARD_SIZE. */
116
117#define SCM_GC_CARD_SIZE_MASK (SCM_GC_CARD_SIZE - 1)
118#define SCM_GC_CARD_ADDR_MASK (~SCM_GC_CARD_SIZE_MASK)
119
c014a02e 120#define SCM_GC_CELL_CARD(x) ((SCM_CELLPTR) ((long) (x) & SCM_GC_CARD_ADDR_MASK))
e618c9a3 121#define SCM_GC_CELL_SPAN(x) ((SCM_GC_CARD_DOUBLECELLP (SCM_GC_CELL_CARD (x))) ? 2 : 1)
c014a02e 122#define SCM_GC_CELL_OFFSET(x) (((long) (x) & SCM_GC_CARD_SIZE_MASK) >> SCM_CELL_SIZE_SHIFT)
e618c9a3
ML
123#define SCM_GC_CELL_BVEC(x) SCM_GC_CARD_BVEC (SCM_GC_CELL_CARD (x))
124#define SCM_GC_CELL_GET_BIT(x) SCM_C_BVEC_GET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
125#define SCM_GC_CELL_SET_BIT(x) SCM_C_BVEC_SET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
126#define SCM_GC_CELL_CLR_BIT(x) SCM_C_BVEC_CLR (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
127
128#define SCM_GC_CARD_UP(x) SCM_GC_CELL_CARD ((char *) (x) + SCM_GC_CARD_SIZE - 1)
129#define SCM_GC_CARD_DOWN SCM_GC_CELL_CARD
130
131/* low level bit banging aids */
132
92c2555f 133typedef unsigned long scm_t_c_bvec_limb;
e618c9a3
ML
134
135#if (SIZEOF_LONG == 8)
136# define SCM_C_BVEC_LIMB_BITS 64
137# define SCM_C_BVEC_OFFSET_SHIFT 6
138# define SCM_C_BVEC_POS_MASK 63
139# define SCM_CELL_SIZE_SHIFT 4
140#else
141# define SCM_C_BVEC_LIMB_BITS 32
142# define SCM_C_BVEC_OFFSET_SHIFT 5
143# define SCM_C_BVEC_POS_MASK 31
144# define SCM_CELL_SIZE_SHIFT 3
145#endif
146
147#define SCM_C_BVEC_OFFSET(pos) (pos >> SCM_C_BVEC_OFFSET_SHIFT)
148
149#define SCM_C_BVEC_GET(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] & (1L << (pos & SCM_C_BVEC_POS_MASK)))
150#define SCM_C_BVEC_SET(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] |= (1L << (pos & SCM_C_BVEC_POS_MASK)))
151#define SCM_C_BVEC_CLR(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] &= ~(1L << (pos & SCM_C_BVEC_POS_MASK)))
152
153#define SCM_C_BVEC_BITS2BYTES(bits) \
92c2555f 154 (sizeof (scm_t_c_bvec_limb) * ((((bits) & SCM_C_BVEC_POS_MASK) ? 1L : 0L) + SCM_C_BVEC_OFFSET (bits)))
e618c9a3
ML
155
156#define SCM_C_BVEC_SET_BYTES(bvec, bytes) (memset (bvec, 0xff, bytes))
157#define SCM_C_BVEC_SET_ALL_BITS(bvec, bits) SCM_C_BVEC_SET_BYTES (bvec, SCM_C_BVEC_BITS2BYTES (bits))
158
159#define SCM_C_BVEC_CLR_BYTES(bvec, bytes) (memset (bvec, 0, bytes))
160#define SCM_C_BVEC_CLR_ALL_BITS(bvec, bits) SCM_C_BVEC_CLR_BYTES (bvec, SCM_C_BVEC_BITS2BYTES (bits))
161
162/* testing and changing GC marks */
163
164#define SCM_GCMARKP(x) SCM_GC_CELL_GET_BIT (x)
165#define SCM_SETGCMARK(x) SCM_GC_CELL_SET_BIT (x)
166#define SCM_CLRGCMARK(x) SCM_GC_CELL_CLR_BIT (x)
167
2549a709
DH
168/* Low level cell data accessing macros:
169 */
170
406c7d90
DH
171#if (SCM_DEBUG_CELL_ACCESSES == 1)
172# define SCM_VALIDATE_CELL(cell, expr) (scm_assert_cell_valid (cell), (expr))
708cb87c 173#else
61045190 174# define SCM_VALIDATE_CELL(cell, expr) (expr)
708cb87c 175#endif
46d53380 176
f706a58b 177#define SCM_CELL_WORD(x, n) \
92c2555f 178 SCM_VALIDATE_CELL ((x), ((const scm_t_bits *) SCM2PTR (x)) [n])
2549a709
DH
179#define SCM_CELL_WORD_0(x) SCM_CELL_WORD (x, 0)
180#define SCM_CELL_WORD_1(x) SCM_CELL_WORD (x, 1)
181#define SCM_CELL_WORD_2(x) SCM_CELL_WORD (x, 2)
182#define SCM_CELL_WORD_3(x) SCM_CELL_WORD (x, 3)
183
f706a58b 184#define SCM_CELL_OBJECT(x, n) \
92c2555f 185 SCM_VALIDATE_CELL ((x), SCM_PACK (((const scm_t_bits *) SCM2PTR (x)) [n]))
2549a709
DH
186#define SCM_CELL_OBJECT_0(x) SCM_CELL_OBJECT (x, 0)
187#define SCM_CELL_OBJECT_1(x) SCM_CELL_OBJECT (x, 1)
188#define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT (x, 2)
189#define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT (x, 3)
190
f706a58b 191#define SCM_SET_CELL_WORD(x, n, v) \
92c2555f 192 SCM_VALIDATE_CELL ((x), ((scm_t_bits *) SCM2PTR (x)) [n] = (scm_t_bits) (v))
2549a709
DH
193#define SCM_SET_CELL_WORD_0(x, v) SCM_SET_CELL_WORD (x, 0, v)
194#define SCM_SET_CELL_WORD_1(x, v) SCM_SET_CELL_WORD (x, 1, v)
195#define SCM_SET_CELL_WORD_2(x, v) SCM_SET_CELL_WORD (x, 2, v)
196#define SCM_SET_CELL_WORD_3(x, v) SCM_SET_CELL_WORD (x, 3, v)
197
f706a58b 198#define SCM_SET_CELL_OBJECT(x, n, v) \
92c2555f 199 SCM_VALIDATE_CELL ((x), ((scm_t_bits *) SCM2PTR (x)) [n] = SCM_UNPACK (v))
2549a709
DH
200#define SCM_SET_CELL_OBJECT_0(x, v) SCM_SET_CELL_OBJECT (x, 0, v)
201#define SCM_SET_CELL_OBJECT_1(x, v) SCM_SET_CELL_OBJECT (x, 1, v)
202#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT (x, 2, v)
203#define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT (x, 3, v)
204
205#define SCM_CELL_TYPE(x) SCM_CELL_WORD_0 (x)
206#define SCM_SET_CELL_TYPE(x, t) SCM_SET_CELL_WORD_0 (x, t)
207
61045190
DH
208
209/* Except for the garbage collector, no part of guile should ever run over a
210 * free cell. Thus, in debug mode the above macros report an error if they
211 * are applied to a free cell. Since the garbage collector is allowed to
212 * access free cells, it needs its own way to access cells which will not
213 * result in errors when in debug mode. */
214
215#define SCM_GC_CELL_TYPE(x) \
92c2555f 216 (((const scm_t_bits *) SCM2PTR (x)) [0])
61045190
DH
217
218
92c2555f 219#define SCM_CELL_WORD_LOC(x, n) ((scm_t_bits *) & SCM_CELL_WORD (x, n))
f706a58b
DH
220#define SCM_CARLOC(x) ((SCM *) SCM_CELL_WORD_LOC ((x), 0))
221#define SCM_CDRLOC(x) ((SCM *) SCM_CELL_WORD_LOC ((x), 1))
2549a709
DH
222
223
6ba93e5e
DH
224/* SCM_PTR_LT and friends define how to compare two SCM_CELLPTRs (which may
225 * point to cells in different heap segments).
2549a709 226 */
6ba93e5e
DH
227#define SCM_PTR_LT(x, y) ((x) < (y))
228#define SCM_PTR_GT(x, y) (SCM_PTR_LT (y, x))
2549a709
DH
229#define SCM_PTR_LE(x, y) (!SCM_PTR_GT (x, y))
230#define SCM_PTR_GE(x, y) (!SCM_PTR_LT (x, y))
231
232
2d67e390
DH
233/* Freelists consist of linked cells where the type entry holds the value
234 * scm_tc_free_cell and the second entry holds a pointer to the next cell of
235 * the freelist. Due to this structure, freelist cells are not cons cells
236 * and thus may not be accessed using SCM_CAR and SCM_CDR.
237 */
238
3f5d82cd 239#define SCM_FREE_CELL_P(x) \
92c2555f 240 (!SCM_IMP (x) && (* (const scm_t_bits *) SCM2PTR (x) == scm_tc_free_cell))
3f5d82cd 241#define SCM_FREE_CELL_CDR(x) \
92c2555f 242 (SCM_PACK (((const scm_t_bits *) SCM2PTR (x)) [1]))
3f5d82cd 243#define SCM_SET_FREE_CELL_CDR(x, v) \
92c2555f 244 (((scm_t_bits *) SCM2PTR (x)) [1] = SCM_UNPACK (v))
3f5d82cd 245
61045190
DH
246
247#if (SCM_DEBUG_CELL_ACCESSES == 1)
248# define SCM_GC_SET_ALLOCATED(x) \
92c2555f 249 (((scm_t_bits *) SCM2PTR (x)) [0] = scm_tc16_allocated)
61045190
DH
250#else
251# define SCM_GC_SET_ALLOCATED(x)
252#endif
253
2549a709
DH
254#ifdef GUILE_DEBUG_FREELIST
255#define SCM_NEWCELL(_into) do { _into = scm_debug_newcell (); } while (0)
256#define SCM_NEWCELL2(_into) do { _into = scm_debug_newcell2 (); } while (0)
257#else
2549a709 258/* When we introduce POSIX threads support, every thread will have
3c8018e6 259 a freelist of its own. */
2549a709
DH
260#define SCM_NEWCELL(_into) \
261 do { \
7c33806a 262 if (SCM_NULLP (scm_freelist)) \
61045190 263 { \
2549a709
DH
264 _into = scm_gc_for_newcell (&scm_master_freelist, \
265 &scm_freelist); \
61045190
DH
266 SCM_GC_SET_ALLOCATED (_into); \
267 } \
2549a709
DH
268 else \
269 { \
270 _into = scm_freelist; \
3f5d82cd 271 scm_freelist = SCM_FREE_CELL_CDR (scm_freelist); \
61045190 272 SCM_GC_SET_ALLOCATED (_into); \
2549a709
DH
273 } \
274 } while(0)
275#define SCM_NEWCELL2(_into) \
276 do { \
7c33806a 277 if (SCM_NULLP (scm_freelist2)) \
61045190 278 { \
2549a709
DH
279 _into = scm_gc_for_newcell (&scm_master_freelist2, \
280 &scm_freelist2); \
61045190
DH
281 SCM_GC_SET_ALLOCATED (_into); \
282 } \
2549a709
DH
283 else \
284 { \
285 _into = scm_freelist2; \
3f5d82cd 286 scm_freelist2 = SCM_FREE_CELL_CDR (scm_freelist2); \
61045190 287 SCM_GC_SET_ALLOCATED (_into); \
2549a709
DH
288 } \
289 } while(0)
2549a709
DH
290#endif
291
292
e618c9a3 293#define SCM_MARKEDP SCM_GCMARKP
2d67e390 294#define SCM_NMARKEDP(x) (!SCM_MARKEDP (x))
79e3f9e2 295
61045190 296#if (SCM_DEBUG_CELL_ACCESSES == 1)
92c2555f 297extern scm_t_bits scm_tc16_allocated;
61045190
DH
298extern unsigned int scm_debug_cell_accesses_p;
299#endif
300
92c2555f 301extern struct scm_t_heap_seg_data *scm_heap_table;
1be6b49c 302extern size_t scm_n_heap_segs;
0f2d19dd
JB
303extern int scm_block_gc;
304extern int scm_gc_heap_lock;
406c7d90 305extern unsigned int scm_gc_running_p;
0f2d19dd
JB
306\f
307
1be6b49c 308extern size_t scm_default_init_heap_size_1;
aeacfc8f 309extern int scm_default_min_yield_1;
1be6b49c 310extern size_t scm_default_init_heap_size_2;
aeacfc8f 311extern int scm_default_min_yield_2;
1be6b49c 312extern size_t scm_default_max_segment_size;
aeacfc8f 313
1be6b49c 314extern size_t scm_max_segment_size;
0f2d19dd 315extern SCM_CELLPTR scm_heap_org;
4a4c9785 316extern SCM scm_freelist;
92c2555f 317extern struct scm_t_freelist scm_master_freelist;
4a4c9785 318extern SCM scm_freelist2;
92c2555f 319extern struct scm_t_freelist scm_master_freelist2;
c014a02e
ML
320extern unsigned long scm_gc_cells_collected;
321extern unsigned long scm_gc_yield;
322extern unsigned long scm_gc_malloc_collected;
323extern unsigned long scm_gc_ports_collected;
324extern unsigned long scm_cells_allocated;
325extern unsigned long scm_mallocated;
326extern unsigned long scm_mtrigger;
0f2d19dd 327
9b3e180c
MD
328extern SCM scm_after_gc_hook;
329
92c2555f
MV
330extern scm_t_c_hook scm_before_gc_c_hook;
331extern scm_t_c_hook scm_before_mark_c_hook;
332extern scm_t_c_hook scm_before_sweep_c_hook;
333extern scm_t_c_hook scm_after_sweep_c_hook;
334extern scm_t_c_hook scm_after_gc_c_hook;
9b3e180c 335
bb2c57fa 336#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
25748c78 337extern SCM scm_map_free_list (void);
5384bc5b 338extern SCM scm_free_list_length (void);
bb2c57fa
MD
339#endif
340#ifdef GUILE_DEBUG_FREELIST
f2333166 341extern SCM scm_debug_newcell (void);
16d35552 342extern SCM scm_debug_newcell2 (void);
25748c78 343extern SCM scm_gc_set_debug_check_freelist_x (SCM flag);
88256b2e
JB
344#endif
345
0f2d19dd 346\f
0f2d19dd 347
61045190
DH
348#if (SCM_DEBUG_CELL_ACCESSES == 1)
349extern void scm_assert_cell_valid (SCM);
350extern SCM scm_set_debug_cell_accesses_x (SCM flag);
351#endif
8163d1e4 352extern SCM scm_object_address (SCM obj);
fe1a46f0
JB
353extern SCM scm_unhash_name (SCM name);
354extern SCM scm_gc_stats (void);
fe1a46f0 355extern SCM scm_gc (void);
92c2555f
MV
356extern void scm_gc_for_alloc (struct scm_t_freelist *freelist);
357extern SCM scm_gc_for_newcell (struct scm_t_freelist *master, SCM *freelist);
4c48ba06 358#if 0
92c2555f 359extern void scm_alloc_cluster (struct scm_t_freelist *master);
4c48ba06 360#endif
3eeba8d4 361extern void scm_igc (const char *what);
fe1a46f0 362extern void scm_gc_mark (SCM p);
56495472 363extern void scm_gc_mark_dependencies (SCM p);
592996c9 364extern void scm_gc_mark_cell_conservatively (SCM cell);
c014a02e 365extern void scm_mark_locations (SCM_STACKITEM x[], unsigned long n);
fe1a46f0
JB
366extern int scm_cellp (SCM value);
367extern void scm_gc_sweep (void);
1be6b49c 368extern void * scm_must_malloc (size_t len, const char *what);
07806695 369extern void * scm_must_realloc (void *where,
1be6b49c 370 size_t olen, size_t len,
3eeba8d4 371 const char *what);
e4a7824f 372extern char *scm_must_strdup (const char *str);
1be6b49c 373extern char *scm_must_strndup (const char *str, size_t n);
c014a02e
ML
374extern void scm_done_malloc (long size);
375extern void scm_done_free (long size);
07806695 376extern void scm_must_free (void *obj);
5d2b97cd
DH
377extern void scm_remember_upto_here_1 (SCM obj);
378extern void scm_remember_upto_here_2 (SCM obj1, SCM obj2);
379extern void scm_remember_upto_here (SCM obj1, ...);
fe1a46f0 380extern SCM scm_return_first (SCM elt, ...);
41b0806d 381extern int scm_return_first_int (int x, ...);
fe1a46f0 382extern SCM scm_permanent_object (SCM obj);
6b1b030e
ML
383extern SCM scm_gc_protect_object (SCM obj);
384extern SCM scm_gc_unprotect_object (SCM obj);
385extern void scm_gc_register_root (SCM *p);
386extern void scm_gc_unregister_root (SCM *p);
387extern void scm_gc_register_roots (SCM *b, unsigned long n);
388extern void scm_gc_unregister_roots (SCM *b, unsigned long n);
85db4a2c 389extern int scm_init_storage (void);
92082045 390extern void *scm_get_stack_base (void);
fe1a46f0 391extern void scm_init_gc (void);
d1ca2c64
DH
392
393\f
394
395#if (SCM_DEBUG_DEPRECATED == 0)
396
6b1b030e
ML
397extern SCM scm_protect_object (SCM obj);
398extern SCM scm_unprotect_object (SCM obj);
399
e038c042
DH
400#define SCM_SETAND_CAR(x, y) \
401 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) & (y))))
402#define SCM_SETOR_CAR(x, y)\
403 (SCM_SETCAR ((x), SCM_PACK (SCM_UNPACK (SCM_CAR (x)) | (y))))
61045190
DH
404#define SCM_SETAND_CDR(x, y)\
405 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
406#define SCM_SETOR_CDR(x, y)\
407 (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
d1ca2c64
DH
408#define SCM_FREEP(x) (SCM_FREE_CELL_P (x))
409#define SCM_NFREEP(x) (!SCM_FREE_CELL_P (x))
fd336365
DH
410#define SCM_GC8MARKP(x) SCM_GCMARKP (x)
411#define SCM_SETGC8MARK(x) SCM_SETGCMARK (x)
412#define SCM_CLRGC8MARK(x) SCM_CLRGCMARK (x)
413#define SCM_GCTYP16(x) SCM_TYP16 (x)
414#define SCM_GCCDR(x) SCM_CDR (x)
5d2b97cd 415extern void scm_remember (SCM * ptr);
d1ca2c64
DH
416
417#endif /* SCM_DEBUG_DEPRECATED == 0 */
418
61045190 419#endif /* SCM_GC_H */
89e00824
ML
420
421/*
422 Local Variables:
423 c-file-style: "gnu"
424 End:
425*/