Commit 4890c2f4 by Mark Mitchell Committed by Mark Mitchell

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
parent 55560b9d
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> 2001-01-02 Richard Henderson <rth@redhat.com>
* parse.y (asm): Set ASM_INPUT_P. * parse.y (asm): Set ASM_INPUT_P.
......
...@@ -5643,12 +5643,11 @@ invalidate_class_lookup_cache () ...@@ -5643,12 +5643,11 @@ invalidate_class_lookup_cache ()
{ {
tree t; tree t;
/* This code can be seen as a cache miss. When we've cached a /* The IDENTIFIER_CLASS_VALUEs are no longer valid. */
class' scope's bindings and we can't use them, we need to reset
them. This is it! */
for (t = previous_class_values; t; t = TREE_CHAIN (t)) for (t = previous_class_values; t; t = TREE_CHAIN (t))
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE; IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
previous_class_values = NULL_TREE;
previous_class_type = NULL_TREE; previous_class_type = NULL_TREE;
} }
......
...@@ -2346,7 +2346,7 @@ struct lang_decl ...@@ -2346,7 +2346,7 @@ struct lang_decl
/* The number of levels of template parameters given by NODE. */ /* The number of levels of template parameters given by NODE. */
#define TMPL_PARMS_DEPTH(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 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
TEMPLATE_DECL will be the immediate parent, not the most general TEMPLATE_DECL will be the immediate parent, not the most general
...@@ -2791,7 +2791,7 @@ extern int flag_new_for_scope; ...@@ -2791,7 +2791,7 @@ extern int flag_new_for_scope;
/* Accessor macros for C++ template decl nodes. */ /* Accessor macros for C++ template decl nodes. */
/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node /* 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 template parameters, with 1 being the outermost set of template
parameters. The TREE_VALUE is a vector, whose elements are the parameters. The TREE_VALUE is a vector, whose elements are the
template parameters at each level. Each element in the vector is a template parameters at each level. Each element in the vector is a
...@@ -2919,7 +2919,7 @@ extern int flag_new_for_scope; ...@@ -2919,7 +2919,7 @@ extern int flag_new_for_scope;
#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE) #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
#define CLASSTYPE_TEMPLATE_LEVEL(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 /* Indicates whether or not (and how) a template was expanded for this
FUNCTION_DECL or VAR_DECL. FUNCTION_DECL or VAR_DECL.
......
...@@ -940,6 +940,11 @@ note_level_for_eh () ...@@ -940,6 +940,11 @@ note_level_for_eh ()
#define BINDING_LEVEL(NODE) \ #define BINDING_LEVEL(NODE) \
(((struct tree_binding*)NODE)->scope.level) (((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 /* Make DECL the innermost binding for ID. The LEVEL is the binding
level at which this declaration is being bound. */ level at which this declaration is being bound. */
...@@ -951,7 +956,13 @@ push_binding (id, decl, level) ...@@ -951,7 +956,13 @@ push_binding (id, decl, level)
{ {
tree binding; 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. */ /* Now, fill in the binding information. */
BINDING_VALUE (binding) = decl; BINDING_VALUE (binding) = decl;
...@@ -1189,9 +1200,19 @@ pop_binding (id, decl) ...@@ -1189,9 +1200,19 @@ pop_binding (id, decl)
my_friendly_abort (0); my_friendly_abort (0);
if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding)) 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. */ /* We're completely done with the innermost binding for this
IDENTIFIER_BINDING (id) = TREE_CHAIN (binding); 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 /* When a label goes out of scope, check to see if that label was used
...@@ -6472,7 +6493,7 @@ init_decl_processing () ...@@ -6472,7 +6493,7 @@ init_decl_processing ()
/* Make a type to be the domain of a few array types /* Make a type to be the domain of a few array types
whose domains don't really matter. whose domains don't really matter.
200 is small enough that it always fits in size_t. */ 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. /* Make a type for arrays of characters.
With luck nothing will ever really depend on the length of this With luck nothing will ever really depend on the length of this
...@@ -6692,6 +6713,7 @@ init_decl_processing () ...@@ -6692,6 +6713,7 @@ init_decl_processing ()
ggc_add_tree_root (&current_lang_name, 1); ggc_add_tree_root (&current_lang_name, 1);
ggc_add_tree_root (&static_aggregates, 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 /* 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) ...@@ -6715,7 +6737,7 @@ cp_make_fname_decl (id, name, type_dep)
if (!processing_template_decl) if (!processing_template_decl)
type_dep = 0; type_dep = 0;
if (!type_dep) if (!type_dep)
domain = build_index_type (build_int_2 (length, 0)); domain = build_index_type (size_int (length));
type = build_cplus_array_type type = build_cplus_array_type
(build_qualified_type (char_type_node, TYPE_QUAL_CONST), (build_qualified_type (char_type_node, TYPE_QUAL_CONST),
......
...@@ -322,7 +322,7 @@ push_inline_template_parms_recursive (parmlist, levels) ...@@ -322,7 +322,7 @@ push_inline_template_parms_recursive (parmlist, levels)
++processing_template_decl; ++processing_template_decl;
current_template_parms current_template_parms
= tree_cons (build_int_2 (0, processing_template_decl), = tree_cons (size_int (processing_template_decl),
parms, current_template_parms); parms, current_template_parms);
TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1; TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1;
...@@ -1918,7 +1918,7 @@ end_template_parm_list (parms) ...@@ -1918,7 +1918,7 @@ end_template_parm_list (parms)
tree saved_parmlist = make_tree_vec (list_length (parms)); tree saved_parmlist = make_tree_vec (list_length (parms));
current_template_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); saved_parmlist, current_template_parms);
for (parm = parms, nparms = 0; for (parm = parms, nparms = 0;
...@@ -4195,6 +4195,7 @@ for_each_template_parm_r (tp, walk_subtrees, d) ...@@ -4195,6 +4195,7 @@ for_each_template_parm_r (tp, walk_subtrees, d)
explicitly here. */ explicitly here. */
if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data)) if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data))
return error_mark_node; return error_mark_node;
/* Fall through. */
case FUNCTION_TYPE: case FUNCTION_TYPE:
/* Check the return type. */ /* Check the return type. */
...@@ -4323,10 +4324,14 @@ for_each_template_parm (t, fn, data) ...@@ -4323,10 +4324,14 @@ for_each_template_parm (t, fn, data)
pfd.fn = fn; pfd.fn = fn;
pfd.data = data; pfd.data = data;
/* Walk the tree. */ /* Walk the tree. (Conceptually, we would like to walk without
return walk_tree_without_duplicates (&t, duplicates, but for_each_template_parm_r recursively calls
for_each_template_parm_r, for_each_template_parm, so we would need to reorganize a fair
&pfd) != NULL_TREE; bit to use walk_tree_without_duplicates.) */
return walk_tree (&t,
for_each_template_parm_r,
&pfd,
NULL) != NULL_TREE;
} }
int int
...@@ -5315,8 +5320,8 @@ tsubst_template_parms (parms, args, complain) ...@@ -5315,8 +5320,8 @@ tsubst_template_parms (parms, args, complain)
} }
*new_parms = *new_parms =
tree_cons (build_int_2 (0, (TMPL_PARMS_DEPTH (parms) tree_cons (size_int (TMPL_PARMS_DEPTH (parms)
- TMPL_ARGS_DEPTH (args))), - TMPL_ARGS_DEPTH (args)),
new_vec, NULL_TREE); new_vec, NULL_TREE);
} }
...@@ -6759,8 +6764,8 @@ tsubst (t, args, complain, in_decl) ...@@ -6759,8 +6764,8 @@ tsubst (t, args, complain, in_decl)
c-common.c. */ c-common.c. */
name = (*decl_printable_name) (current_function_decl, 2); name = (*decl_printable_name) (current_function_decl, 2);
len = strlen (name) + 1; len = strlen (name) + 1;
type = build_array_type (char_type_node, type = build_array_type (char_type_node,
build_index_type (build_int_2 (len, 0))); build_index_type (size_int (len)));
str = build_string (len, name); str = build_string (len, name);
TREE_TYPE (str) = type; TREE_TYPE (str) = type;
return str; return str;
......
...@@ -1839,7 +1839,7 @@ get_vmi_pseudo_type_info (num_bases) ...@@ -1839,7 +1839,7 @@ get_vmi_pseudo_type_info (num_bases)
return desc; return desc;
/* Add number of bases and trailing array of base_class_type_info. */ /* 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); base_array = build_array_type (base_desc_type_node, array_domain);
push_nested_namespace (abi_node); push_nested_namespace (abi_node);
......
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