ggc-internal.h 3.9 KB

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