GCC Middle and Back End API Reference
|
Data Structures | |
struct | ptr_data |
struct | saving_hasher |
struct | traversal_state |
struct | mmap_info |
struct | loc_descriptor |
struct | loc_desc_hasher |
struct | ptr_hash_entry |
struct | ptr_hash_hasher |
Typedefs | |
typedef struct ggc_root_tab * | const_ggc_root_tab_t |
typedef struct ggc_cache_tab * | const_ggc_cache_tab_t |
Variables | |
bool | ggc_force_collect |
bool | ggc_protect_identifiers = true |
static ggc_statistics * | ggc_stats |
static vec< const_ggc_root_tab_t > | extra_root_vec |
static vec< const_ggc_cache_tab_t > | extra_cache_vec |
static hash_table< saving_hasher > | saving_htab |
static hash_table < loc_desc_hasher > | loc_hash |
static hash_table < ptr_hash_hasher > | ptr_hash |
static struct loc_descriptor ** | loc_array |
typedef struct ggc_cache_tab* const_ggc_cache_tab_t |
This extra vector of dynamically registered cache_tab-s is used by ggc_mark_roots and gives the ability to dynamically add new GGC cache tables, for instance from some plugins; this vector is on the heap since it is used by GGC internally.
typedef struct ggc_root_tab* const_ggc_root_tab_t |
This extra vector of dynamically registered root_tab-s is used by ggc_mark_roots and gives the ability to dynamically add new GGC root tables, for instance from some plugins; this vector is on the heap since it is used by GGC internally.
|
static |
Helper for qsort; sort descriptors by amount of memory consumed.
References loc_descriptor::allocated, loc_descriptor::collected, loc_descriptor::freed, and loc_descriptor::overhead.
Referenced by dump_ggc_loc_statistics().
|
static |
Referenced by gt_pch_save().
|
static |
Callback for qsort.
References ptr_data::new_addr.
size_t default_gt_pch_alloc_granularity | ( | void | ) |
Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS. Return the alignment required for allocating virtual memory. Usually this is the same as pagesize.
References getpagesize().
void* default_gt_pch_get_address | ( | size_t | size, |
int | fd | ||
) |
Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is not present. Select no address whatsoever, and let gt_pch_save choose what it will with malloc, presumably.
int default_gt_pch_use_address | ( | void * | base, |
size_t | size, | ||
int | fd, | ||
size_t | offset | ||
) |
Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is not present. Allocate SIZE bytes with malloc. Return 0 if the address we got is the same as base, indicating that the memory has been allocated but needs to be read in from the file. Return -1 if the address differs, to relocation of the PCH file would be required.
void dump_ggc_loc_statistics | ( | ) |
Dump per-site memory statistics.
References loc_descriptor::allocated, cmp_statistic(), loc_descriptor::collected, hash_table< Descriptor, Allocator >::elements_with_deleted(), loc_descriptor::file, final_cmp_statistic(), loc_descriptor::freed, loc_descriptor::function, ggc_add_statistics(), ggc_collect(), ggc_force_collect, loc_descriptor::line, loc_descriptor::overhead, strstr(), times(), loc_descriptor::times, and hash_table< Descriptor, Allocator >::traverse().
Referenced by dump_memory_report().
|
static |
Helper for qsort; sort descriptors by amount of memory consumed.
References loc_descriptor::allocated, loc_descriptor::freed, and loc_descriptor::overhead.
Referenced by dump_ggc_loc_statistics().
int ggc_add_statistics | ( | ) |
Referenced by dump_ggc_loc_statistics().
int ggc_call_alloc | ( | ) |
References traversal_state::d, ggc_pch_alloc_object(), gt_pch_p_S(), ptr_data::new_addr, ptr_data::note_ptr_fn, ptr_data::obj, traversal_state::ptrs, traversal_state::ptrs_i, and ptr_data::size.
Referenced by gt_pch_save().
int ggc_call_count | ( | ) |
Callbacks for htab_traverse.
References traversal_state::count, traversal_state::d, ggc_pch_count_object(), gt_pch_p_S(), ptr_data::note_ptr_fn, ptr_data::obj, and ptr_data::size.
Referenced by gt_pch_save().
void* ggc_cleared_alloc_htab_ignore_args | ( | size_t | c, |
size_t | n | ||
) |
void* ggc_cleared_alloc_ptr_array_two_args | ( | ) |
TODO: once we actually use type information in GGC, create a new tag gt_gcc_ptr_array and use it for pointer arrays.
void ggc_free_overhead | ( | ) |
Notice that the pointer has been freed.
References hash_table< Descriptor, Allocator >::clear_slot(), hash_table< Descriptor, Allocator >::find_slot_with_hash(), free(), loc_descriptor::freed, ptr_hash_entry::loc, and ptr_hash_entry::size.
Referenced by ggc_free().
|
static |
Referenced by ggc_scan_cache_tab().
|
static |
Maintain global roots that are preserved during GC.
Process a slot of an htab by deleting it if it has not been marked.
References ggc_cache_tab::base, ggc_cache_tab::cb, and ggc_cache_tab::marked_p.
void* ggc_internal_cleared_alloc_stat | ( | ) |
Allocate a block of memory, then clear it.
References ggc_internal_alloc_stat(), and memset().
Referenced by ggc_alloc_cleared_gimple_statement_stat(), ggc_alloc_cleared_tree_node_stat(), and ggc_internal_cleared_vec_alloc_stat().
|
static |
Mark all the roots in the table RT.
References ggc_root_tab::base, ggc_root_tab::cb, ggc_root_tab::nelt, and ggc_root_tab::stride.
Referenced by ggc_mark_roots().
void ggc_mark_roots | ( | void | ) |
Iterate through all registered roots and mark each element.
References ggc_root_tab::base, ggc_mark_root_tab(), ggc_mark_stringpool(), ggc_protect_identifiers, ggc_purge_stringpool(), ggc_scan_cache_tab(), gt_ggc_cache_rtab, gt_ggc_deletable_rtab, gt_ggc_rtab, invoke_plugin_callbacks(), memset(), and ggc_root_tab::stride.
Referenced by ggc_collect().
|
static |
Heuristic to set a default for GGC_MIN_EXPAND.
References ggc_rlimit_bound().
Referenced by ggc_min_heapsize_heuristic(), and init_ggc_heuristics().
|
static |
Heuristic to set a default for GGC_MIN_HEAPSIZE.
References getrlimit(), ggc_min_expand_heuristic(), and ggc_rlimit_bound().
Referenced by init_ggc_heuristics().
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.
References ggc_collect(), and stats.
Referenced by ggc_print_statistics().
void ggc_prune_overhead_list | ( | void | ) |
After live values has been marked, walk all recorded pointers and see if they are still live.
References ggc_prune_ptr(), and hash_table< Descriptor, Allocator >::traverse().
Referenced by ggc_collect().
int ggc_prune_ptr | ( | ) |
Helper function for prune_overhead_list. See if SLOT is still marked and remove it from hashtable if it is not.
References hash_table< Descriptor, Allocator >::clear_slot(), loc_descriptor::collected, free(), ggc_marked_p(), ptr_hash_entry::loc, ptr_hash_entry::ptr, and ptr_hash_entry::size.
Referenced by ggc_prune_overhead_list().
void* ggc_realloc_stat | ( | ) |
Resize a block of memory, possibly re-allocating it.
References ggc_free(), ggc_get_size(), ggc_internal_alloc_stat(), and memcpy().
Referenced by va_gc::reserve().
void ggc_record_overhead | ( | size_t | allocated, |
size_t | overhead, | ||
void * | ptr, | ||
const char * | name, | ||
int | line, | ||
const char * | function | ||
) |
Record ALLOCATED and OVERHEAD bytes to descriptor NAME:LINE (FUNCTION).
References ptr_hash_entry::allocated, loc_descriptor::allocated, hash_table< Descriptor, Allocator >::create(), hash_table< Descriptor, Allocator >::find_slot_with_hash(), hash_table< Descriptor, Allocator >::is_created(), ptr_hash_entry::loc, make_loc_descriptor(), loc_descriptor::overhead, ptr_hash_entry::ptr, ptr_hash_entry::size, and loc_descriptor::times.
Referenced by ggc_internal_alloc_stat().
void ggc_register_cache_tab | ( | ) |
Dynamically register a new GGC cache table CT. This is useful for plugins.
Referenced by register_callback().
void ggc_register_root_tab | ( | ) |
Dynamically register a new GGC root table RT. This is useful for plugins.
Referenced by register_callback().
|
static |
Modify the bound based on rlimits.
References getrlimit(), and limit.
Referenced by ggc_min_expand_heuristic(), and ggc_min_heapsize_heuristic().
|
static |
Scan a hash table that has objects which are to be deleted if they are not already marked.
References ggc_cache_tab::base, ggc_htab_delete(), and ggc_set_mark().
Referenced by ggc_mark_roots().
void* ggc_splay_alloc | ( | ) |
These are for splay_tree_new_ggc.
void ggc_splay_dont_free | ( | ) |
int gt_pch_note_object | ( | void * | obj, |
void * | note_ptr_cookie, | ||
gt_note_pointers | note_ptr_fn | ||
) |
Register an object in the hash table.
References hash_table< Descriptor, Allocator >::find_slot_with_hash(), ggc_get_size(), gt_pch_p_S(), ptr_data::note_ptr_cookie, ptr_data::note_ptr_fn, ptr_data::obj, and strlen().
Referenced by gt_pch_n_S(), and gt_pch_nx().
void gt_pch_note_reorder | ( | void * | obj, |
void * | note_ptr_cookie, | ||
gt_handle_reorder | reorder_fn | ||
) |
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.
void gt_pch_restore | ( | ) |
Read the state of the compiler back in from F.
References ggc_root_tab::base, fatal_error(), ggc_pch_read(), gt_ggc_deletable_rtab, gt_ggc_rtab, gt_pch_cache_rtab, gt_pch_restore_stringpool(), gt_pch_scalar_rtab, host_hooks::gt_pch_use_address, memset(), ggc_root_tab::nelt, mmap_info::offset, mmap_info::preferred_base, mmap_info::size, and ggc_root_tab::stride.
void gt_pch_save | ( | ) |
Write out the state of the compiler to F.
References ggc_root_tab::base, compare_ptr_data(), traversal_state::count, hash_table< Descriptor, Allocator >::create(), traversal_state::d, hash_table< Descriptor, Allocator >::dispose(), traversal_state::f, fatal_error(), ggc_call_alloc(), ggc_call_count(), ggc_pch_finish(), ggc_pch_prepare_write(), ggc_pch_this_base(), ggc_pch_total_size(), ggc_pch_write_object(), gt_ggc_rtab, host_hooks::gt_pch_alloc_granularity, gt_pch_cache_rtab, gt_pch_fixup_stringpool(), host_hooks::gt_pch_get_address, gt_pch_p_S(), gt_pch_save_stringpool(), gt_pch_scalar_rtab, init_ggc_pch(), memcpy(), ggc_root_tab::nelt, ptr_data::new_addr, ptr_data::note_ptr_cookie, ptr_data::note_ptr_fn, ptr_data::obj, mmap_info::offset, ggc_root_tab::pchw, mmap_info::preferred_base, traversal_state::ptrs, traversal_state::ptrs_i, relocate_ptrs(), ptr_data::reorder_fn, ptr_data::size, mmap_info::size, ggc_root_tab::stride, timevar_pop(), timevar_push(), hash_table< Descriptor, Allocator >::traverse(), vNULL, and write_pch_globals().
void init_ggc_heuristics | ( | void | ) |
Heuristics.
References ggc_min_expand_heuristic(), ggc_min_heapsize_heuristic(), and set_default_param_value().
Referenced by general_init().
|
staticread |
Return descriptor for given call site, create new one if needed.
References hash_table< Descriptor, Allocator >::create(), loc_descriptor::file, hash_table< Descriptor, Allocator >::find_slot(), loc_descriptor::function, hash_table< Descriptor, Allocator >::is_created(), and loc_descriptor::line.
Referenced by ggc_record_overhead().
void* mmap_gt_pch_get_address | ( | ) |
Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is present. We temporarily allocate SIZE bytes, and let the kernel place the data wherever it will. If it worked, that's our spot, if not we're likely to be in trouble.
int mmap_gt_pch_use_address | ( | ) |
Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is present. Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at mapping the data at BASE, -1 if we couldn't. This version assumes that the kernel honors the START operand of mmap even without MAP_FIXED if START through START+SIZE are not currently mapped with something.
|
static |
Referenced by gt_pch_save().
|
static |
Callbacks for note_ptr_fn.
References hash_table< Descriptor, Allocator >::find_with_hash(), and ptr_data::new_addr.
|
static |
Write out, after relocation, the pointers in TAB.
References ggc_root_tab::base, traversal_state::f, fatal_error(), hash_table< Descriptor, Allocator >::find_with_hash(), ggc_root_tab::nelt, ptr_data::new_addr, and ggc_root_tab::stride.
Referenced by gt_pch_save().
|
static |
|
static |
bool ggc_force_collect |
@verbatim 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.
Referenced by dump_ggc_loc_statistics(), and ggc_collect().
bool ggc_protect_identifiers = true |
When true, protect the contents of the identifier hash table.
Referenced by compile_file(), do_compile(), and ggc_mark_roots().
|
static |
Statistics about the allocation.
|
static |
Collect array of the descriptors from hashtable.
|
static |
Hashtable used for statistics.
|
static |
Hashtable converting address of allocated field to loc descriptor.
|
static |