GCC Middle and Back End API Reference
ggc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ggc_root_tab
struct  ggc_cache_tab

Typedefs

typedef void(* gt_note_pointers )(void *, void *, gt_pointer_operator, void *)
typedef void(* gt_handle_reorder )(void *, void *, gt_pointer_operator, void *)
typedef void(* gt_pointer_walker )(void *)

Functions

int gt_pch_note_object (void *, void *, gt_note_pointers)
void gt_pch_note_reorder (void *, void *, gt_handle_reorder)
int ggc_set_mark (const void *)
int ggc_marked_p (const void *)
void gt_pch_n_S (const void *)
void gt_ggc_m_S (const void *)
void init_stringpool (void)
void init_ggc (void)
void gt_pch_save (FILE *f)
void * ggc_internal_alloc_stat (size_t MEM_STAT_DECL) ATTRIBUTE_MALLOC
size_t ggc_round_alloc_size (size_t requested_size)
void * ggc_internal_cleared_alloc_stat (size_t MEM_STAT_DECL) ATTRIBUTE_MALLOC
void * ggc_realloc_stat (void *, size_t MEM_STAT_DECL)
void ggc_free (void *)
void dump_ggc_loc_statistics (bool)
static void * ggc_internal_vec_alloc_stat ()
static void * ggc_internal_cleared_vec_alloc_stat ()
static void * ggc_alloc_atomic_stat ()
void * ggc_cleared_alloc_htab_ignore_args (size_t, size_t) ATTRIBUTE_MALLOC
void * ggc_cleared_alloc_ptr_array_two_args (size_t, size_t) ATTRIBUTE_MALLOC
void * ggc_splay_alloc (int, void *) ATTRIBUTE_MALLOC
void ggc_splay_dont_free (void *, void *)
const char * ggc_alloc_string_stat (const char *contents, int length MEM_STAT_DECL)
void ggc_collect (void)
void ggc_register_root_tab (const struct ggc_root_tab *)
void ggc_register_cache_tab (const struct ggc_cache_tab *)
void gt_pch_restore (FILE *f)
void ggc_print_statistics (void)
void stringpool_statistics (void)
void init_ggc_heuristics (void)
static struct rtx_defggc_alloc_rtx_def_stat ()
static union tree_node * ggc_alloc_tree_node_stat ()
static union tree_node * ggc_alloc_cleared_tree_node_stat ()
static struct
gimple_statement_base
ggc_alloc_cleared_gimple_statement_stat ()

Variables

const char empty_string []
struct ggc_root_tab *const gt_ggc_rtab []
struct ggc_root_tab *const gt_ggc_deletable_rtab []
struct ggc_root_tab *const gt_pch_cache_rtab []
struct ggc_root_tab *const gt_pch_scalar_rtab []
struct ggc_cache_tab *const gt_ggc_cache_rtab []
bool ggc_protect_identifiers

Typedef Documentation

typedef void(* gt_handle_reorder)(void *, void *, gt_pointer_operator, void *)
   One of these is called before objects are re-ordered in memory.
   The first parameter is the original object, the second is the
   subobject that has had its pointers reordered, the third parameter
   can compute the new values of a pointer when given the cookie in
   the fourth parameter.  
typedef void(* gt_note_pointers)(void *, void *, gt_pointer_operator, void *)
   Internal functions and data structures used by the GTY
   machinery, including the generated gt*.[hc] files.  
   One of these applies its third parameter (with cookie in the fourth
   parameter) to each pointer in the object pointed to by the first
   parameter, using the second parameter.  
typedef void(* gt_pointer_walker)(void *)
   Mark the object in the first parameter and anything it points to.  

Function Documentation

void dump_ggc_loc_statistics ( bool  )
static void* ggc_alloc_atomic_stat ( )
inlinestatic
static struct gimple_statement_base* ggc_alloc_cleared_gimple_statement_stat ( )
staticread
static union tree_node* ggc_alloc_cleared_tree_node_stat ( )
staticwrite
static struct rtx_def* ggc_alloc_rtx_def_stat ( )
staticread
   Memory statistics passing versions of some allocators.  Too few of them to
   make gengtype produce them, so just define the needed ones here.  
const char* ggc_alloc_string_stat ( const char *  contents,
int length  MEM_STAT_DECL 
)
   Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
   If LENGTH is -1, then CONTENTS is assumed to be a
   null-terminated string and the memory sized accordingly.  
static union tree_node* ggc_alloc_tree_node_stat ( )
staticwrite
void* ggc_cleared_alloc_htab_ignore_args ( size_t  ,
size_t   
)
void* ggc_cleared_alloc_ptr_array_two_args ( size_t  ,
size_t   
)
void ggc_collect ( void  )
   Invoke the collector.  Garbage collection occurs only when this
   function is called, not during allocations.  
   Top level mark-and-sweep routine.  
     Avoid frequent unnecessary work by skipping collection if the
     total allocations haven't expanded much since the last
     collection.  
     Zero the total allocated bytes.  This will be recalculated in the
     sweep phase.  
     Release the pages we freed the last time we collected, but didn't
     reuse in the interim.  
     Indicate that we've seen collections at this context depth.  

References ggc_pch_data::base, ggc_pch_data::d, and ggc_pch_ondisk::totals.

Referenced by ggc_splay_alloc(), and gcc::pass_manager::pass_manager().

void ggc_free ( void *  )
   Free a block.  To be used when known for certain it's not reachable.  
void* ggc_internal_alloc_stat ( size_t  MEM_STAT_DECL)
   Allocation.  
   The internal primitive.  
void* ggc_internal_cleared_alloc_stat ( size_t  MEM_STAT_DECL)
   Allocates cleared memory.  
static void* ggc_internal_cleared_vec_alloc_stat ( )
inlinestatic
static void* ggc_internal_vec_alloc_stat ( )
inlinestatic
int ggc_marked_p ( const void *  )
   Return 1 if P has been marked, zero otherwise.
   P must have been allocated by the GC allocator; it mustn't point to
   static objects, stack variables, or memory allocated with malloc.  
void ggc_print_statistics ( void  )
   Statistics.  
   Print allocation statistics.  
     Clear the statistics.  
     Make sure collection will really occur.  
     Collect and print the statistics common across collectors.  
     Release free pages so that we will not count the bytes allocated
     there as part of the total allocated memory.  
     Collect some information about the various sizes of
     allocation.  
         Skip empty entries.  
         Figure out the total number of bytes allocated for objects of
         this size, and how many of them are actually in use.  Also figure
         out how much memory the page table is using.  

References fatal_error().

void* ggc_realloc_stat ( void *  ,
size_t  MEM_STAT_DECL 
)
   Resize a block.  
void ggc_register_cache_tab ( const struct ggc_cache_tab )
   Register an additional cache table.  This can be useful for some
   plugins.  Does nothing if the passed pointer is NULL. 
void ggc_register_root_tab ( const struct ggc_root_tab )
   Register an additional root table.  This can be useful for some
   plugins.  Does nothing if the passed pointer is NULL. 
size_t ggc_round_alloc_size ( size_t  requested_size)
int ggc_set_mark ( const void *  )
   Actually set the mark on a particular region of memory, but don't
   follow pointers.  This function is called by ggc_mark_*.  It
   returns zero if the object was not previously marked; nonzero if
   the object was already marked, or if, for any other reason,
   pointers in this data structure should not be traversed.  
void* ggc_splay_alloc ( int  ,
void *   
)
void ggc_splay_dont_free ( void *  ,
void *   
)
void gt_ggc_m_S ( const void *  )
void gt_pch_n_S ( const void *  )
   PCH and GGC handling for strings, mostly trivial.  

Referenced by gt_pch_p_S().

int gt_pch_note_object ( void *  obj,
void *  note_ptr_cookie,
gt_note_pointers  note_ptr_fn 
)
   Used by the gt_pch_n_* routines.  Register an object in the hash table.  
   Register an object in the hash table.  

References hash_table< Descriptor, Allocator >::find_with_hash(), ptr_data::note_ptr_cookie, and ptr_data::reorder_fn.

Referenced by ggc_purge_stringpool().

void gt_pch_note_reorder ( void *  obj,
void *  note_ptr_cookie,
gt_handle_reorder  reorder_fn 
)
   Used by the gt_pch_n_* routines.  Register that an object has a reorder
   function.  
   Register an object in the hash table.  
void gt_pch_restore ( FILE *  f)
   Read objects previously saved with gt_pch_save from F.  
void gt_pch_save ( FILE *  f)
   Write out all GCed objects to F.  
void init_ggc ( void  )
   Initialize the garbage collector.  
   Initialize the ggc-mmap allocator.  
     StunOS has an amazing off-by-one error for the first mmap allocation
     after fiddling with RLIMIT_STACK.  The result, as hard as it is to
     believe, is an unaligned page allocation, which would cause us to
     hork badly if we tried to use it.  
           How losing.  Discard this one and try another.  If we still
           can't get something useful, give up.  
       We have a good page, might as well hold onto it...  
     Initialize the object size table.  
         If S is not a multiple of the MAX_ALIGNMENT, then round it up
         so that we're sure of getting aligned memory.  
     Initialize the objects-per-page and inverse tables.  
     Reset the size_lookup array to put appropriately sized objects in
     the special orders.  All objects bigger than the previous power
     of two, but no greater than the special size, should go in the
     new order.  
void init_ggc_heuristics ( void  )
   Heuristics.  
void init_stringpool ( void  )
   End of GTY machinery API.  
   Initialize the string pool.  
   Initialize the string pool.  
     Create with 16K (2^14) entries.  
void stringpool_statistics ( void  )
   Report some basic statistics about the string pool.  

References ggc_marked_p().


Variable Documentation

const char empty_string[]
   Symbols are marked with `ggc' for `gcc gc' so as not to interfere with
   an external gc library that might be linked in.  
   Constants for general use.  
@verbatim 

String pool for GCC. Copyright (C) 2000-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

   String text, identifier text and identifier node allocator.
   Identifiers are uniquely stored in a hash table.

   We use cpplib's hash table implementation.  libiberty's
   hashtab.c is not used because it requires 100% average space
   overhead per string, which is unacceptable.  Also, this algorithm
   is faster.  
   The "" allocated string.  

Referenced by maybe_emit_atomic_exchange().

bool ggc_protect_identifiers
   When true, identifier nodes are considered as GC roots.  When
   false, identifier nodes are treated like any other GC-allocated
   object, and the identifier hash table is treated as a weak
   hash.  
   When true, protect the contents of the identifier hash table.  
struct ggc_cache_tab* const gt_ggc_cache_rtab[]
   Pointers to arrays of ggc_cache_tab, terminated by NULL.  
struct ggc_root_tab* const gt_ggc_deletable_rtab[]

Referenced by ggc_mark_root_tab().

struct ggc_root_tab* const gt_ggc_rtab[]
   Pointers to arrays of ggc_root_tab, terminated by NULL.  

Referenced by ggc_mark_root_tab().

struct ggc_root_tab* const gt_pch_cache_rtab[]
struct ggc_root_tab* const gt_pch_scalar_rtab[]