Commit | Line | Data |
---|---|---|
c7743d02 | 1 | /* |
cb90e2cb HWN |
2 | * private-gc.h - private declarations for garbage collection. |
3 | * | |
6cc323e2 | 4 | * Copyright (C) 2002, 03, 04, 05, 06, 07, 08, 09 Free Software Foundation, Inc. |
cb90e2cb HWN |
5 | * |
6 | * This library is free software; you can redistribute it and/or | |
53befeb7 NJ |
7 | * modify it under the terms of the GNU Lesser General Public License |
8 | * as published by the Free Software Foundation; either version 3 of | |
9 | * the License, or (at your option) any later version. | |
cb90e2cb | 10 | * |
53befeb7 NJ |
11 | * This library is distributed in the hope that it will be useful, but |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
cb90e2cb HWN |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | * 02110-1301 USA | |
cb90e2cb | 20 | */ |
c7743d02 | 21 | |
760fb97d LC |
22 | #ifndef SCM_PRIVATE_GC |
23 | #define SCM_PRIVATE_GC | |
c7743d02 HWN |
24 | |
25 | #include "_scm.h" | |
26 | ||
27 | /* {heap tuning parameters} | |
28 | * | |
29 | * These are parameters for controlling memory allocation. The heap | |
30 | * is the area out of which scm_cons, and object headers are allocated. | |
31 | * | |
32 | * Each heap cell is 8 bytes on a 32 bit machine and 16 bytes on a | |
33 | * 64 bit machine. The units of the _SIZE parameters are bytes. | |
34 | * Cons pairs and object headers occupy one heap cell. | |
c7743d02 HWN |
35 | */ |
36 | ||
37 | ||
c7743d02 HWN |
38 | #define SCM_DEFAULT_INIT_HEAP_SIZE_2 32*1024 |
39 | ||
1383773b | 40 | #define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0) |
c7743d02 HWN |
41 | |
42 | ||
760fb97d | 43 | SCM_INTERNAL int scm_getenv_int (const char *var, int def); |
c7743d02 HWN |
44 | |
45 | ||
46 | typedef enum { return_on_error, abort_on_error } policy_on_error; | |
47 | ||
c7743d02 HWN |
48 | |
49 | #define SCM_MAX(A, B) ((A) > (B) ? (A) : (B)) | |
50 | #define SCM_MIN(A, B) ((A) < (B) ? (A) : (B)) | |
51 | ||
d3774e2c MV |
52 | /* CELL_P checks a random word whether it has the right form for a |
53 | pointer to a cell. Use scm_i_find_heap_segment_containing_object | |
54 | to find out whether it actually points to a real cell. | |
55 | ||
56 | The right form for a cell pointer is this: the low three bits must | |
57 | be scm_tc3_cons, and when the scm_tc3_cons tag is stripped, the | |
58 | resulting pointer must be correctly aligned. | |
59 | scm_i_initialize_heap_segment_data guarantees that the test below | |
60 | works. | |
61 | */ | |
62 | #define CELL_P(x) ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons) | |
c7743d02 | 63 | |
b359b36a LC |
64 | SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */ |
65 | ||
c7743d02 | 66 | #endif |