2 |
- |
1 |
/* Copyright (C) 1994, 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: igc.h,v 1.9 2004/09/28 05:34:29 giles Exp $ */
|
|
|
18 |
/* Internal interfaces in Ghostscript GC */
|
|
|
19 |
|
|
|
20 |
#ifndef igc_INCLUDED
|
|
|
21 |
# define igc_INCLUDED
|
|
|
22 |
|
|
|
23 |
#include "istruct.h"
|
|
|
24 |
|
|
|
25 |
/* Declare the vm_reclaim procedure for the real GC. */
|
|
|
26 |
extern vm_reclaim_proc(gs_gc_reclaim);
|
|
|
27 |
|
|
|
28 |
/* Define the procedures shared among a "genus" of structures. */
|
|
|
29 |
/* Currently there are only two genera: refs, and all other structures. */
|
|
|
30 |
struct struct_shared_procs_s {
|
|
|
31 |
|
|
|
32 |
/* Clear the relocation information in an object. */
|
|
|
33 |
|
|
|
34 |
#define gc_proc_clear_reloc(proc)\
|
|
|
35 |
void proc(obj_header_t *pre, uint size)
|
|
|
36 |
gc_proc_clear_reloc((*clear_reloc));
|
|
|
37 |
|
|
|
38 |
/* Compute any internal relocation for a marked object. */
|
|
|
39 |
/* Return true if the object should be kept. */
|
|
|
40 |
/* The reloc argument shouldn't be required, */
|
|
|
41 |
/* but we need it for ref objects. */
|
|
|
42 |
|
|
|
43 |
#define gc_proc_set_reloc(proc)\
|
|
|
44 |
bool proc(obj_header_t *pre, uint reloc, uint size)
|
|
|
45 |
gc_proc_set_reloc((*set_reloc));
|
|
|
46 |
|
|
|
47 |
/* Compact an object. */
|
|
|
48 |
|
|
|
49 |
#define gc_proc_compact(proc)\
|
|
|
50 |
void proc(const gs_memory_t *cmem, obj_header_t *pre, obj_header_t *dpre, uint size)
|
|
|
51 |
gc_proc_compact((*compact));
|
|
|
52 |
|
|
|
53 |
};
|
|
|
54 |
|
|
|
55 |
/* Define the structure for holding GC state. */
|
|
|
56 |
/*typedef struct gc_state_s gc_state_t; *//* in gsstruct.h */
|
|
|
57 |
#ifndef name_table_DEFINED
|
|
|
58 |
# define name_table_DEFINED
|
|
|
59 |
typedef struct name_table_s name_table;
|
|
|
60 |
#endif
|
|
|
61 |
struct gc_state_s {
|
|
|
62 |
const gc_procs_with_refs_t *procs; /* must be first */
|
|
|
63 |
chunk_locator_t loc;
|
|
|
64 |
vm_spaces spaces;
|
|
|
65 |
int min_collect; /* avm_space */
|
|
|
66 |
bool relocating_untraced; /* if true, we're relocating */
|
|
|
67 |
/* pointers from untraced spaces */
|
|
|
68 |
gs_memory_t *heap; /* for extending mark stack */
|
|
|
69 |
name_table *ntable; /* (implicitly referenced by names) */
|
|
|
70 |
#ifdef DEBUG
|
|
|
71 |
chunk_t *container;
|
|
|
72 |
#endif
|
|
|
73 |
};
|
|
|
74 |
|
|
|
75 |
/* Exported by igcref.c for igc.c */
|
|
|
76 |
ptr_proc_unmark(ptr_ref_unmark);
|
|
|
77 |
ptr_proc_mark(ptr_ref_mark);
|
|
|
78 |
/*ref_packed *gs_reloc_ref_ptr(const ref_packed *, gc_state_t *); */
|
|
|
79 |
|
|
|
80 |
/* Exported by ilocate.c for igc.c */
|
|
|
81 |
void ialloc_validate_memory(const gs_ref_memory_t *, gc_state_t *);
|
|
|
82 |
void ialloc_validate_chunk(const chunk_t *, gc_state_t *);
|
|
|
83 |
void ialloc_validate_object(const obj_header_t *, const chunk_t *,
|
|
|
84 |
gc_state_t *);
|
|
|
85 |
|
|
|
86 |
/* Exported by igc.c for ilocate.c */
|
|
|
87 |
const gs_memory_t * gcst_get_memory_ptr(gc_state_t *gcst);
|
|
|
88 |
|
|
|
89 |
/* Macro for returning a relocated pointer */
|
|
|
90 |
const void *print_reloc_proc(const void *obj, const char *cname,
|
|
|
91 |
const void *robj);
|
|
|
92 |
#ifdef DEBUG
|
|
|
93 |
# define print_reloc(obj, cname, nobj)\
|
|
|
94 |
(gs_debug_c('9') ? print_reloc_proc(obj, cname, nobj) : nobj)
|
|
|
95 |
#else
|
|
|
96 |
# define print_reloc(obj, cname, nobj) (nobj)
|
|
|
97 |
#endif
|
|
|
98 |
|
|
|
99 |
#endif /* igc_INCLUDED */
|