OSDN Git Service

* ja.po: Update.
[pf3gnuchains/gcc-fork.git] / gcc / ggc-internal.h
1 /* Garbage collection for the GNU compiler.  Internal definitions
2    for ggc-*.c and stringpool.c.
3
4    Copyright (C) 2009, 2010 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #ifndef GCC_GGC_INTERNAL_H
23 #define GCC_GGC_INTERNAL_H
24
25 #include "ggc.h"
26
27 /* Call ggc_set_mark on all the roots.  */
28 extern void ggc_mark_roots (void);
29
30 /* Stringpool.  */
31
32 /* Mark the entries in the string pool.  */
33 extern void ggc_mark_stringpool (void);
34
35 /* Purge the entries in the string pool.  */
36 extern void ggc_purge_stringpool (void);
37
38 /* Save and restore the string pool entries for PCH.  */
39
40 extern void gt_pch_save_stringpool (void);
41 extern void gt_pch_fixup_stringpool (void);
42 extern void gt_pch_restore_stringpool (void);
43
44 /* PCH and GGC handling for strings, mostly trivial.  */
45 extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *);
46
47 /* PCH.  */
48
49 struct ggc_pch_data;
50
51 /* Return a new ggc_pch_data structure.  */
52 extern struct ggc_pch_data *init_ggc_pch (void);
53
54 /* The second parameter and third parameters give the address and size
55    of an object.  Update the ggc_pch_data structure with as much of
56    that information as is necessary. The bool argument should be true
57    if the object is a string.  */
58 extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool,
59                                   enum gt_types_enum);
60
61 /* Return the total size of the data to be written to hold all
62    the objects previously passed to ggc_pch_count_object.  */
63 extern size_t ggc_pch_total_size (struct ggc_pch_data *);
64
65 /* The objects, when read, will most likely be at the address
66    in the second parameter.  */
67 extern void ggc_pch_this_base (struct ggc_pch_data *, void *);
68
69 /* Assuming that the objects really do end up at the address
70    passed to ggc_pch_this_base, return the address of this object.
71    The bool argument should be true if the object is a string.  */
72 extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool,
73                                    enum gt_types_enum);
74
75 /* Write out any initial information required.  */
76 extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *);
77
78 /* Write out this object, including any padding.  The last argument should be
79    true if the object is a string.  */
80 extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *,
81                                   void *, size_t, bool);
82
83 /* All objects have been written, write out any final information
84    required.  */
85 extern void ggc_pch_finish (struct ggc_pch_data *, FILE *);
86
87 /* A PCH file has just been read in at the address specified second
88    parameter.  Set up the GC implementation for the new objects.  */
89 extern void ggc_pch_read (FILE *, void *);
90
91
92 /* Allocation and collection.  */
93
94 /* When set, ggc_collect will do collection.  */
95 extern bool ggc_force_collect;
96
97 extern void ggc_record_overhead (size_t, size_t, void * MEM_STAT_DECL);
98
99 extern void ggc_free_overhead (void *);
100
101 extern void ggc_prune_overhead_list (void);
102
103 /* Return the number of bytes allocated at the indicated address.  */
104 extern size_t ggc_get_size (const void *);
105
106
107 /* Statistics.  */
108
109 /* This structure contains the statistics common to all collectors.
110    Particular collectors can extend this structure.  */
111 typedef struct ggc_statistics
112 {
113   /* At present, we don't really gather any interesting statistics.  */
114   int unused;
115 } ggc_statistics;
116
117 /* Used by the various collectors to gather and print statistics that
118    do not depend on the collector in use.  */
119 extern void ggc_print_common_statistics (FILE *, ggc_statistics *);
120
121 #endif