source: branches/working-0711/ccl/lisp-kernel/gc.h @ 7644

Last change on this file since 7644 was 7644, checked in by gb, 12 years ago

Prototypes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/*
2   Copyright (C) 1994-2001 Digitool, Inc
3   This file is part of OpenMCL. 
4
5   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with OpenMCL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with OpenMCL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   OpenMCL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17#ifndef __GC_H__
18#define __GC_H__ 1
19
20#include "lisp.h"
21#include "bits.h"
22#include "lisp-exceptions.h"
23#include "memprotect.h"
24
25
26
27#ifdef PPC
28#define is_node_fulltag(f)  ((1<<(f))&((1<<fulltag_cons)|(1<<fulltag_misc)))
29#ifdef PPC64
30#define PPC64_CODE_VECTOR_PREFIX (('C'<< 24) | ('O' << 16) | ('D' << 8) | 'E')
31#else
32/*
33  A code-vector's header can't look like a valid instruction or UUO:
34  the low 8 bits must be subtag_code_vector, and the top 6 bits
35  must be 0.  That means that the maximum length of a code vector
36  is 18 bits worth of elements (~1MB.)
37*/
38
39#define code_header_mask ((0x3f<<26) | subtag_code_vector)
40#endif
41#endif
42
43#ifdef X86
44#ifdef X8664
45#define is_node_fulltag(f)  ((1<<(f))&((1<<fulltag_cons)    | \
46                                       (1<<fulltag_tra_0)   | \
47                                       (1<<fulltag_tra_1)   | \
48                                       (1<<fulltag_misc)    | \
49                                       (1<<fulltag_symbol)  | \
50                                       (1<<fulltag_function)))
51#else
52#endif
53#endif
54
55
56extern void zero_memory_range(BytePtr,BytePtr);
57extern LispObj GCarealow, GCareadynamiclow;
58extern natural GCndnodes_in_area, GCndynamic_dnodes_in_area;
59extern bitvector GCmarkbits, GCdynamic_markbits;
60LispObj *global_reloctab, *GCrelocptr;
61LispObj GCfirstunmarked;
62
63extern natural lisp_heap_gc_threshold;
64void mark_root(LispObj);
65void mark_pc_root(LispObj);
66void mark_locative_root(LispObj);
67void rmark(LispObj);
68void postGCfree(void *);
69LispObj *skip_over_ivector(LispObj, LispObj);
70void mark_simple_area_range(LispObj *,LispObj *);
71LispObj calculate_relocation();
72LispObj locative_forwarding_address(LispObj);
73LispObj node_forwarding_address(LispObj);
74void forward_range(LispObj *, LispObj *);
75void note_memoized_references(ExceptionInformation *,LogicalAddress, LogicalAddress, BytePtr *, BytePtr *);
76void gc(TCR *, signed_natural);
77int  purify(TCR *, signed_natural);
78int impurify(TCR *, signed_natural);
79int change_hons_area_size(TCR *, signed_natural);
80void delete_protected_area(protected_area_ptr);
81Boolean egc_control(Boolean, BytePtr);
82Boolean free_segments_zero_filled_by_OS;
83
84/* an type representing 1/4 of a natural word */
85#if WORD_SIZE == 64
86typedef unsigned short qnode;
87#else
88typedef unsigned char qnode;
89#endif
90
91
92#ifdef fulltag_symbol
93#define is_symbol_fulltag(x) (fulltag_of(x) == fulltag_symbol)
94#else
95#define is_symbol_fulltag(x) (fulltag_of(x) == fulltag_misc)
96#endif
97
98#define area_dnode(w,low) ((natural)(((ptr_to_lispobj(w)) - ptr_to_lispobj(low))>>dnode_shift))
99#define gc_area_dnode(w)  area_dnode(w,GCarealow)
100#define gc_dynamic_area_dnode(w) area_dnode(w,GCareadynamiclow)
101
102#ifdef PPC64
103#define forward_marker subtag_forward_marker
104#else
105#define forward_marker fulltag_nil
106#endif
107
108#ifdef PPC64
109#define VOID_ALLOCPTR ((LispObj)(0x8000000000000000-dnode_size))
110#else
111#define VOID_ALLOCPTR ((LispObj)(-dnode_size))
112#endif
113
114
115#define GC_TRAP_FUNCTION_IMMEDIATE_GC (-1)
116#define GC_TRAP_FUNCTION_GC 0
117#define GC_TRAP_FUNCTION_PURIFY 1
118#define GC_TRAP_FUNCTION_IMPURIFY 2
119#define GC_TRAP_FUNCTION_SAVE_APPLICATION 8
120
121#define GC_TRAP_FUNCTION_GET_LISP_HEAP_THRESHOLD 16
122#define GC_TRAP_FUNCTION_SET_LISP_HEAP_THRESHOLD 17
123#define GC_TRAP_FUNCTION_USE_LISP_HEAP_THRESHOLD 18
124#define GC_TRAP_FUNCTION_EGC_CONTROL 32
125#define GC_TRAP_FUNCTION_CONFIGURE_EGC 64
126#define GC_TRAP_FUNCTION_SET_HONS_AREA_SIZE 128 /* deprecated */
127#define GC_TRAP_FUNCTION_FREEZE 129
128#define GC_TRAP_FUNCTION_THAW 130
129
130Boolean GCDebug, GCverbose, just_purified_p;
131bitvector GCmarkbits, GCdynamic_markbits;
132LispObj GCarealow, GCareadynamiclow;
133natural GCndnodes_in_area, GCndynamic_dnodes_in_area;
134LispObj GCweakvll;
135LispObj GCephemeral_low;
136natural GCn_ephemeral_dnodes;
137natural GCstack_limit;
138
139#if WORD_SIZE == 64
140unsigned short *_one_bits;
141#else
142const unsigned char _one_bits[256];
143#endif
144
145#define one_bits(x) _one_bits[x]
146
147natural static_dnodes_for_area(area *a);
148void reapweakv(LispObj weakv);
149void reaphashv(LispObj hashv);
150Boolean mark_weak_hash_vector(hash_table_vector_header *hashp, natural elements);
151Boolean mark_weak_alist(LispObj weak_alist, int weak_type);
152void markhtabvs(void);
153void mark_tcr_tlb(TCR *);
154void mark_tcr_xframes(TCR *);
155void postGCfree(void *);
156void freeGCptrs(void);
157void reap_gcable_ptrs(void);
158unsigned short logcount16(unsigned short);
159void gc_init(void);
160LispObj node_forwarding_address(LispObj);
161Boolean update_noderef(LispObj *);
162void update_locref(LispObj *);
163void forward_gcable_ptrs(void);
164void forward_memoized_area(area *, natural);
165void forward_tcr_tlb(TCR *);
166void reclaim_static_dnodes(void);
167Boolean youngest_non_null_area_p(area *);
168void gc(TCR *, signed_natural);
169
170/* backend-interface */
171
172void mark_root(LispObj);
173void mark_xp(ExceptionInformation *);
174LispObj dnode_forwarding_address(natural, int);
175LispObj locative_forwarding_address(LispObj);
176void check_refmap_consistency(LispObj *, LispObj *, bitvector);
177void check_all_areas(void);
178void mark_tstack_area(area *);
179void mark_vstack_area(area *);
180void mark_cstack_area(area *);
181void mark_simple_area_range(LispObj *, LispObj *);
182void mark_memoized_area(area *, natural);
183LispObj calculate_relocation(void);
184void forward_range(LispObj *, LispObj *);
185void forward_tstack_area(area *);
186void forward_vstack_area(area *);
187void forward_cstack_area(area *);
188LispObj compact_dynamic_heap(void);
189LispObj * skip_over_ivector(natural, LispObj);
190int purify(TCR *, signed_natural);
191int impurify(TCR *, signed_natural);
192
193#endif                          /* __GC_H__ */
Note: See TracBrowser for help on using the repository browser.