+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.
{
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;
}
/* 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
/* 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
#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.
#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. */
{
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;
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
/* 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
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
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),
++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;
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;
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. */
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
}
*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);
}
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;
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);