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

source code of gcc/ggc-internal.h