This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Symtab node table introduction and GGC issues
- From: Martin Liška <mliska at suse dot cz>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 24 Jul 2014 16:23:29 +0100
- Subject: Symtab node table introduction and GGC issues
- Authentication-results: sourceware.org; auth=none
Hello,
I would like to encapsulate all symtab_nodes to a class called 'symtab'. To respect gcc:context, I would like to add the class to global context (gcc::context) and I have troubles with GTY and GGC.
design:
class GTY(()) symtab
{
public:
symtab_node* GTY(()) nodes;
};
class GTY(()) context
{
public:
context () {}
void init ();
/* Pass-management. */
pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
/* Handling dump files. */
dump_manager *get_dumps () {gcc_assert (m_dumps); return m_dumps; }
/* Symbol table. */
symtab *get_symtab () { gcc_assert (symbol_table); return symbol_table; }
/* Symbol table. */
symtab * GTY(()) symbol_table;
private:
/* Pass-management. */
pass_manager * GTY((skip)) m_passes;
/* Dump files. */
dump_manager * GTY((skip)) m_dumps;
}; // class context
} // namespace gcc
/* The global singleton context aka "g".
(the name is chosen to be easy to type in a debugger). */
extern GTY(()) gcc::context *g;
gcc:context in created by g = ggc_cleared_alloc<gcc::context> (); and g->symbol_table too.
My problem is that during pg_pch_restore:
#3 0x0000000000850043 in gt_pch_restore (f=0x1ac9100) at ../../gcc/ggc-common.c:691
When I add watch to *(&g), gcc::context *g is restored ^ and gcc:context::m_passes and gcc:context::m_dumps are set to an inaccessible address.
Is my GGC construct correct?
Thank you,
Martin