diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-09-07 16:07:42 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-09-07 16:07:42 +0000 |
commit | 87e3dbc92a1bb114bdde00fe8d541f7fc121e9d6 (patch) | |
tree | 5caea69b4472a05021147247c1b01dfdbe9059bd /gcc/cp/class.c | |
parent | bcc5cac9a73b8d8903cd5b7ac7e789dfb26e1a7c (diff) | |
download | gcc-87e3dbc92a1bb114bdde00fe8d541f7fc121e9d6.zip gcc-87e3dbc92a1bb114bdde00fe8d541f7fc121e9d6.tar.gz gcc-87e3dbc92a1bb114bdde00fe8d541f7fc121e9d6.tar.bz2 |
Makefile.in (tree.o): Depend on ggc.h.
* Makefile.in (tree.o): Depend on ggc.h.
* class.c (make_method_vec): Remove.
(free_method_vec): Likewise.
(free_method_vecs): Remove.
(add_method): Don't use them.
* cp-tree.def (PTRMEM_CST): Make it longer.
(TEMPLATE_PARM_INDEX): Make it shorter.
* cp-tree.h (BINDING_HAS_LEVEL_P): New macro.
(template_parm_index): Remove RTL field.
(ptrmem_cst): Add RTL field.
(finish_function): Removed parameter.
(process_next_inline): Change prototype.
(init_cplus_unsave): Rename to init_tree.
(binding_init): Remove.
* decl.c (free_binding_nodes): Remove.
(push_binding): Don't use them. Set BINDING_HAS_LEVEL_P.
(pop_binding): Don't use free_binding_nodes.
(free_binding_vecs): Remove.
(store_bindings): Don't use them.
(pop_from_top_level): Likewise.
(lookup_namespace_name): Simplify.
(build_typename_type): Don't use obstack_free.
(unqualified_namespace_lookup): Simplify.
(lookup_name_real): Simplify.
(start_function): Remove comment about leaks.
(finish_function): Removed nested parameter. Call
expand_end_bindings even when building_stmt_tree.
Call ggc_push_context and ggc_pop_context around
rest_of_compilation, if necessary.
(mark_cp_function_context): Handle a NULL language-context.
(lang_mark_false_label_stack): Fix typo.
(lang_mark_tree): Handle CPLUS_BINDING, OVERLOAD,
TEMPLATE_PARM_INDEX. Handle the funny TYPE_LANG_SPECIFIC on
pointer to method types.
(lang_cleanup_tree): Use free to free TYPE_LANG_SPECIFIC.
* decl2.c (finish_objects): Adjust call to finish_function.
(finish_static_store_duration_function): Likewise.
(do_nonmember_using_decl): Remove call to binding_init.
* except.c (end_anon_func): Adjust call to finish_function.
* lex.c (mark_impl_file_chain): New function.
(init_parse): Call init_tree, not init_cplus_unsave.
Add GC roots.
(cp_pramga_interface): Use xmalloc, not permalloc.
(cp_pragma_implementation): Likewise.
(begin_definition_of_inclass_inline): Simplify.
(process_next_inline): Adjust prototype.
(do_scoped_id): Don't call binding_init.
(make_lang_type): Allocate TYPE_LANG_SPECIFIC with xmalloc.
(emit_thunk): Adjust call to finish_function.
(synthesize_method): Likewise.
* parse.y (%union): Add a new `pi' variant.
(PRE_PARSED_FUNCTION_DECL): Use it.
(fn.defpen): Likewise.
(fndef): Adjust call to finish_function.
(instantiate_decl): Likewise.
(rtti.c): Likewise.
(semantics.c): Likewise.
* tree.c: Include ggc.h.
(mark_list_hash): New function.
(binding_init): Remove.
(init_cplus_unsave): Rename to ...
(init_tree): This. Add GC roots.
From-SVN: r29172
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7b50870..ab417f5 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -115,8 +115,6 @@ static void finish_struct_methods PROTO((tree)); static void maybe_warn_about_overly_private_class PROTO ((tree)); static int field_decl_cmp PROTO ((const tree *, const tree *)); static int method_name_cmp PROTO ((const tree *, const tree *)); -static tree make_method_vec PROTO((int)); -static void free_method_vec PROTO((tree)); static tree add_implicitly_declared_members PROTO((tree, int, int, int)); static tree fixed_type_or_null PROTO((tree, int *)); static tree resolve_address_of_overloaded_function PROTO((tree, tree, int, @@ -1066,46 +1064,6 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t) struct obstack class_obstack; extern struct obstack *current_obstack; -/* These are method vectors that were too small for the number of - methods in some class, and so were abandoned. */ -static tree free_method_vecs; - -/* Returns a method vector with enough room for N methods. N should - be a power of two. */ - -static tree -make_method_vec (n) - int n; -{ - tree new_vec; - tree* t; - - for (t = &free_method_vecs; *t; t = &(TREE_CHAIN (*t))) - /* Note that we don't use >= n here because we don't want to - allocate a very large vector where it isn't needed. */ - if (TREE_VEC_LENGTH (*t) == n) - { - new_vec = *t; - *t = TREE_CHAIN (new_vec); - TREE_CHAIN (new_vec) = NULL_TREE; - bzero ((PTR) &TREE_VEC_ELT (new_vec, 0), n * sizeof (tree)); - return new_vec; - } - - new_vec = make_tree_vec (n); - return new_vec; -} - -/* Free the method vector VEC. */ - -static void -free_method_vec (vec) - tree vec; -{ - TREE_CHAIN (vec) = free_method_vecs; - free_method_vecs = vec; -} - /* Add method METHOD to class TYPE. If non-NULL, FIELDS is the entry in the METHOD_VEC vector entry of @@ -1141,9 +1099,8 @@ add_method (type, fields, method) memory making the links in the list than we would by over-allocating the size of the vector here. Furthermore, we would complicate all the code that expects this to be a - vector. We keep a free list of vectors that we outgrew so - that we don't really waste any memory. */ - CLASSTYPE_METHOD_VEC (type) = make_method_vec (8); + vector. */ + CLASSTYPE_METHOD_VEC (type) = make_tree_vec (8); method_vec = CLASSTYPE_METHOD_VEC (type); len = TREE_VEC_LENGTH (method_vec); @@ -1165,11 +1122,10 @@ add_method (type, fields, method) if (slot == len) { /* We need a bigger method vector. */ - tree new_vec = make_method_vec (2 * len); + tree new_vec = make_tree_vec (2 * len); bcopy ((PTR) &TREE_VEC_ELT (method_vec, 0), (PTR) &TREE_VEC_ELT (new_vec, 0), len * sizeof (tree)); - free_method_vec (method_vec); len = 2 * len; method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec; } |