class.c (class_cache_obstack, [...]): Remove.

* class.c (class_cache_obstack, class_obstack): Remove.
	(init_class_processing): Don't initialize class_obstack.
	(push_cache_obstack): Remove.
	(pushclass): Don't call it.
	* cp-tree.h: Remove prototype for push_cache_obstack.
	* decl.c (decl_obstack, decl_stack, push_decl_level): Remove.
	(pushlevel_class): Don't push_decl_level.
	(poplevel_class): Don't pop_stack_level.
	(push_class_level_binding): Don't push_cache_obstack.
	(init_decl_processing): Don't intialize decl_obstack.
	* search.c (push_class_decls): Don't push_cache_obstack.
	* tree.c (list_hash_add): Put hash node on permanent_obstack.
	(hash_tree_cons): Don't mess with obstacks.
	(print_lang_statistics): Don't print stats for class_obstack and
	decl_obstack.

From-SVN: r29711
This commit is contained in:
Jason Merrill 1999-09-29 22:52:57 +00:00 committed by Jason Merrill
parent 3bc6a13bb6
commit 0a2c2fd1c2
7 changed files with 21 additions and 84 deletions

View File

@ -1,3 +1,21 @@
1999-09-29 Jason Merrill <jason@yorick.cygnus.com>
* class.c (class_cache_obstack, class_obstack): Remove.
(init_class_processing): Don't initialize class_obstack.
(push_cache_obstack): Remove.
(pushclass): Don't call it.
* cp-tree.h: Remove prototype for push_cache_obstack.
* decl.c (decl_obstack, decl_stack, push_decl_level): Remove.
(pushlevel_class): Don't push_decl_level.
(poplevel_class): Don't pop_stack_level.
(push_class_level_binding): Don't push_cache_obstack.
(init_decl_processing): Don't intialize decl_obstack.
* search.c (push_class_decls): Don't push_cache_obstack.
* tree.c (list_hash_add): Put hash node on permanent_obstack.
(hash_tree_cons): Don't mess with obstacks.
(print_lang_statistics): Don't print stats for class_obstack and
decl_obstack.
1999-09-29 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Dump DECL_EXTERNAL.

View File

@ -72,9 +72,6 @@ typedef struct class_stack_node {
static int current_class_stack_size;
static class_stack_node_t current_class_stack;
/* The obstack on which the cached class declarations are kept. */
static struct obstack class_cache_obstack;
struct base_info;
static tree get_vfield_name PROTO((tree));
@ -1055,8 +1052,6 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t)
*phv = pending_hard_virtuals;
}
/* Obstack on which to build the vector of class methods. */
struct obstack class_obstack;
extern struct obstack *current_obstack;
/* Add method METHOD to class TYPE.
@ -4412,8 +4407,6 @@ init_class_processing ()
access_public_virtual_node = build_int_2 (5, 0);
access_protected_virtual_node = build_int_2 (6, 0);
access_private_virtual_node = build_int_2 (7, 0);
gcc_obstack_init (&class_obstack);
}
/* Set current scope to NAME. CODE tells us if this is a
@ -4493,12 +4486,6 @@ pushclass (type, modify)
{
/* Forcibly remove any old class remnants. */
invalidate_class_lookup_cache ();
/* Now, free the obstack on which we cached all the values. */
if (class_cache_firstobj)
obstack_free (&class_cache_obstack, class_cache_firstobj);
class_cache_firstobj
= (char*) obstack_finish (&class_cache_obstack);
}
/* If we're about to enter a nested class, clear
@ -5246,27 +5233,6 @@ print_class_statistics ()
#endif
}
/* Push an obstack which is sufficiently long-lived to hold such class
decls that may be cached in the previous_class_values list. The
effect is undone by pop_obstacks. */
void
push_cache_obstack ()
{
static int cache_obstack_initialized;
if (!cache_obstack_initialized)
{
gcc_obstack_init (&class_cache_obstack);
class_cache_firstobj
= (char*) obstack_finish (&class_cache_obstack);
cache_obstack_initialized = 1;
}
push_obstacks_nochange ();
current_obstack = &class_cache_obstack;
}
/* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
according to [class]:
The class-name is also inserted

View File

@ -3264,7 +3264,6 @@ extern void push_lang_context PROTO((tree));
extern void pop_lang_context PROTO((void));
extern tree instantiate_type PROTO((tree, tree, int));
extern void print_class_statistics PROTO((void));
extern void push_cache_obstack PROTO((void));
extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
extern void build_self_reference PROTO((void));
extern void warn_hidden PROTO((tree));

View File

@ -63,12 +63,6 @@ extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree));
int ggc_p = 1;
/* Obstack used for remembering local class declarations (like
enums and static (const) members. */
#include "stack.h"
struct obstack decl_obstack;
static struct stack_level *decl_stack;
#ifndef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#endif
@ -106,8 +100,6 @@ static struct stack_level *decl_stack;
static tree grokparms PROTO((tree, int));
static const char *redeclaration_error_message PROTO((tree, tree));
static struct stack_level *push_decl_level PROTO((struct stack_level *,
struct obstack *));
static void push_binding_level PROTO((struct binding_level *, int,
int));
static void pop_binding_level PROTO((void));
@ -385,20 +377,6 @@ tree signed_size_zero_node;
unit. */
tree anonymous_namespace_name;
/* Allocate a level of searching. */
static
struct stack_level *
push_decl_level (stack, obstack)
struct stack_level *stack;
struct obstack *obstack;
{
struct stack_level tem;
tem.prev = stack;
return push_stack_level (obstack, (char *)&tem, sizeof (tem));
}
/* For each binding contour we allocate a binding_level structure
which records the names defined in that contour.
@ -1569,7 +1547,6 @@ pushlevel_class ()
push_binding_level (newlevel, 0, 0);
decl_stack = push_decl_level (decl_stack, &decl_obstack);
class_binding_level = current_binding_level;
class_binding_level->parm_flag = 2;
}
@ -1584,7 +1561,6 @@ poplevel_class ()
my_friendly_assert (level != 0, 354);
decl_stack = pop_stack_level (decl_stack);
/* If we're leaving a toplevel class, don't bother to do the setting
of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot
shouldn't even be used when current_class_type isn't set, and second,
@ -4316,11 +4292,9 @@ push_class_level_binding (name, x)
IDENTIFIER_CLASS_VALUE. */
if (push_class_binding (name, x))
{
push_cache_obstack ();
class_binding_level->class_shadowed
= tree_cons (name, IDENTIFIER_CLASS_VALUE (name),
class_binding_level->class_shadowed);
pop_obstacks ();
/* Record the value we are binding NAME to so that we can know
what to pop later. */
TREE_TYPE (class_binding_level->class_shadowed) = x;
@ -6062,8 +6036,6 @@ init_decl_processing ()
signal (SIGBUS, signal_catch);
#endif
gcc_obstack_init (&decl_obstack);
build_common_tree_nodes (flag_signed_char);
error_mark_list = build_tree_list (error_mark_node, error_mark_node);

View File

@ -3623,7 +3623,7 @@ maybe_get_template_decl_from_type_decl (decl)
D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments.
(Actually ARGLIST may be either a TREE_LIST or a TREE_VEC. It will
be a TREE_LIST if called directly from the parser, and a TREE_VEC
otherwise.) Since ARGLIST is build on the decl_obstack, we must
otherwise.) Since ARGLIST is build on the temp_decl_obstack, we must
copy it here to keep it from being reclaimed when the decl storage
is reclaimed.

View File

@ -3125,24 +3125,13 @@ void
push_class_decls (type)
tree type;
{
struct obstack *ambient_obstack = current_obstack;
search_stack = push_search_level (search_stack, &search_obstack);
/* Build up all the relevant bindings and such on the cache
obstack. That way no memory is wasted when we throw away the
cache later. */
push_cache_obstack ();
/* Enter type declarations and mark. */
dfs_walk (TYPE_BINFO (type), dfs_push_type_decls, unmarked_pushdecls_p, 0);
/* Enter non-type declarations and unmark. */
dfs_walk (TYPE_BINFO (type), dfs_push_decls, marked_pushdecls_p, 0);
/* Undo the call to push_cache_obstack above. */
pop_obstacks ();
current_obstack = ambient_obstack;
}
/* Here's a subroutine we need because C lacks lambdas. */

View File

@ -398,7 +398,7 @@ break_out_calls (exp)
}
extern struct obstack *current_obstack;
extern struct obstack permanent_obstack, class_obstack;
extern struct obstack permanent_obstack;
extern struct obstack *saveable_obstack;
extern struct obstack *expression_obstack;
@ -1110,7 +1110,7 @@ list_hash_add (hashcode, list)
{
register struct list_hash *h;
h = (struct list_hash *) obstack_alloc (&class_obstack, sizeof (struct list_hash));
h = (struct list_hash *) obstack_alloc (&permanent_obstack, sizeof (struct list_hash));
h->hashcode = hashcode;
h->list = list;
h->next = list_hash_table[hashcode % TYPE_HASH_SIZE];
@ -1129,7 +1129,6 @@ tree
hash_tree_cons (purpose, value, chain)
tree purpose, value, chain;
{
struct obstack *ambient_obstack = current_obstack;
tree t;
int hashcode = 0;
@ -1141,15 +1140,12 @@ hash_tree_cons (purpose, value, chain)
return t;
}
current_obstack = &class_obstack;
t = tree_cons (purpose, value, chain);
/* If this is a new list, record it for later reuse. */
if (! debug_no_list_hash)
list_hash_add (hashcode, t);
current_obstack = ambient_obstack;
return t;
}
@ -2040,9 +2036,6 @@ extern int depth_reached;
void
print_lang_statistics ()
{
extern struct obstack decl_obstack;
print_obstack_statistics ("class_obstack", &class_obstack);
print_obstack_statistics ("decl_obstack", &decl_obstack);
print_search_statistics ();
print_class_statistics ();
#ifdef GATHER_STATISTICS