source: branches/arm/lisp-kernel/constants.h @ 13923

Last change on this file since 13923 was 13717, checked in by gb, 9 years ago

Try to move platform-independent definitions to constants.h, to
lessen redundancy a bit. (Should do this on trunk, too.)

File size: 5.6 KB
Line 
1/*
2   Copyright (C) 2009 Clozure Associates
3   Copyright (C) 1994-2001 Digitool, Inc
4   This file is part of Clozure CL. 
5
6   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7   License , known as the LLGPL and distributed with Clozure CL as the
8   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9   which is distributed with Clozure CL as the file "LGPL".  Where these
10   conflict, the preamble takes precedence. 
11
12   Clozure CL is referenced in the preamble as the "LIBRARY."
13
14   The LLGPL is also available online at
15   http://opensource.franz.com/preamble.html
16*/
17
18#define TCR_FLAG_BIT_FOREIGN fixnumshift
19#define TCR_FLAG_BIT_AWAITING_PRESET (fixnumshift+1)
20#define TCR_FLAG_BIT_ALT_SUSPEND (fixnumshift+2)
21#define TCR_FLAG_BIT_PROPAGATE_EXCEPTION (fixnumshift+3)
22#define TCR_FLAG_BIT_SUSPEND_ACK_PENDING (fixnumshift+4)
23#define TCR_FLAG_BIT_PENDING_EXCEPTION (fixnumshift+5)
24#define TCR_FLAG_BIT_FOREIGN_EXCEPTION (fixnumshift+6)
25#define TCR_FLAG_BIT_PENDING_SUSPEND (fixnumshift+7)
26
27#define TCR_STATE_FOREIGN (1)
28#define TCR_STATE_LISP    (0)
29#define TCR_STATE_EXCEPTION_WAIT (2)
30#define TCR_STATE_EXCEPTION_RETURN (4)
31
32#define dnode_size (node_size*2)
33#define dnode_shift (node_shift+1)
34
35#define INTERRUPT_LEVEL_BINDING_INDEX (1)
36
37/*  Order of CAR and CDR doesn't seem to matter much - there aren't */
38/*  too many tricks to be played with predecrement/preincrement addressing. */
39/*  Keep them in the confusing MCL 3.0 order, to avoid confusion. */
40
41typedef struct cons {
42  LispObj cdr;
43  LispObj car;
44} cons;
45
46
47
48typedef struct lispsymbol {
49  LispObj header;
50  LispObj pname;
51  LispObj vcell;
52  LispObj fcell;
53  LispObj package_predicate;
54  LispObj flags;
55  LispObj plist;
56  LispObj binding_index;
57} lispsymbol;
58
59typedef struct ratio {
60  LispObj header;
61  LispObj numer;
62  LispObj denom;
63} ratio;
64
65typedef struct macptr {
66  LispObj header;
67  LispObj address;
68  LispObj class;
69  LispObj type;
70} macptr;
71
72typedef struct xmacptr {
73  LispObj header;
74  LispObj address;
75  LispObj class;
76  LispObj type;
77  LispObj flags;
78  LispObj link;
79} xmacptr;
80 
81
82
83typedef struct special_binding {
84  struct special_binding *link;
85  struct lispsymbol *sym;
86  LispObj value;
87} special_binding;
88
89
90/* The GC (at least) needs to know what a
91   package looks like, so that it can do GCTWA. */
92typedef struct package {
93  LispObj header;
94  LispObj itab;                 /* itab and etab look like (vector (fixnum . fixnum) */
95  LispObj etab;
96  LispObj used;
97  LispObj used_by;
98  LispObj names;
99  LispObj shadowed;
100} package;
101
102
103/*
104  The GC (at least) needs to know about hash-table-vectors and their flag bits.
105*/
106
107typedef struct hash_table_vector_header {
108  LispObj header;
109  LispObj link;                 /* If weak */
110  LispObj flags;                /* a fixnum; see below */
111  LispObj gc_count;             /* gc-count kernel global */
112  LispObj free_alist;           /* preallocated conses for finalization_alist */
113  LispObj finalization_alist;   /* key/value alist for finalization */
114  LispObj weak_deletions_count; /* incremented when GC deletes weak pair */
115  LispObj hash;                 /* backpointer to hash-table */
116  LispObj deleted_count;        /* number of deleted entries [not maintained if lock-free] */
117  LispObj count;                /* number of valid entries [not maintained if lock-free] */
118  LispObj cache_idx;            /* index of last cached pair */
119  LispObj cache_key;            /* value of last cached key */
120  LispObj cache_value;          /* last cached value */
121  LispObj size;                 /* number of entries in table */
122  LispObj size_reciprocal;      /* shifted reciprocal of size */
123} hash_table_vector_header;
124
125
126
127/*
128  Bits (masks)  in hash_table_vector.flags:
129*/
130
131/* GC should track keys when addresses change */ 
132#define nhash_track_keys_mask fixnum_bitmask(28)
133
134/* GC should set when nhash_track_keys_bit & addresses change */
135#define nhash_key_moved_mask  fixnum_bitmask(27)
136
137/* weak on key or value (need new "weak both" encoding.) */
138#define nhash_weak_mask       fixnum_bitmask(12)
139
140/* weak on value */
141#define nhash_weak_value_mask fixnum_bitmask(11)
142
143/* finalizable */
144#define nhash_finalizable_mask fixnum_bitmask(10)
145
146/* keys frozen, i.e. don't clobber keys, only values */
147#define nhash_keys_frozen_mask fixnum_bitmask(9)
148
149/* Lfun bits */
150
151#define lfbits_nonnullenv_mask fixnum_bitmask(0)
152#define lfbits_keys_mask fixnum_bitmask(1)
153#define lfbits_restv_mask fixnum_bitmask(7)
154#define lfbits_optinit_mask fixnum_bitmask(14)
155#define lfbits_rest_mask fixnum_bitmask(15)
156#define lfbits_aok_mask fixnum_bitmask(16)
157#define lfbits_lap_mask fixnum_bitmask(23)
158#define lfbits_trampoline_mask fixnum_bitmask(24)
159#define lfbits_evaluated_mask fixnum_bitmask(25)
160#define lfbits_cm_mask fixnum_bitmask(26)         /* combined_method */
161#define lfbits_nextmeth_mask fixnum_bitmask(26)   /* or call_next_method with method_mask */
162#define lfbits_gfn_mask fixnum_bitmask(27)        /* generic_function */
163#define lfbits_nextmeth_with_args_mask fixnum_bitmask(27)   /* or call_next_method_with_args with method_mask */
164#define lfbits_method_mask fixnum_bitmask(28)     /* method function */
165#define lfbits_noname_mask fixnum_bitmask(29)
166
167
168#define population_weak_list (0<<fixnum_shift)
169#define population_weak_alist (1<<fixnum_shift)
170#define population_termination_bit (16+fixnum_shift)
171#define population_type_mask ((1<<population_termination_bit)-1)
172
173#define gc_retain_pages_bit fixnum_bitmask(0)
174#define gc_integrity_check_bit fixnum_bitmask(2)
175#define egc_verbose_bit fixnum_bitmask(3)
176#define gc_verbose_bit fixnum_bitmask(4)
177#define gc_allow_stack_overflows_bit fixnum_bitmask(5)
178#define gc_postgc_pending fixnum_bitmask(26)
179
Note: See TracBrowser for help on using the repository browser.