Commit 9cd64686 by Mark Mitchell Committed by Mark Mitchell

Get ready for garbage collection.

	* Makefile.in (CXX_TREE_H): Add varray.h
	(lex.o): Depend on ggc.h.
	(decl.o): Likewise.
	(decl2.o): Likewise.
	(method.o): Likewise.
	(search.o): Likewise.
	(pt.o): Likewise.
	(repo.o): Likewise.
	* class.c: Include ggc.h.
	(current_class_name): Remove.
	(current_class_type): Likewise.
	(current_access_specifier): Likewise.
	(previous_class_type): Likewise.
	(previous_class_values): Likewise.
	(class_cache_firstobj): Likewise.
	(current_lang_base): Likewise.
	(current_lang_stack): Likewise.
	(current_lang_stacksize): Likewise.
	(lang_name_c): Likewise.
	(lang_name_cplusplus): Likewise.
	(lang_name_java): Likewise.
	(current_lang_name): Likewise.
	(base_layout_decl): Likewise.
	(access_default_node): Likewise.
	(access_public_node): Likewise.
	(access_protected_node): Likewise.
	(access_private_node): Likewise.
	(access_default_virtual_node): Likewise.
	(access_public_virtual_node): Likewise.
	(access_protected_virtual_node): Likewise.
	(access_private_virtual_node): Likewise.
	(signed_zero_node): Likewise.
	(init_class_processing): Don't build base_layout_decl.
	(push_lang_context): Adjust now that current_lang_base is a varray.
	(pop_lang_context): Likewise.
	* cp-tree.h: Include varray.h.
	(cp_global_trees): Add access_default, access_public,
	access_protected, access_private, access_default_virtual,
	access_public_virtual, access_protected_virtual,
	access_private_virtual, ctor_identifier, delta2_identifier,
	delta_identifier, dtor_identifier, in_charge_identifier,
	index_identifier, nelts_identifier, this_identifier,
	pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
	lang_name_c, lang_name_cplusplus, lang_name_java,
	empty_except_spec, null, jclass, minus_one, terminate.
	(saved_scope): Move here from decl.c.  Define globals in terms of
	saved_scope: current_namespace, current_class_name,
	current_class_type, current_access_specifier, current_lang_stack,
	current_lang_base, current_lang_name, current_function_parms,
	current_template_parms, processing_template_decl,
	processing_specialization, processing_explicit_instantiation,
	previous_class_type, previous_class_values, class_cache_firstobj.
	(scope_chain): New variable.
	(init_pt): New function.
	* decl.c (current_namespace): Remove.
	(this_identifier, in_charge_identifier, ctor_identifier): Likewise.
	(dtor_identifier, pfn_identifier, index_identifier): Likewise.
	(delta_identifier, delta2_identifier): Likewise.
	(pfn_or_delta2_identifier, tag_identifier): Likewise
	(vt_off_identifier, empty_except_spec, null_node): Likewise.
	(current_function_parms, current_lang_base): Remove.
	(current_lang_stack, previous_class_values): Remove.
	(class_binding_level): Macroize.
	(saved_scope): Remove.
	(current_saved_scope): Rename to scope_chain.
	(mark_saved_scope): Adjust for new scope structure.
	(maybe_push_to_top_level): Likewise.
	(pop_from_top_level): Likewise.
	(duplicate_decls): Adjust now that current_lang_base is a varray.
	(build_typename_type): Call ggc_add_tree_hash_table_root.
	(init_decl_processing): Call init_pt.  Call push_to_top_level to
	set up globals.  Add GC roots.
	(xref_basetypes): Adjust now that current_lang_base is a varray.
	* decl.h (this_identifier): Remove.
	(in_charge_identifier): Likewise.
	* decl2.c: Don't include varray.h.
	(current_namespace): Remove.
	(init_decl2): Add GC roots.
	* except.c (Terminate): Remove.
	(init_exception_processing): Use terminate_node instead.
	(build_terminate_handler): Likewise.
	* init.c (nc_nelts_field_id): Remove.
	(minus_one): Likewise.
	(init_init_processing): Use minus_one_node and nelts_identifier
	instead.  Add GC roots.
	(jclass_node): Remove.
	(build_new_1): Use nelts_identifier.
	(build_vec_init): Likewise.
	(build_vec_delete): Likewise.
	* lex.c: Include ggc.h.
	(defarg_fn): Move declaration early.
	(defarg_parms): Likewise.
	(init_parse): Add GC roots.
	(handle_cp_pragma): Remove redundant declaration of
	pending_vtables.
	* method.c: Include ggc.h.
	(btypelist): Make it a varray.  All uses changed.
	(ktypelist): Likewise.
	(init_method): Add GC roots.
	* pt.c: Don't include varray.h.  Include ggc.h.
	(current_template_parms): Remove.
	(processing_template_decl): Likewise.
	(processing_specialization): Likewise.
	(processing_explicit_instantiation): Likewise.
	(init_pt): New function.
	* repo.c: Include ggc.h.
	(init_repo): Add GC roots.
	* search.c: Don't include varray.h.
	(_vptr_name): Remove.
	(lookup_field_1): Use vtpr_identifier instead.
	(expand_indirect_vtbls_init): Remove redundant declaration of
	in_charge_identifier.
	(init_search_processing): Use vptr_identifier.

From-SVN: r29135
parent 565e3f3e
1999-09-05 Mark Mitchell <mark@codesourcery.com>
Get ready for garbage collection.
* Makefile.in (CXX_TREE_H): Add varray.h
(lex.o): Depend on ggc.h.
(decl.o): Likewise.
(decl2.o): Likewise.
(method.o): Likewise.
(search.o): Likewise.
(pt.o): Likewise.
(repo.o): Likewise.
* clas.c: Include ggc.h.
(current_class_name): Remove.
(current_class_type): Likewise.
(current_access_specifier): Likewise.
(previous_class_type): Likewise.
(previous_class_values): Likewise.
(class_cache_firstobj): Likewise.
(current_lang_base): Likewise.
(current_lang_stack): Likewise.
(current_lang_stacksize): Likewise.
(lang_name_c): Likewise.
(lang_name_cplusplus): Likewise.
(lang_name_java): Likewise.
(current_lang_name): Likewise.
(base_layout_decl): Likewise.
(access_default_node): Likewise.
(access_public_node): Likewise.
(access_protected_node): Likewise.
(access_private_node): Likewise.
(access_default_virtual_node): Likewise.
(access_public_virtual_node): Likewise.
(access_protected_virtual_node): Likewise.
(access_private_virtual_node): Likewise.
(signed_zero_node): Likewise.
(init_class_processing): Don't build base_layout_decl.
(push_lang_context): Adjust now that current_lang_base is a varray.
(pop_lang_context): Likewise.
* cp-tree.h: Include varray.h.
(cp_global_trees): Add access_default, access_public,
access_protected, access_private, access_default_virtual,
access_public_virtual, access_protected_virtual,
access_private_virtual, ctor_identifier, delta2_identifier,
delta_identifier, dtor_identifier, in_charge_identifier,
index_identifier, nelts_identifier, this_identifier,
pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
lang_name_c, lang_name_cplusplus, lang_name_java,
empty_except_spec, null, jclass, minus_one, terminate.
(saved_scope): Move here from decl.c. Define globals in terms of
saved_scope: current_namespace, current_class_name,
current_class_type, current_access_specifier, current_lang_stack,
current_lang_base, current_lang_name, current_function_parms,
current_template_parms, processing_template_decl,
processing_specialization, processing_explicit_instantiation,
previous_class_type, previous_class_values, class_cache_firstobj.
(scope_chain): New variable.
(init_pt): New function.
* decl.c (current_namespace): Remove.
(this_identifier, in_charge_identifier, ctor_identifier): Likewise.
(dtor_identifier, pfn_identifier, index_identifier): Likewise.
(delta_identifier, delta2_identifier): Likewise.
(pfn_or_delta2_identifier, tag_identifier): Likewise
(vt_off_identifier, empty_except_spec, null_node): Likewise.
(current_function_parms, current_lang_base): Remove.
(current_lang_stack, previous_class_values): Remove.
(class_binding_level): Macroize.
(saved_scope): Remove.
(current_saved_scope): Rename to scope_chain.
(mark_saved_scope): Adjust for new scope structure.
(maybe_push_to_top_level): Likewise.
(pop_from_top_level): Likewise.
(duplicate_decls): Adjust now that current_lang_base is a varray.
(build_typename_type): Call ggc_add_tree_hash_table_root.
(init_decl_processing): Call init_pt. Call push_to_top_level to
set up globals. Add GC roots.
(xref_basetypes): Adjust now that current_lang_base is a varray.
* decl.h (this_identifier): Remove.
(in_charge_identifier): Likewise.
* decl2.c: Don't include varray.h.
(current_namespace): Remove.
(init_decl2): Add GC roots.
* except.c (Terminate): Remove.
(init_exception_processing): Use terminate_node instead.
(build_terminate_handler): Likewise.
* init.c (nc_nelts_field_id): Remove.
(minus_one): Likewise.
(init_init_processing): Use minus_one_node and nelts_identifier
instead. Add GC roots.
(jclass_node): Remove.
(build_new_1): Use nelts_identifier.
(build_vec_init): Likewise.
(build_vec_delete): Likewise.
* lex.c: Include ggc.h.
(defarg_fn): Move declaration early.
(defarg_parms): Likewise.
(init_parse): Add GC roots.
(handle_cp_pragma): Remove redundant declaration of
pending_vtables.
* method.c: Include ggc.h.
(btypelist): Make it a varray. All uses changed.
(ktypelist): Likewise.
(init_method): Add GC roots.
* pt.c: Don't include varray.h. Include ggc.h.
(current_template_parms): Remove.
(processing_template_decl): Likewise.
(processing_specialization): Likewise.
(processing_explicit_instantiation): Likewise.
(init_pt): New function.
* repo.c: Include ggc.h.
(init_repo): Add GC roots.
* search.c: Don't include varray.h.
(_vptr_name): Remove.
(lookup_field_1): Use vtpr_identifier instead.
(expand_indirect_vtbls_init): Remove redundant declaration of
in_charge_identifier.
(init_search_processing): Use vptr_identifier.
1999-09-05 Richard Henderson <rth@cygnus.com>
Bernd Schmidt <bernds@cygnus.co.uk>
Mark Mitchell <mark@codesourcery.com>
......
......@@ -202,7 +202,7 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def \
$(srcdir)/../function.h
$(srcdir)/../function.h $(srcdir)/../varray.h
PARSE_H = $(srcdir)/parse.h
PARSE_C = $(srcdir)/parse.c
EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
......@@ -241,17 +241,16 @@ spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \
$(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \
$(srcdir)/../c-pragma.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../output.h $(srcdir)/../mbchar.h
$(srcdir)/../output.h $(srcdir)/../mbchar.h $(srcdir)/../ggc.h
decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \
$(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../hash.h
$(srcdir)/../hash.h $(srcdir)/../ggc.h
decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(EXPR_H) $(srcdir)/../except.h \
$(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \
$(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h \
$(srcdir)/../ggc.h
$(srcdir)/../../include/splay-tree.h $(srcdir)/../ggc.h
typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
......@@ -266,12 +265,11 @@ friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
$(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h
method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \
$(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h
search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \
$(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../varray.h
$(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h
tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
......@@ -284,13 +282,13 @@ expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H) lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
$(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../ggc.h
error.o : error.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
$(srcdir)/../toplev.h $(srcdir)/../ggc.h
semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \
$(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h
dump.o: dump.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h
......
......@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "toplev.h"
#include "splay-tree.h"
#include "ggc.h"
#include "obstack.h"
#define obstack_chunk_alloc xmalloc
......@@ -71,19 +72,8 @@ typedef struct class_stack_node {
static int current_class_stack_size;
static class_stack_node_t current_class_stack;
/* The following two can be derived from the previous one */
tree current_class_name; /* IDENTIFIER_NODE: name of current class */
tree current_class_type; /* _TYPE: the type of the current class */
tree current_access_specifier;
tree previous_class_type; /* _TYPE: the previous type that was a class */
tree previous_class_values; /* TREE_LIST: copy of the class_shadowed list
when leaving an outermost class scope. */
/* The obstack on which the cached class declarations are kept. */
static struct obstack class_cache_obstack;
/* The first object allocated on that obstack. We can use
obstack_free with tis value to free the entire obstack. */
char *class_cache_firstobj;
struct base_info;
......@@ -137,29 +127,6 @@ static tree build_vtbl_initializer PROTO((tree));
static int count_fields PROTO((tree));
static int add_fields_to_vec PROTO((tree, tree, int));
/* Way of stacking language names. */
tree *current_lang_base, *current_lang_stack;
int current_lang_stacksize;
/* Names of languages we recognize. */
tree lang_name_c, lang_name_cplusplus, lang_name_java;
tree current_lang_name;
/* When layout out an aggregate type, the size of the
basetypes (virtual and non-virtual) is passed to layout_record
via this node. */
static tree base_layout_decl;
/* Constants used for access control. */
tree access_default_node; /* 0 */
tree access_public_node; /* 1 */
tree access_protected_node; /* 2 */
tree access_private_node; /* 3 */
tree access_default_virtual_node; /* 4 */
tree access_public_virtual_node; /* 5 */
tree access_protected_virtual_node; /* 6 */
tree access_private_virtual_node; /* 7 */
/* Variables shared between class.c and call.c. */
#ifdef GATHER_STATISTICS
......@@ -780,8 +747,6 @@ build_vtable (binfo, type)
return decl;
}
extern tree signed_size_zero_node;
/* Give TYPE a new virtual function table which is initialized
with a skeleton-copy of its original initialization. The only
entry that changes is the `delta' entry, so we can really
......@@ -4488,10 +4453,6 @@ init_class_processing ()
= (class_stack_node_t) xmalloc (current_class_stack_size
* sizeof (struct class_stack_node));
current_lang_stacksize = 10;
current_lang_base = (tree *)xmalloc(current_lang_stacksize * sizeof (tree));
current_lang_stack = current_lang_base;
access_default_node = build_int_2 (0, 0);
access_public_node = build_int_2 (1, 0);
access_protected_node = build_int_2 (2, 0);
......@@ -4501,10 +4462,6 @@ init_class_processing ()
access_protected_virtual_node = build_int_2 (6, 0);
access_private_virtual_node = build_int_2 (7, 0);
/* Keep these values lying around. */
base_layout_decl = build_lang_decl (FIELD_DECL, NULL_TREE, error_mark_node);
TREE_TYPE (base_layout_decl) = make_node (RECORD_TYPE);
gcc_obstack_init (&class_obstack);
}
......@@ -4736,13 +4693,13 @@ push_lang_context (name)
tree name;
{
*current_lang_stack++ = current_lang_name;
if (current_lang_stack >= current_lang_base + current_lang_stacksize)
if (current_lang_stack - &VARRAY_TREE (current_lang_base, 0)
>= (ptrdiff_t) VARRAY_SIZE (current_lang_base))
{
current_lang_base
= (tree *)xrealloc (current_lang_base,
sizeof (tree) * (current_lang_stacksize + 10));
current_lang_stack = current_lang_base + current_lang_stacksize;
current_lang_stacksize += 10;
size_t old_size = VARRAY_SIZE (current_lang_base);
VARRAY_GROW (current_lang_base, old_size + 10);
current_lang_stack = &VARRAY_TREE (current_lang_base, old_size);
}
if (name == lang_name_cplusplus)
......@@ -4781,6 +4738,9 @@ push_lang_context (name)
void
pop_lang_context ()
{
/* Clear the current entry so that garbage collector won't hold on
to it. */
*current_lang_stack = NULL_TREE;
current_lang_name = *--current_lang_stack;
if (current_lang_name == lang_name_cplusplus
|| current_lang_name == lang_name_java)
......
......@@ -33,11 +33,6 @@ enum decl_context
/* We need this in here to get the decl_context definition. */
extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree));
/* C++: Keep these around to reduce calls to `get_identifier'.
Identifiers for `this' in member functions and the auto-delete
parameter for destructors. */
extern tree this_identifier, in_charge_identifier;
/* Parsing a function declarator leaves a list of parameter names
or a chain or parameter decls here. */
extern tree last_function_parms;
......
......@@ -43,7 +43,6 @@ Boston, MA 02111-1307, USA. */
#include "dwarf2out.h"
#include "dwarfout.h"
#include "splay-tree.h"
#include "varray.h"
#include "ggc.h"
#if USE_CPPLIB
......@@ -128,9 +127,8 @@ int at_eof;
tree static_ctors, static_dtors;
/* The current open namespace, and ::. */
/* The :: namespace. */
tree current_namespace;
tree global_namespace;
/* The stack for namespaces of current declarations. */
......@@ -5276,4 +5274,10 @@ init_decl2 ()
{
ggc_add_tree_root (&decl_namespace_list, 1);
ggc_add_tree_varray_root (&saved_inlines, 1);
ggc_add_tree_varray_root (&pending_statics, 1);
ggc_add_tree_varray_root (&ssdf_decls, 1);
ggc_add_tree_root (&ssdf_decl, 1);
ggc_add_tree_root (&priority_decl, 1);
ggc_add_tree_root (&initialize_p_decl, 1);
ggc_add_tree_root (&pending_vtables, 1);
}
......@@ -151,11 +151,6 @@ asm (TEXT_SECTION_ASM_OP);
===================================================================== */
/* local globals for function calls
====================================================================== */
static tree Terminate;
/* ====================================================================== */
/* sets up all the global eh stuff that needs to be initialized at the
......@@ -169,9 +164,9 @@ init_exception_processing ()
if (flag_honor_std)
push_namespace (get_identifier ("std"));
Terminate = auto_function (get_identifier ("terminate"),
terminate_node = auto_function (get_identifier ("terminate"),
vtype, NOT_BUILT_IN);
TREE_THIS_VOLATILE (Terminate) = 1;
TREE_THIS_VOLATILE (terminate_node) = 1;
if (flag_honor_std)
pop_namespace ();
......@@ -500,7 +495,7 @@ static tree
build_terminate_handler ()
{
int yes = suspend_momentary ();
tree term = build_function_call (Terminate, NULL_TREE);
tree term = build_function_call (terminate_node, NULL_TREE);
resume_momentary (yes);
return term;
}
......
......@@ -50,11 +50,6 @@ static tree build_java_class_ref PROTO((tree));
static void expand_cleanup_for_base PROTO((tree, tree));
static tree get_temp_regvar PROTO((tree, tree));
/* Cache the identifier nodes for the magic field of a new cookie. */
static tree nc_nelts_field_id;
static tree minus_one;
/* Set up local variable for this file. MUST BE CALLED AFTER
INIT_DECL_PROCESSING. */
......@@ -64,20 +59,19 @@ void init_init_processing ()
{
tree fields[1];
minus_one = build_int_2 (-1, -1);
minus_one_node = build_int_2 (-1, -1);
/* Define the structure that holds header information for
arrays allocated via operator new. */
BI_header_type = make_lang_type (RECORD_TYPE);
nc_nelts_field_id = get_identifier ("nelts");
fields[0] = build_lang_decl (FIELD_DECL, nc_nelts_field_id, sizetype);
nelts_identifier = get_identifier ("nelts");
fields[0] = build_lang_decl (FIELD_DECL, nelts_identifier, sizetype);
finish_builtin_type (BI_header_type, "__new_cookie", fields,
0, double_type_node);
BI_header_size = size_in_bytes (BI_header_type);
ggc_add_tree_root (&current_base_init_list, 1);
ggc_add_tree_root (&current_member_init_list, 1);
ggc_add_tree_root (&minus_one, 1);
ggc_add_tree_root (&BI_header_type, 1);
ggc_add_tree_root (&BI_header_size, 1);
}
/* Subroutine of emit_base_init. For BINFO, initialize all the
......@@ -2107,10 +2101,6 @@ build_new (placement, decl, init, use_global_new)
return rval;
}
/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
static tree jclass_node = NULL_TREE;
/* Given a Java class, return a decl for the corresponding java.lang.Class. */
static tree
......@@ -2328,7 +2318,7 @@ build_new_1 (exp)
build_pointer_type (BI_header_type),
rval, extra), NULL_PTR);
exp1 = build (MODIFY_EXPR, void_type_node,
build_component_ref (cookie, nc_nelts_field_id,
build_component_ref (cookie, nelts_identifier,
NULL_TREE, 0),
nelts);
TREE_SIDE_EFFECTS (exp1) = 1;
......@@ -2909,7 +2899,7 @@ build_vec_init (decl, base, maxindex, init, from_array)
if_stmt = begin_if_stmt ();
finish_if_stmt_cond (build (NE_EXPR, boolean_type_node,
iterator, minus_one),
iterator, minus_one_node),
if_stmt);
/* Otherwise, loop through the elements. */
......@@ -3004,7 +2994,7 @@ build_vec_init (decl, base, maxindex, init, from_array)
ptrdiff_type_node,
iterator,
integer_one_node),
minus_one),
minus_one_node),
do_stmt);
finish_then_clause (if_stmt);
......@@ -3372,7 +3362,7 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
tree cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type),
base, BI_header_size);
tree cookie = build_indirect_ref (cookie_addr, NULL_PTR);
maxindex = build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0);
maxindex = build_component_ref (cookie, nelts_identifier, NULL_TREE, 0);
do
type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE);
......
......@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */
#include "c-pragma.h"
#include "toplev.h"
#include "output.h"
#include "ggc.h"
#ifdef MULTIBYTE_CHARS
#include "mbchar.h"
......@@ -174,6 +175,17 @@ static tree this_filename_time;
/* Array for holding counts of the numbers of tokens seen. */
extern int *token_count;
/* When we see a default argument in a method declaration, we snarf it as
text using snarf_defarg. When we get up to namespace scope, we then go
through and parse all of them using do_pending_defargs. Since yacc
parsers are not reentrant, we retain defargs state in these two
variables so that subsequent calls to do_pending_defargs can resume
where the previous call left off. */
static tree defarg_fns;
static tree defarg_parm;
/* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains.
CV_QUALIFIERS is a list of modifiers such as const or volatile
......@@ -875,6 +887,14 @@ init_parse (filename)
token_count = init_cpp_parse ();
interface_unknown = 1;
ggc_add_tree_root (ansi_opname, LAST_CPLUS_TREE_CODE);
ggc_add_tree_root (ansi_assopname, LAST_CPLUS_TREE_CODE);
ggc_add_tree_root (ridpointers, RID_MAX);
ggc_add_tree_root (&defarg_fns, 1);
ggc_add_tree_root (&defarg_parm, 1);
ggc_add_tree_root (&this_filename_time, 1);
ggc_add_tree_root (&filename_times, 1);
return filename;
}
......@@ -1821,16 +1841,6 @@ maybe_snarf_defarg ()
do_snarf_defarg = 1;
}
/* When we see a default argument in a method declaration, we snarf it as
text using snarf_defarg. When we get up to namespace scope, we then go
through and parse all of them using do_pending_defargs. Since yacc
parsers are not reentrant, we retain defargs state in these two
variables so that subsequent calls to do_pending_defargs can resume
where the previous call left off. */
tree defarg_fns;
tree defarg_parm;
tree
snarf_defarg ()
{
......@@ -2717,8 +2727,6 @@ handle_cp_pragma (pname)
if (! strcmp (pname, "vtable"))
{
extern tree pending_vtables;
/* More follows: it must be a string constant (class name). */
token = real_yylex ();
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
......
......@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */
#include "hard-reg-set.h"
#include "flags.h"
#include "toplev.h"
#include "ggc.h"
/* TREE_LIST of the current inline functions that need to be
processed. */
......@@ -98,11 +99,31 @@ static void build_mangled_name_for_type_with_Gcode PROTO((tree, int));
# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0'))
# define OB_LAST() (obstack_next_free (&scratch_obstack)[-1])
/* type tables for K and B type compression */
static varray_type btypelist;
static varray_type ktypelist;
/* number of each type seen */
static size_t maxbtype;
static size_t maxktype;
/* Array of types seen so far in top-level call to `build_mangled_name'.
Allocated and deallocated by caller. */
static varray_type typevec;
/* Number of types interned by `build_mangled_name' so far. */
static size_t maxtype;
/* Called once to initialize method.c. */
void
init_method ()
{
gcc_obstack_init (&scratch_obstack);
scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0);
ggc_add_tree_varray_root (&btypelist, 1);
ggc_add_tree_varray_root (&ktypelist, 1);
ggc_add_tree_varray_root (&typevec, 1);
}
/* This must be large enough to hold any printed integer or floating-point
......@@ -172,24 +193,6 @@ do_inline_function_hair (type, friend_list)
/* Here is where overload code starts. */
/* type tables for K and B type compression */
static tree *btypelist = NULL;
static tree *ktypelist = NULL;
static int maxbsize = 0;
static int maxksize = 0;
/* number of each type seen */
static int maxbtype = 0;
static int maxktype = 0;
/* Array of types seen so far in top-level call to `build_mangled_name'.
Allocated and deallocated by caller. */
static tree *typevec = NULL;
static int typevec_size;
/* Number of types interned by `build_mangled_name' so far. */
static int maxtype = 0;
/* Nonzero if we should not try folding parameter types. */
static int nofold;
......@@ -205,10 +208,8 @@ start_squangling ()
nofold = 0;
maxbtype = 0;
maxktype = 0;
maxbsize = 50;
maxksize = 50;
btypelist = (tree *)xmalloc (sizeof (tree) * maxbsize);
ktypelist = (tree *)xmalloc (sizeof (tree) * maxksize);
VARRAY_TREE_INIT (btypelist, 50, "btypelist");
VARRAY_TREE_INIT (ktypelist, 50, "ktypelist");
}
}
......@@ -217,16 +218,10 @@ end_squangling ()
{
if (flag_do_squangling)
{
if (ktypelist)
free (ktypelist);
if (btypelist)
free (btypelist);
maxbsize = 0;
maxksize = 0;
VARRAY_FREE (ktypelist);
VARRAY_FREE (btypelist);
maxbtype = 0;
maxktype = 0;
ktypelist = NULL;
btypelist = NULL;
}
}
......@@ -303,7 +298,7 @@ static __inline int
old_backref_index (type)
tree type;
{
int tindex = 0;
size_t tindex;
if (! is_back_referenceable_type (type))
return -1;
......@@ -311,7 +306,7 @@ old_backref_index (type)
/* The entry for this parm is at maxtype-1, so don't look there for
something to repeat. */
for (tindex = 0; tindex < maxtype - 1; ++tindex)
if (same_type_p (typevec[tindex], type))
if (same_type_p (VARRAY_TREE (typevec, tindex), type))
break;
if (tindex == maxtype - 1)
......@@ -425,7 +420,7 @@ check_ktype (node, add)
tree node;
int add;
{
int x;
size_t x;
tree localnode = node;
if (ktypelist == NULL)
......@@ -434,20 +429,19 @@ check_ktype (node, add)
if (TREE_CODE (node) == TYPE_DECL)
localnode = TREE_TYPE (node);
for (x=0; x < maxktype; x++)
for (x = 0; x < maxktype; x++)
{
if (same_type_p (localnode, ktypelist[x]))
if (same_type_p (localnode, VARRAY_TREE (ktypelist, x)))
return x;
}
/* Didn't find it, so add it here. */
if (add)
{
if (maxksize <= maxktype)
{
maxksize = maxksize* 3 / 2;
ktypelist = (tree *)xrealloc (ktypelist, sizeof (tree) * maxksize);
}
ktypelist[maxktype++] = localnode;
if (VARRAY_SIZE (ktypelist) <= maxktype)
VARRAY_GROW (ktypelist,
VARRAY_SIZE (ktypelist) * 3 / 2);
VARRAY_TREE (ktypelist, maxktype) = localnode;
maxktype++;
}
return -1;
}
......@@ -1166,8 +1160,9 @@ build_mangled_name (parmtypes, begin, end)
if (old_style_repeats)
{
/* Every argument gets counted. */
my_friendly_assert (maxtype < typevec_size, 387);
typevec[maxtype++] = parmtype;
my_friendly_assert (maxtype < VARRAY_SIZE (typevec), 387);
VARRAY_TREE (typevec, maxtype) = parmtype;
maxtype++;
}
if (last_type && same_type_p (parmtype, last_type))
......@@ -1261,7 +1256,7 @@ static int
check_btype (type)
tree type;
{
int x;
size_t x;
if (btypelist == NULL)
return 0;
......@@ -1270,7 +1265,7 @@ check_btype (type)
return 0;
for (x = 0; x < maxbtype; x++)
if (same_type_p (type, btypelist[x]))
if (same_type_p (type, VARRAY_TREE (btypelist, x)))
{
OB_PUTC ('B');
icat (x);
......@@ -1279,15 +1274,14 @@ check_btype (type)
return 1 ;
}
if (maxbsize <= maxbtype)
{
if (VARRAY_SIZE (btypelist) <= maxbtype)
/* Enlarge the table. */
maxbsize = maxbsize * 3 / 2;
btypelist = (tree *)xrealloc (btypelist, sizeof (tree) * maxbsize);
}
VARRAY_GROW (btypelist,
VARRAY_SIZE (btypelist) * 3 / 2);
/* Register the TYPE. */
btypelist[maxbtype++] = type;
VARRAY_TREE (btypelist, maxbtype) = type;
maxbtype++;
return 0;
}
......@@ -1638,12 +1632,12 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
if (!flag_do_squangling)
{
/* Allocate typevec array. */
size_t typevec_size = list_length (parms);
maxtype = 0;
typevec_size = list_length (parms);
if (!for_method && current_namespace != global_namespace)
/* The namespace of a global function needs one slot. */
typevec_size++;
typevec = (tree *)alloca (typevec_size * sizeof (tree));
VARRAY_TREE_INIT (typevec, typevec_size, "typevec");
}
nofold = 0;
......@@ -1655,8 +1649,9 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
if (!flag_do_squangling)
{
my_friendly_assert (maxtype < typevec_size, 387);
typevec[maxtype++] = this_type;
my_friendly_assert (maxtype < VARRAY_SIZE (typevec), 387);
VARRAY_TREE (typevec, maxtype) = this_type;
maxtype++;
}
if (TREE_CHAIN (parms))
......@@ -1671,15 +1666,16 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
if (current_namespace != global_namespace
&& !flag_do_squangling)
{
my_friendly_assert (maxtype < typevec_size, 387);
typevec[maxtype++] = current_namespace;
my_friendly_assert (maxtype < VARRAY_SIZE (typevec), 387);
VARRAY_TREE (typevec, maxtype) = current_namespace;
maxtype++;
}
build_mangled_name (parms, 0, 0);
}
if (!flag_do_squangling)
/* Deallocate typevec array. */
typevec = NULL;
VARRAY_FREE (typevec);
}
if (ret_type != NULL_TREE && for_method != 2)
......
......@@ -40,8 +40,8 @@ Boston, MA 02111-1307, USA. */
#include "except.h"
#include "toplev.h"
#include "rtl.h"
#include "varray.h"
#include "defaults.h"
#include "ggc.h"
/* The type of functions taking a tree, and some additional data, and
returning an int. */
......@@ -52,9 +52,6 @@ extern struct obstack permanent_obstack;
extern int lineno;
extern char *input_filename;
tree current_template_parms;
HOST_WIDE_INT processing_template_decl;
/* The PENDING_TEMPLATES is a TREE_LIST of templates whose
instantiations have been deferred, either because their definitions
were not yet available, or because we were putting off doing the
......@@ -68,8 +65,6 @@ static tree *template_tail = &pending_templates;
static tree maybe_templates;
static tree *maybe_template_tail = &maybe_templates;
int processing_specialization;
int processing_explicit_instantiation;
int processing_template_parmlist;
static int template_header_count;
......@@ -224,6 +219,16 @@ static void tsubst_default_arguments PROTO((tree));
#define TMPL_PARMS_DEPTH(NODE) \
(TREE_INT_CST_HIGH (TREE_PURPOSE (NODE)))
/* Called once to initialize pt.c. */
void
init_pt ()
{
ggc_add_tree_root (&pending_templates, 1);
ggc_add_tree_root (&maybe_templates, 1);
ggc_add_tree_root (&saved_trees, 1);
}
/* Do any processing required when DECL (a member template declaration
using TEMPLATE_PARAMETERS as its innermost parameter list) is
finished. Returns the TEMPLATE_DECL corresponding to DECL, unless
......
......@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
#include "input.h"
#include "obstack.h"
#include "toplev.h"
#include "ggc.h"
static tree repo_get_id PROTO((tree));
static char *extract_string PROTO((char **));
......@@ -308,6 +309,9 @@ init_repo (filename)
if (! flag_use_repository)
return;
ggc_add_tree_root (&pending_repo, 1);
ggc_add_tree_root (&original_repo, 1);
open_repo_file (filename);
if (repo_file == 0)
......
......@@ -31,7 +31,6 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "output.h"
#include "toplev.h"
#include "varray.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
......@@ -176,8 +175,6 @@ pop_search_level (obstack)
return stack;
}
static tree _vptr_name;
/* Variables for gathering statistics. */
#ifdef GATHER_STATISTICS
static int n_fields_searched;
......@@ -584,7 +581,7 @@ lookup_field_1 (type, name)
field = TREE_CHAIN (field);
}
/* Not found. */
if (name == _vptr_name)
if (name == vptr_identifier)
{
/* Give the user what s/he thinks s/he wants. */
if (TYPE_VIRTUAL_P (type))
......@@ -2792,7 +2789,6 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
if (fixup_insns)
{
extern tree in_charge_identifier;
tree in_charge_node = lookup_name (in_charge_identifier, 0);
if (! in_charge_node)
{
......@@ -3140,7 +3136,7 @@ void
init_search_processing ()
{
gcc_obstack_init (&search_obstack);
_vptr_name = get_identifier ("_vptr");
vptr_identifier = get_identifier ("_vptr");
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment