diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-01-03 00:24:04 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-01-03 00:24:04 +0000 |
commit | 4890c2f43c55328b560ca99fb4a4058a68290cd9 (patch) | |
tree | 6c3f7f84a08085fee5d7b256e232927293cd5a7d | |
parent | 55560b9da47bf6fef84d3b217e9019b0a07b1821 (diff) | |
download | gcc-4890c2f43c55328b560ca99fb4a4058a68290cd9.zip gcc-4890c2f43c55328b560ca99fb4a4058a68290cd9.tar.gz gcc-4890c2f43c55328b560ca99fb4a4058a68290cd9.tar.bz2 |
class.c (invalidate_class_lookup_cache): Zero the previous_class_values.
* class.c (invalidate_class_lookup_cache): Zero the
previous_class_values.
* cp-tree.h (TMPL_PARMS_DEPTH): Use TREE_INT_CST_LOW, not
TREE_INT_CST_HIGH.
(CLASSTYPE_TEMPLATE_LEVEL): Likewise.
* decl.c (free_bindings): New variable.
(push_binding): Don't create a new binding if we have one on the
free list.
(pop_binding): Put old bindings on the free list.
(init_decl_processing): Use size_int, not build_int_2.
Register free_bindings as a GC root.
(cp_make_fname_decl): Use size_int, not build_int_2.
(push_inline_template_parms_recursive): Likewise.
(end_template_parm_list): Likewise.
(for_each_tempalte_parm): Do not use walk_tree_without_duplicates.
(tsubst_template_parms): Use size_int, not build_int_2.
(tsubst): Likewise.
* rtti.c (get_vmi_pseudo_type_info): Likewise.
From-SVN: r38641
-rw-r--r-- | gcc/cp/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/cp/class.c | 7 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 34 | ||||
-rw-r--r-- | gcc/cp/pt.c | 25 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 2 |
6 files changed, 71 insertions, 24 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d89415..ee542c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,24 @@ +2001-01-02 Mark Mitchell <mark@codesourcery.com> + + * class.c (invalidate_class_lookup_cache): Zero the + previous_class_values. + * cp-tree.h (TMPL_PARMS_DEPTH): Use TREE_INT_CST_LOW, not + TREE_INT_CST_HIGH. + (CLASSTYPE_TEMPLATE_LEVEL): Likewise. + * decl.c (free_bindings): New variable. + (push_binding): Don't create a new binding if we have one on the + free list. + (pop_binding): Put old bindings on the free list. + (init_decl_processing): Use size_int, not build_int_2. + Register free_bindings as a GC root. + (cp_make_fname_decl): Use size_int, not build_int_2. + (push_inline_template_parms_recursive): Likewise. + (end_template_parm_list): Likewise. + (for_each_tempalte_parm): Do not use walk_tree_without_duplicates. + (tsubst_template_parms): Use size_int, not build_int_2. + (tsubst): Likewise. + * rtti.c (get_vmi_pseudo_type_info): Likewise. + 2001-01-02 Richard Henderson <rth@redhat.com> * parse.y (asm): Set ASM_INPUT_P. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 6373268..65281a6 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5643,12 +5643,11 @@ invalidate_class_lookup_cache () { tree t; - /* This code can be seen as a cache miss. When we've cached a - class' scope's bindings and we can't use them, we need to reset - them. This is it! */ + /* The IDENTIFIER_CLASS_VALUEs are no longer valid. */ for (t = previous_class_values; t; t = TREE_CHAIN (t)) IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE; - + + previous_class_values = NULL_TREE; previous_class_type = NULL_TREE; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b0802e1..61ec093 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2346,7 +2346,7 @@ struct lang_decl /* The number of levels of template parameters given by NODE. */ #define TMPL_PARMS_DEPTH(NODE) \ - (TREE_INT_CST_HIGH (TREE_PURPOSE (NODE))) + (TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) /* The TEMPLATE_DECL instantiated or specialized by NODE. This TEMPLATE_DECL will be the immediate parent, not the most general @@ -2791,7 +2791,7 @@ extern int flag_new_for_scope; /* Accessor macros for C++ template decl nodes. */ /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node - is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the + is a INT_CST whose TREE_INT_CST_LOW indicates the level of the template parameters, with 1 being the outermost set of template parameters. The TREE_VALUE is a vector, whose elements are the template parameters at each level. Each element in the vector is a @@ -2919,7 +2919,7 @@ extern int flag_new_for_scope; #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE) #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \ - (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE)))) + (TREE_INT_CST_LOW (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE)))) /* Indicates whether or not (and how) a template was expanded for this FUNCTION_DECL or VAR_DECL. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 705a083..902cdaf 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -940,6 +940,11 @@ note_level_for_eh () #define BINDING_LEVEL(NODE) \ (((struct tree_binding*)NODE)->scope.level) +/* A free list of CPLUS_BINDING nodes, connected by their + TREE_CHAINs. */ + +static tree free_bindings; + /* Make DECL the innermost binding for ID. The LEVEL is the binding level at which this declaration is being bound. */ @@ -951,7 +956,13 @@ push_binding (id, decl, level) { tree binding; - binding = make_node (CPLUS_BINDING); + if (free_bindings) + { + binding = free_bindings; + free_bindings = TREE_CHAIN (binding); + } + else + binding = make_node (CPLUS_BINDING); /* Now, fill in the binding information. */ BINDING_VALUE (binding) = decl; @@ -1189,9 +1200,19 @@ pop_binding (id, decl) my_friendly_abort (0); if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding)) - /* We're completely done with the innermost binding for this - identifier. Unhook it from the list of bindings. */ - IDENTIFIER_BINDING (id) = TREE_CHAIN (binding); + { + /* We're completely done with the innermost binding for this + identifier. Unhook it from the list of bindings. */ + IDENTIFIER_BINDING (id) = TREE_CHAIN (binding); + + /* Add it to the free list. */ + TREE_CHAIN (binding) = free_bindings; + free_bindings = binding; + + /* Clear the BINDING_LEVEL so the garbage collector doesn't walk + it. */ + BINDING_LEVEL (binding) = NULL; + } } /* When a label goes out of scope, check to see if that label was used @@ -6472,7 +6493,7 @@ init_decl_processing () /* Make a type to be the domain of a few array types whose domains don't really matter. 200 is small enough that it always fits in size_t. */ - array_domain_type = build_index_type (build_int_2 (200, 0)); + array_domain_type = build_index_type (size_int (200)); /* Make a type for arrays of characters. With luck nothing will ever really depend on the length of this @@ -6692,6 +6713,7 @@ init_decl_processing () ggc_add_tree_root (¤t_lang_name, 1); ggc_add_tree_root (&static_aggregates, 1); + ggc_add_tree_root (&free_bindings, 1); } /* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the @@ -6715,7 +6737,7 @@ cp_make_fname_decl (id, name, type_dep) if (!processing_template_decl) type_dep = 0; if (!type_dep) - domain = build_index_type (build_int_2 (length, 0)); + domain = build_index_type (size_int (length)); type = build_cplus_array_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST), diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9b04985..e838a98 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -322,7 +322,7 @@ push_inline_template_parms_recursive (parmlist, levels) ++processing_template_decl; current_template_parms - = tree_cons (build_int_2 (0, processing_template_decl), + = tree_cons (size_int (processing_template_decl), parms, current_template_parms); TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1; @@ -1918,7 +1918,7 @@ end_template_parm_list (parms) tree saved_parmlist = make_tree_vec (list_length (parms)); current_template_parms - = tree_cons (build_int_2 (0, processing_template_decl), + = tree_cons (size_int (processing_template_decl), saved_parmlist, current_template_parms); for (parm = parms, nparms = 0; @@ -4195,6 +4195,7 @@ for_each_template_parm_r (tp, walk_subtrees, d) explicitly here. */ if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data)) return error_mark_node; + /* Fall through. */ case FUNCTION_TYPE: /* Check the return type. */ @@ -4323,10 +4324,14 @@ for_each_template_parm (t, fn, data) pfd.fn = fn; pfd.data = data; - /* Walk the tree. */ - return walk_tree_without_duplicates (&t, - for_each_template_parm_r, - &pfd) != NULL_TREE; + /* Walk the tree. (Conceptually, we would like to walk without + duplicates, but for_each_template_parm_r recursively calls + for_each_template_parm, so we would need to reorganize a fair + bit to use walk_tree_without_duplicates.) */ + return walk_tree (&t, + for_each_template_parm_r, + &pfd, + NULL) != NULL_TREE; } int @@ -5315,8 +5320,8 @@ tsubst_template_parms (parms, args, complain) } *new_parms = - tree_cons (build_int_2 (0, (TMPL_PARMS_DEPTH (parms) - - TMPL_ARGS_DEPTH (args))), + tree_cons (size_int (TMPL_PARMS_DEPTH (parms) + - TMPL_ARGS_DEPTH (args)), new_vec, NULL_TREE); } @@ -6759,8 +6764,8 @@ tsubst (t, args, complain, in_decl) c-common.c. */ name = (*decl_printable_name) (current_function_decl, 2); len = strlen (name) + 1; - type = build_array_type (char_type_node, - build_index_type (build_int_2 (len, 0))); + type = build_array_type (char_type_node, + build_index_type (size_int (len))); str = build_string (len, name); TREE_TYPE (str) = type; return str; diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 3a54fc4..417f165 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1839,7 +1839,7 @@ get_vmi_pseudo_type_info (num_bases) return desc; /* Add number of bases and trailing array of base_class_type_info. */ - array_domain = build_index_type (build_int_2 (num_bases, 0)); + array_domain = build_index_type (size_int (num_bases)); base_array = build_array_type (base_desc_type_node, array_domain); push_nested_namespace (abi_node); |