GCC Middle and Back End API Reference
ggc-internal.h File Reference
#include "ggc.h"
Include dependency graph for ggc-internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ggc_statistics

Typedefs

typedef struct ggc_statistics ggc_statistics

Functions

void ggc_mark_roots (void)
void ggc_mark_stringpool (void)
void ggc_purge_stringpool (void)
void gt_pch_save_stringpool (void)
void gt_pch_fixup_stringpool (void)
void gt_pch_restore_stringpool (void)
void gt_pch_p_S (void *, void *, gt_pointer_operator, void *)
struct ggc_pch_datainit_ggc_pch (void)
void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool)
size_t ggc_pch_total_size (struct ggc_pch_data *)
void ggc_pch_this_base (struct ggc_pch_data *, void *)
char * ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool)
void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *)
void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *, void *, size_t, bool)
void ggc_pch_finish (struct ggc_pch_data *, FILE *)
void ggc_pch_read (FILE *, void *)
void ggc_record_overhead (size_t, size_t, void *FINAL_MEM_STAT_DECL)
void ggc_free_overhead (void *)
void ggc_prune_overhead_list (void)
size_t ggc_get_size (const void *)
void ggc_print_common_statistics (FILE *, ggc_statistics *)

Variables

bool ggc_force_collect

Typedef Documentation

Statistics. This structure contains the statistics common to all collectors. Particular collectors can extend this structure.


Function Documentation

void ggc_free_overhead ( void *  )
size_t ggc_get_size ( const void *  )

Return the number of bytes allocated at the indicated address.

void ggc_mark_roots ( void  )

Garbage collection for the GNU compiler. Internal definitions for ggc-*.c and stringpool.c.

Copyright (C) 2009-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/. Call ggc_set_mark on all the roots.

Iterate through all registered roots and mark each element.

Now scan all hash tables that have objects which are to be deleted if they are not already marked.

 Some plugins may call ggc_set_mark from here.   

References ggc_internal_alloc_stat(), and PASS_MEM_STAT.

void ggc_mark_stringpool ( void  )

Stringpool. Mark the entries in the string pool.

Mark the trees hanging off the identifier node for GGC. These are handled specially (not using gengtype) because identifiers are only roots during one part of compilation.

char* ggc_pch_alloc_object ( struct ggc_pch_data ,
void *  ,
size_t  ,
bool   
)

Assuming that the objects really do end up at the address passed to ggc_pch_this_base, return the address of this object. The bool argument should be true if the object is a string.

void ggc_pch_count_object ( struct ggc_pch_data ,
void *  ,
size_t  ,
bool   
)

The second parameter and third parameters give the address and size of an object. Update the ggc_pch_data structure with as much of that information as is necessary. The bool argument should be true if the object is a string.

void ggc_pch_finish ( struct ggc_pch_data ,
FILE *   
)

All objects have been written, write out any final information required.

void ggc_pch_prepare_write ( struct ggc_pch_data ,
FILE *   
)

Write out any initial information required.

Nothing to do.

void ggc_pch_read ( FILE *  ,
void *   
)

A PCH file has just been read in at the address specified second parameter. Set up the GC implementation for the new objects.

void ggc_pch_this_base ( struct ggc_pch_data ,
void *   
)

The objects, when read, will most likely be at the address in the second parameter.

size_t ggc_pch_total_size ( struct ggc_pch_data )

Return the total size of the data to be written to hold all the objects previously passed to ggc_pch_count_object.

void ggc_pch_write_object ( struct ggc_pch_data ,
FILE *  ,
void *  ,
void *  ,
size_t  ,
bool   
)

Write out this object, including any padding. The last argument should be true if the object is a string.

 If SIZE is not the same as OBJECT_SIZE(order), then we need to pad the
 object out to OBJECT_SIZE(order).  This happens for strings.   
     To speed small writes, we use a nulled-out array that's larger
     than most padding requests as the source for our null bytes.  This
     permits us to do the padding with fwrite() rather than fseek(), and
     limits the chance the OS may try to flush any outstanding writes.   
         Larger than our buffer?  Just default to fseek.   
void ggc_print_common_statistics ( FILE *  ,
ggc_statistics  
)

Used by the various collectors to gather and print statistics that do not depend on the collector in use.

 Set the pointer so that during collection we will actually gather
 the statistics.   
 Then do one collection to fill in the statistics.   
 At present, we don't really gather any interesting statistics.   
 Don't gather statistics any more.   
void ggc_prune_overhead_list ( void  )

After live values has been marked, walk all recorded pointers and see if they are still live.

void ggc_purge_stringpool ( void  )

Purge the entries in the string pool.

Purge the identifier hash of identifiers which are no longer referenced.

References CONST_CAST, gt_pch_note_object(), and gt_pch_p_S().

void ggc_record_overhead ( size_t  ,
size_t  ,
void *  FINAL_MEM_STAT_DECL 
)
void gt_pch_fixup_stringpool ( void  )

Return the stringpool to its state before gt_pch_save_stringpool was called.

void gt_pch_p_S ( void *  obj,
void *  x,
gt_pointer_operator  op,
void *  cookie 
)

PCH and GGC handling for strings, mostly trivial.

Pointer-walking routine for strings (not very interesting, since strings don't contain pointers).

References gt_pch_n_S().

Referenced by ggc_purge_stringpool().

void gt_pch_restore_stringpool ( void  )

A PCH file has been restored, which loaded SPD; fill the real hash table from SPD.

void gt_pch_save_stringpool ( void  )

Save and restore the string pool entries for PCH.

Save the stringpool data in SPD.

References string_pool_data::entries, ident_hash, string_pool_data::nelements, string_pool_data::nslots, and NULL.

struct ggc_pch_data* init_ggc_pch ( void  )
read

Return a new ggc_pch_data structure.

References page_entry::bytes.


Variable Documentation

bool ggc_force_collect

Allocation and collection. When set, ggc_collect will do collection.

Simple garbage collection for the GNU compiler. Copyright (C) 1999-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/. Generic garbage collection (GC) functions and data, not specific to any particular GC implementation. When set, ggc_collect will do collection.