Doc updates for srfi-14 character sets
[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
8c494e99 5
102dbb6f 6/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
a00c95d9 7 *
73be1d9e 8 * This library is free software; you can redistribute it and/or
53befeb7
NJ
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
a00c95d9 12 *
53befeb7
NJ
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
a00c95d9 17 *
73be1d9e
MV
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
53befeb7
NJ
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
73be1d9e 22 */
d3a6bc94 23
0f2d19dd
JB
24\f
25
b4309c3c 26#include "libguile/__scm.h"
2549a709 27
9b3e180c 28#include "libguile/hooks.h"
9de87eea 29#include "libguile/threads.h"
9bc4701c 30
0f2d19dd
JB
31\f
32
b17e0ac3
MV
33/* Cell allocation and garbage collection work rouhgly in the
34 following manner:
35
36 Each thread has a 'freelist', which is a list of available cells.
37 (It actually has two freelists, one for single cells and one for
38 double cells. Everything works analogous for double cells.)
39
40 When a thread wants to allocate a cell and the freelist is empty,
41 it refers to a global list of unswept 'cards'. A card is a small
42 block of cells that are contigous in memory, together with the
43 corresponding mark bits. A unswept card is one where the mark bits
44 are set for cells that have been in use during the last global mark
45 phase, but the unmarked cells of the card have not been scanned and
46 freed yet.
47
48 The thread takes one of the unswept cards and sweeps it, thereby
49 building a new freelist that it then uses. Sweeping a card will
50 call the smob free functions of unmarked cells, for example, and
51 thus, these free functions can run at any time, in any thread.
52
53 When there are no more unswept cards available, the thread performs
54 a global garbage collection. For this, all other threads are
55 stopped. A global mark is performed and all cards are put into the
56 global list of unswept cards. Whennecessary, new cards are
57 allocated and initialized at this time. The other threads are then
58 started again.
59*/
60
228a24ef 61typedef struct scm_t_cell
2549a709 62{
33c527ec
MV
63 SCM word_0;
64 SCM word_1;
228a24ef 65} scm_t_cell;
2549a709 66
c8a1bdc4
HWN
67/*
68 CARDS
69
70 A card is a small `page' of memory; it will be the unit for lazy
71 sweeping, generations, etc. The first cell of a card contains a
33c527ec
MV
72 pointer to the mark bitvector, so that we can find the bitvector
73 efficiently: we knock off some lowerorder bits.
c8a1bdc4 74
33c527ec 75 The size on a 32 bit machine is 256 cells = 2kb. The card [XXX]
c8a1bdc4 76*/
2549a709 77
2549a709
DH
78
79
33c527ec
MV
80/* Cray machines have pointers that are incremented once for each
81 * word, rather than each byte, the 3 most significant bits encode the
82 * byte within the word. The following macros deal with this by
83 * storing the native Cray pointers like the ones that looks like scm
84 * expects. This is done for any pointers that point to a cell,
e618c9a3 85 * pointers to scm_vector elts, functions, &c are not munged.
2549a709
DH
86 */
87#ifdef _UNICOS
c8a1bdc4 88# define SCM2PTR(x) ((scm_t_cell *) (SCM_UNPACK (x) >> 3))
92c2555f 89# define PTR2SCM(x) (SCM_PACK (((scm_t_bits) (x)) << 3))
2549a709 90#else
c8a1bdc4 91# define SCM2PTR(x) ((scm_t_cell *) (SCM_UNPACK (x)))
92c2555f 92# define PTR2SCM(x) (SCM_PACK ((scm_t_bits) (x)))
2549a709
DH
93#endif /* def _UNICOS */
94
c8a1bdc4 95
e618c9a3 96#define SCM_GC_CARD_N_HEADER_CELLS 1
f91f77e6 97#define SCM_GC_CARD_N_CELLS 256
b17e0ac3 98#define SCM_GC_SIZEOF_CARD SCM_GC_CARD_N_CELLS * sizeof (scm_t_cell)
e618c9a3 99
c8a1bdc4 100#define SCM_GC_CARD_BVEC(card) ((scm_t_c_bvec_long *) ((card)->word_0))
34d19ef6 101#define SCM_GC_SET_CARD_BVEC(card, bvec) \
33c527ec 102 ((card)->word_0 = (SCM) (bvec))
c014a02e 103#define SCM_GC_GET_CARD_FLAGS(card) ((long) ((card)->word_1))
322ec19d 104#define SCM_GC_SET_CARD_FLAGS(card, flags) \
33c527ec 105 ((card)->word_1 = (SCM) (flags))
e618c9a3 106
33c527ec
MV
107#define SCM_GC_GET_CARD_FLAG(card, shift) \
108 (SCM_GC_GET_CARD_FLAGS (card) & (1L << (shift)))
322ec19d 109#define SCM_GC_SET_CARD_FLAG(card, shift) \
33c527ec 110 (SCM_GC_SET_CARD_FLAGS (card, SCM_GC_GET_CARD_FLAGS(card) | (1L << (shift))))
c8a1bdc4 111#define SCM_GC_CLEAR_CARD_FLAG(card, shift) \
33c527ec 112 (SCM_GC_SET_CARD_FLAGS (card, SCM_GC_GET_CARD_FLAGS(card) & ~(1L << (shift))))
e618c9a3 113
1383773b
HWN
114/*
115 Remove card flags. They hamper lazy initialization, and aren't used
116 anyways.
117 */
e618c9a3
ML
118
119/* card addressing. for efficiency, cards are *always* aligned to
120 SCM_GC_CARD_SIZE. */
121
33c527ec 122#define SCM_GC_CARD_SIZE_MASK (SCM_GC_SIZEOF_CARD-1)
e618c9a3
ML
123#define SCM_GC_CARD_ADDR_MASK (~SCM_GC_CARD_SIZE_MASK)
124
c8a1bdc4 125#define SCM_GC_CELL_CARD(x) ((scm_t_cell *) ((long) (x) & SCM_GC_CARD_ADDR_MASK))
c014a02e 126#define SCM_GC_CELL_OFFSET(x) (((long) (x) & SCM_GC_CARD_SIZE_MASK) >> SCM_CELL_SIZE_SHIFT)
e618c9a3 127#define SCM_GC_CELL_BVEC(x) SCM_GC_CARD_BVEC (SCM_GC_CELL_CARD (x))
c5b0618d 128#define SCM_GC_SET_CELL_BVEC(x, bvec) SCM_GC_SET_CARD_BVEC (SCM_GC_CELL_CARD (x), bvec)
e618c9a3
ML
129#define SCM_GC_CELL_GET_BIT(x) SCM_C_BVEC_GET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
130#define SCM_GC_CELL_SET_BIT(x) SCM_C_BVEC_SET (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
c8a1bdc4 131#define SCM_GC_CELL_CLEAR_BIT(x) SCM_C_BVEC_CLEAR (SCM_GC_CELL_BVEC (x), SCM_GC_CELL_OFFSET (x))
e618c9a3 132
c8a1bdc4 133#define SCM_GC_CARD_UP(x) SCM_GC_CELL_CARD ((char *) (x) + SCM_GC_SIZEOF_CARD - 1)
e618c9a3
ML
134#define SCM_GC_CARD_DOWN SCM_GC_CELL_CARD
135
136/* low level bit banging aids */
c8a1bdc4 137typedef unsigned long scm_t_c_bvec_long;
e618c9a3 138
48c046bc 139#if (SCM_SIZEOF_UNSIGNED_LONG == 8)
c8a1bdc4 140# define SCM_C_BVEC_LONG_BITS 64
e618c9a3
ML
141# define SCM_C_BVEC_OFFSET_SHIFT 6
142# define SCM_C_BVEC_POS_MASK 63
143# define SCM_CELL_SIZE_SHIFT 4
144#else
c8a1bdc4 145# define SCM_C_BVEC_LONG_BITS 32
e618c9a3
ML
146# define SCM_C_BVEC_OFFSET_SHIFT 5
147# define SCM_C_BVEC_POS_MASK 31
148# define SCM_CELL_SIZE_SHIFT 3
149#endif
150
151#define SCM_C_BVEC_OFFSET(pos) (pos >> SCM_C_BVEC_OFFSET_SHIFT)
152
153#define SCM_C_BVEC_GET(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] & (1L << (pos & SCM_C_BVEC_POS_MASK)))
154#define SCM_C_BVEC_SET(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] |= (1L << (pos & SCM_C_BVEC_POS_MASK)))
c8a1bdc4 155#define SCM_C_BVEC_CLEAR(bvec, pos) (bvec[SCM_C_BVEC_OFFSET (pos)] &= ~(1L << (pos & SCM_C_BVEC_POS_MASK)))
e618c9a3
ML
156
157/* testing and changing GC marks */
c8a1bdc4 158#define SCM_GC_MARK_P(x) SCM_GC_CELL_GET_BIT (x)
d09752ff 159
7ddb9baf
HWN
160SCM_INTERNAL void scm_i_ensure_marking(void);
161
162#if (SCM_DEBUG_MARKING_API == 1)
163#define SCM_I_ENSURE_MARKING scm_i_ensure_marking(),
164#else
165#define SCM_I_ENSURE_MARKING
166#endif
167
168#define SCM_SET_GC_MARK(x) SCM_I_ENSURE_MARKING SCM_GC_CELL_SET_BIT (x)
169#define SCM_CLEAR_GC_MARK(x) SCM_I_ENSURE_MARKING SCM_GC_CELL_CLEAR_BIT (x)
1fc8902f
DH
170
171/* Low level cell data accessing macros. These macros should only be used
172 * from within code related to garbage collection issues, since they will
173 * never check the cells they are applied to - not even if guile is compiled
174 * in debug mode. In particular these macros will even work for free cells,
175 * which should never be encountered by user code. */
176
33c527ec
MV
177#define SCM_GC_CELL_OBJECT(x, n) (((SCM *)SCM2PTR (x)) [n])
178#define SCM_GC_CELL_WORD(x, n) (SCM_UNPACK (SCM_GC_CELL_OBJECT ((x), (n))))
179
180#define SCM_GC_SET_CELL_OBJECT(x, n, v) ((((SCM *)SCM2PTR (x)) [n]) = (v))
181#define SCM_GC_SET_CELL_WORD(x, n, v) \
182 (SCM_GC_SET_CELL_OBJECT ((x), (n), SCM_PACK (v)))
183
184#define SCM_GC_CELL_TYPE(x) (SCM_GC_CELL_OBJECT ((x), 0))
1fc8902f
DH
185
186
187/* Except for the garbage collector, no part of guile should ever run over a
188 * free cell. Thus, if guile is compiled in debug mode the SCM_CELL_* and
189 * SCM_SET_CELL_* macros below report an error if they are applied to a free
190 * cell. Some other plausibility checks are also performed. However, if
191 * guile is not compiled in debug mode, there won't be any time penalty at all
192 * when using these macros. */
2549a709 193
406c7d90
DH
194#if (SCM_DEBUG_CELL_ACCESSES == 1)
195# define SCM_VALIDATE_CELL(cell, expr) (scm_assert_cell_valid (cell), (expr))
708cb87c 196#else
61045190 197# define SCM_VALIDATE_CELL(cell, expr) (expr)
708cb87c 198#endif
46d53380 199
f706a58b 200#define SCM_CELL_WORD(x, n) \
1fc8902f 201 SCM_VALIDATE_CELL ((x), SCM_GC_CELL_WORD ((x), (n)))
33c527ec
MV
202#define SCM_CELL_WORD_0(x) SCM_CELL_WORD ((x), 0)
203#define SCM_CELL_WORD_1(x) SCM_CELL_WORD ((x), 1)
204#define SCM_CELL_WORD_2(x) SCM_CELL_WORD ((x), 2)
205#define SCM_CELL_WORD_3(x) SCM_CELL_WORD ((x), 3)
2549a709 206
f706a58b 207#define SCM_CELL_OBJECT(x, n) \
1fc8902f 208 SCM_VALIDATE_CELL ((x), SCM_GC_CELL_OBJECT ((x), (n)))
33c527ec
MV
209#define SCM_CELL_OBJECT_0(x) SCM_CELL_OBJECT ((x), 0)
210#define SCM_CELL_OBJECT_1(x) SCM_CELL_OBJECT ((x), 1)
211#define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT ((x), 2)
212#define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT ((x), 3)
2549a709 213
f706a58b 214#define SCM_SET_CELL_WORD(x, n, v) \
1fc8902f 215 SCM_VALIDATE_CELL ((x), SCM_GC_SET_CELL_WORD ((x), (n), (v)))
33c527ec
MV
216#define SCM_SET_CELL_WORD_0(x, v) SCM_SET_CELL_WORD ((x), 0, (v))
217#define SCM_SET_CELL_WORD_1(x, v) SCM_SET_CELL_WORD ((x), 1, (v))
218#define SCM_SET_CELL_WORD_2(x, v) SCM_SET_CELL_WORD ((x), 2, (v))
219#define SCM_SET_CELL_WORD_3(x, v) SCM_SET_CELL_WORD ((x), 3, (v))
2549a709 220
f706a58b 221#define SCM_SET_CELL_OBJECT(x, n, v) \
1fc8902f 222 SCM_VALIDATE_CELL ((x), SCM_GC_SET_CELL_OBJECT ((x), (n), (v)))
33c527ec
MV
223#define SCM_SET_CELL_OBJECT_0(x, v) SCM_SET_CELL_OBJECT ((x), 0, (v))
224#define SCM_SET_CELL_OBJECT_1(x, v) SCM_SET_CELL_OBJECT ((x), 1, (v))
225#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT ((x), 2, (v))
226#define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT ((x), 3, (v))
2549a709 227
b17e0ac3
MV
228#define SCM_CELL_OBJECT_LOC(x, n) (SCM_VALIDATE_CELL((x), &SCM_GC_CELL_OBJECT ((x), (n))))
229#define SCM_CARLOC(x) (SCM_CELL_OBJECT_LOC ((x), 0))
230#define SCM_CDRLOC(x) (SCM_CELL_OBJECT_LOC ((x), 1))
231
2549a709 232#define SCM_CELL_TYPE(x) SCM_CELL_WORD_0 (x)
33c527ec 233#define SCM_SET_CELL_TYPE(x, t) SCM_SET_CELL_WORD_0 ((x), (t))
2549a709 234
1fc8902f
DH
235/* Freelists consist of linked cells where the type entry holds the value
236 * scm_tc_free_cell and the second entry holds a pointer to the next cell of
237 * the freelist. Due to this structure, freelist cells are not cons cells
238 * and thus may not be accessed using SCM_CAR and SCM_CDR. */
61045190 239
1fc8902f
DH
240#define SCM_FREE_CELL_CDR(x) \
241 (SCM_GC_CELL_OBJECT ((x), 1))
242#define SCM_SET_FREE_CELL_CDR(x, v) \
243 (SCM_GC_SET_CELL_OBJECT ((x), 1, (v)))
61045190 244
61045190 245#if (SCM_DEBUG_CELL_ACCESSES == 1)
eab1b259
HWN
246/* Set this to != 0 if every cell that is accessed shall be checked:
247 */
248SCM_API int scm_debug_cell_accesses_p;
249SCM_API int scm_expensive_debug_cell_accesses_p;
250SCM_API int scm_debug_cells_gc_interval ;
1e71eafb 251void scm_i_expensive_validation_check (SCM cell);
61045190
DH
252#endif
253
102dbb6f 254SCM_INTERNAL scm_i_pthread_mutex_t scm_i_gc_admin_mutex;
eb01cb64 255
b17e0ac3 256#define scm_gc_running_p (SCM_I_CURRENT_THREAD->gc_running_p)
102dbb6f 257SCM_INTERNAL scm_i_pthread_mutex_t scm_i_sweep_mutex;
b17e0ac3 258
9a5fa6e9
NJ
259#ifdef __ia64__
260void *scm_ia64_register_backing_store_base (void);
261void *scm_ia64_ar_bsp (const void *);
262#endif
263
0f2d19dd
JB
264\f
265
c8a1bdc4 266#if (SCM_ENABLE_DEPRECATED == 1)
33b001fd
MV
267SCM_API size_t scm_default_init_heap_size_1;
268SCM_API int scm_default_min_yield_1;
269SCM_API size_t scm_default_init_heap_size_2;
270SCM_API int scm_default_min_yield_2;
271SCM_API size_t scm_default_max_segment_size;
c8a1bdc4
HWN
272#else
273#define scm_default_init_heap_size_1 deprecated
274#define scm_default_min_yield_1 deprecated
275#define scm_default_init_heap_size_2 deprecated
276#define scm_default_min_yield_2 deprecated
277#define scm_default_max_segment_size deprecated
278#endif
279
33b001fd
MV
280
281SCM_API size_t scm_max_segment_size;
c8a1bdc4 282
9de87eea
MV
283#define SCM_SET_FREELIST_LOC(key,ptr) scm_i_pthread_setspecific ((key), (ptr))
284#define SCM_FREELIST_LOC(key) ((SCM *) scm_i_pthread_getspecific (key))
285SCM_API scm_i_pthread_key_t scm_i_freelist;
286SCM_API scm_i_pthread_key_t scm_i_freelist2;
2e945bcc
SJ
287SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist;
288SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist2;
eab1b259 289
33b001fd 290SCM_API unsigned long scm_gc_malloc_collected;
c2cbcc57 291SCM_API int scm_gc_malloc_yield_percentage;
33b001fd
MV
292SCM_API unsigned long scm_mallocated;
293SCM_API unsigned long scm_mtrigger;
294
295SCM_API SCM scm_after_gc_hook;
296
297SCM_API scm_t_c_hook scm_before_gc_c_hook;
298SCM_API scm_t_c_hook scm_before_mark_c_hook;
299SCM_API scm_t_c_hook scm_before_sweep_c_hook;
300SCM_API scm_t_c_hook scm_after_sweep_c_hook;
301SCM_API scm_t_c_hook scm_after_gc_c_hook;
9b3e180c 302
bb2c57fa 303#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
2e945bcc
SJ
304#if (SCM_ENABLE_DEPRECATED == 1)
305SCM scm_map_free_list (void);
306#else
c8a1bdc4
HWN
307#define scm_map_free_list deprecated
308#define scm_free_list_length deprecated
bb2c57fa 309#endif
2e945bcc 310#endif
c8a1bdc4
HWN
311
312#if (SCM_ENABLE_DEPRECATED == 1) && defined (GUILE_DEBUG_FREELIST)
33b001fd 313SCM_API SCM scm_gc_set_debug_check_freelist_x (SCM flag);
88256b2e 314#endif
0f2d19dd 315\f
0f2d19dd 316
61045190 317#if (SCM_DEBUG_CELL_ACCESSES == 1)
33b001fd 318SCM_API void scm_assert_cell_valid (SCM);
61045190 319#endif
c8a1bdc4
HWN
320
321SCM_API SCM scm_set_debug_cell_accesses_x (SCM flag);
322
323
33b001fd 324SCM_API SCM scm_object_address (SCM obj);
33b001fd 325SCM_API SCM scm_gc_stats (void);
1367aa5e 326SCM_API SCM scm_gc_live_object_stats (void);
33b001fd 327SCM_API SCM scm_gc (void);
c8a1bdc4
HWN
328SCM_API void scm_gc_for_alloc (struct scm_t_cell_type_statistics *freelist);
329SCM_API SCM scm_gc_for_newcell (struct scm_t_cell_type_statistics *master, SCM *freelist);
102dbb6f 330SCM_INTERNAL void scm_i_gc (const char *what);
33b001fd
MV
331SCM_API void scm_gc_mark (SCM p);
332SCM_API void scm_gc_mark_dependencies (SCM p);
333SCM_API void scm_mark_locations (SCM_STACKITEM x[], unsigned long n);
c8a1bdc4 334SCM_API int scm_in_heap_p (SCM value);
33b001fd 335SCM_API void scm_gc_sweep (void);
4c9419ac
MV
336
337SCM_API void *scm_malloc (size_t size);
ba1b2226 338SCM_API void *scm_calloc (size_t size);
4c9419ac
MV
339SCM_API void *scm_realloc (void *mem, size_t size);
340SCM_API char *scm_strdup (const char *str);
341SCM_API char *scm_strndup (const char *str, size_t n);
342SCM_API void scm_gc_register_collectable_memory (void *mem, size_t size,
343 const char *what);
344SCM_API void scm_gc_unregister_collectable_memory (void *mem, size_t size,
345 const char *what);
39e8f371 346SCM_API void *scm_gc_calloc (size_t size, const char *what);
4c9419ac
MV
347SCM_API void *scm_gc_malloc (size_t size, const char *what);
348SCM_API void *scm_gc_realloc (void *mem, size_t old_size,
349 size_t new_size, const char *what);
350SCM_API void scm_gc_free (void *mem, size_t size, const char *what);
351SCM_API char *scm_gc_strdup (const char *str, const char *what);
352SCM_API char *scm_gc_strndup (const char *str, size_t n, const char *what);
353
33b001fd
MV
354SCM_API void scm_remember_upto_here_1 (SCM obj);
355SCM_API void scm_remember_upto_here_2 (SCM obj1, SCM obj2);
356SCM_API void scm_remember_upto_here (SCM obj1, ...);
aca3618f 357
c1ffdc6a
KR
358/* In GCC we can force a reference to an SCM by making it an input to an
359 empty asm. This avoids the code size and slowdown of an actual function
360 call. Unfortunately there doesn't seem to be any way to do the varargs
361 scm_remember_upto_here like this.
362
363 __volatile__ ensures nothing will be moved across the asm, and it won't
364 be optimized away (or only if proved unreachable). Constraint "g" can be
365 used on all processors and allows any memory or general register (or
366 immediate) operand. The actual asm syntax doesn't matter, we don't want
367 to use it, just ensure the operand is still alive. See "Extended Asm" in
368 the GCC manual for more. */
aca3618f
KR
369
370#ifdef __GNUC__
371#define scm_remember_upto_here_1(x) \
372 do { \
373 __asm__ __volatile__ ("" : : "g" (x)); \
374 } while (0)
375#define scm_remember_upto_here_2(x, y) \
376 do { \
377 scm_remember_upto_here_1 (x); \
378 scm_remember_upto_here_1 (y); \
379 } while (0)
380#endif
381
33b001fd
MV
382SCM_API SCM scm_return_first (SCM elt, ...);
383SCM_API int scm_return_first_int (int x, ...);
384SCM_API SCM scm_permanent_object (SCM obj);
385SCM_API SCM scm_gc_protect_object (SCM obj);
386SCM_API SCM scm_gc_unprotect_object (SCM obj);
387SCM_API void scm_gc_register_root (SCM *p);
388SCM_API void scm_gc_unregister_root (SCM *p);
389SCM_API void scm_gc_register_roots (SCM *b, unsigned long n);
390SCM_API void scm_gc_unregister_roots (SCM *b, unsigned long n);
c35738c1 391SCM_API void scm_storage_prehistory (void);
33b001fd
MV
392SCM_API int scm_init_storage (void);
393SCM_API void *scm_get_stack_base (void);
102dbb6f 394SCM_INTERNAL void scm_init_gc (void);
d1ca2c64 395
d678e25c
MV
396#if SCM_ENABLE_DEPRECATED == 1
397
398SCM_API SCM scm_deprecated_newcell (void);
399SCM_API SCM scm_deprecated_newcell2 (void);
400
401#define SCM_NEWCELL(_into) \
402 do { _into = scm_deprecated_newcell (); } while (0)
403#define SCM_NEWCELL2(_into) \
404 do { _into = scm_deprecated_newcell2 (); } while (0)
405
539b08a4
MV
406SCM_API void * scm_must_malloc (size_t len, const char *what);
407SCM_API void * scm_must_realloc (void *where,
408 size_t olen, size_t len,
409 const char *what);
410SCM_API char *scm_must_strdup (const char *str);
411SCM_API char *scm_must_strndup (const char *str, size_t n);
412SCM_API void scm_done_malloc (long size);
413SCM_API void scm_done_free (long size);
414SCM_API void scm_must_free (void *obj);
415
d678e25c
MV
416#endif
417
61045190 418#endif /* SCM_GC_H */
89e00824
ML
419
420/*
421 Local Variables:
422 c-file-style: "gnu"
423 End:
424*/