source: release/1.9/source/lisp-kernel/constants.h @ 16083

Last change on this file since 16083 was 14144, checked in by gb, 9 years ago

Reinstate foreign_fpe tcr flag bit.

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