Commit 0a2c2fd1 by Jason Merrill Committed by Jason Merrill

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
parent 3bc6a13b
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> 1999-09-29 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Dump DECL_EXTERNAL. * dump.c (dequeue_and_dump): Dump DECL_EXTERNAL.
......
...@@ -72,9 +72,6 @@ typedef struct class_stack_node { ...@@ -72,9 +72,6 @@ typedef struct class_stack_node {
static int current_class_stack_size; static int current_class_stack_size;
static class_stack_node_t current_class_stack; 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; struct base_info;
static tree get_vfield_name PROTO((tree)); static tree get_vfield_name PROTO((tree));
...@@ -1055,8 +1052,6 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t) ...@@ -1055,8 +1052,6 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t)
*phv = pending_hard_virtuals; *phv = pending_hard_virtuals;
} }
/* Obstack on which to build the vector of class methods. */
struct obstack class_obstack;
extern struct obstack *current_obstack; extern struct obstack *current_obstack;
/* Add method METHOD to class TYPE. /* Add method METHOD to class TYPE.
...@@ -4412,8 +4407,6 @@ init_class_processing () ...@@ -4412,8 +4407,6 @@ init_class_processing ()
access_public_virtual_node = build_int_2 (5, 0); access_public_virtual_node = build_int_2 (5, 0);
access_protected_virtual_node = build_int_2 (6, 0); access_protected_virtual_node = build_int_2 (6, 0);
access_private_virtual_node = build_int_2 (7, 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 /* Set current scope to NAME. CODE tells us if this is a
...@@ -4493,12 +4486,6 @@ pushclass (type, modify) ...@@ -4493,12 +4486,6 @@ pushclass (type, modify)
{ {
/* Forcibly remove any old class remnants. */ /* Forcibly remove any old class remnants. */
invalidate_class_lookup_cache (); 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 /* If we're about to enter a nested class, clear
...@@ -5246,27 +5233,6 @@ print_class_statistics () ...@@ -5246,27 +5233,6 @@ print_class_statistics ()
#endif #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, /* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
according to [class]: according to [class]:
The class-name is also inserted The class-name is also inserted
......
...@@ -3264,7 +3264,6 @@ extern void push_lang_context PROTO((tree)); ...@@ -3264,7 +3264,6 @@ extern void push_lang_context PROTO((tree));
extern void pop_lang_context PROTO((void)); extern void pop_lang_context PROTO((void));
extern tree instantiate_type PROTO((tree, tree, int)); extern tree instantiate_type PROTO((tree, tree, int));
extern void print_class_statistics PROTO((void)); 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 unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
extern void build_self_reference PROTO((void)); extern void build_self_reference PROTO((void));
extern void warn_hidden PROTO((tree)); extern void warn_hidden PROTO((tree));
......
...@@ -63,12 +63,6 @@ extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree)); ...@@ -63,12 +63,6 @@ extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree));
int ggc_p = 1; 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 #ifndef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0 #define WCHAR_UNSIGNED 0
#endif #endif
...@@ -106,8 +100,6 @@ static struct stack_level *decl_stack; ...@@ -106,8 +100,6 @@ static struct stack_level *decl_stack;
static tree grokparms PROTO((tree, int)); static tree grokparms PROTO((tree, int));
static const char *redeclaration_error_message PROTO((tree, tree)); 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, static void push_binding_level PROTO((struct binding_level *, int,
int)); int));
static void pop_binding_level PROTO((void)); static void pop_binding_level PROTO((void));
...@@ -386,20 +378,6 @@ tree signed_size_zero_node; ...@@ -386,20 +378,6 @@ tree signed_size_zero_node;
tree anonymous_namespace_name; 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 /* For each binding contour we allocate a binding_level structure
which records the names defined in that contour. which records the names defined in that contour.
Contours include: Contours include:
...@@ -1569,7 +1547,6 @@ pushlevel_class () ...@@ -1569,7 +1547,6 @@ pushlevel_class ()
push_binding_level (newlevel, 0, 0); push_binding_level (newlevel, 0, 0);
decl_stack = push_decl_level (decl_stack, &decl_obstack);
class_binding_level = current_binding_level; class_binding_level = current_binding_level;
class_binding_level->parm_flag = 2; class_binding_level->parm_flag = 2;
} }
...@@ -1584,7 +1561,6 @@ poplevel_class () ...@@ -1584,7 +1561,6 @@ poplevel_class ()
my_friendly_assert (level != 0, 354); 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 /* 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 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, shouldn't even be used when current_class_type isn't set, and second,
...@@ -4316,11 +4292,9 @@ push_class_level_binding (name, x) ...@@ -4316,11 +4292,9 @@ push_class_level_binding (name, x)
IDENTIFIER_CLASS_VALUE. */ IDENTIFIER_CLASS_VALUE. */
if (push_class_binding (name, x)) if (push_class_binding (name, x))
{ {
push_cache_obstack ();
class_binding_level->class_shadowed class_binding_level->class_shadowed
= tree_cons (name, IDENTIFIER_CLASS_VALUE (name), = tree_cons (name, IDENTIFIER_CLASS_VALUE (name),
class_binding_level->class_shadowed); class_binding_level->class_shadowed);
pop_obstacks ();
/* Record the value we are binding NAME to so that we can know /* Record the value we are binding NAME to so that we can know
what to pop later. */ what to pop later. */
TREE_TYPE (class_binding_level->class_shadowed) = x; TREE_TYPE (class_binding_level->class_shadowed) = x;
...@@ -6062,8 +6036,6 @@ init_decl_processing () ...@@ -6062,8 +6036,6 @@ init_decl_processing ()
signal (SIGBUS, signal_catch); signal (SIGBUS, signal_catch);
#endif #endif
gcc_obstack_init (&decl_obstack);
build_common_tree_nodes (flag_signed_char); build_common_tree_nodes (flag_signed_char);
error_mark_list = build_tree_list (error_mark_node, error_mark_node); error_mark_list = build_tree_list (error_mark_node, error_mark_node);
......
...@@ -3623,7 +3623,7 @@ maybe_get_template_decl_from_type_decl (decl) ...@@ -3623,7 +3623,7 @@ maybe_get_template_decl_from_type_decl (decl)
D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments. 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 (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 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 copy it here to keep it from being reclaimed when the decl storage
is reclaimed. is reclaimed.
......
...@@ -3125,24 +3125,13 @@ void ...@@ -3125,24 +3125,13 @@ void
push_class_decls (type) push_class_decls (type)
tree type; tree type;
{ {
struct obstack *ambient_obstack = current_obstack;
search_stack = push_search_level (search_stack, &search_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. */ /* Enter type declarations and mark. */
dfs_walk (TYPE_BINFO (type), dfs_push_type_decls, unmarked_pushdecls_p, 0); dfs_walk (TYPE_BINFO (type), dfs_push_type_decls, unmarked_pushdecls_p, 0);
/* Enter non-type declarations and unmark. */ /* Enter non-type declarations and unmark. */
dfs_walk (TYPE_BINFO (type), dfs_push_decls, marked_pushdecls_p, 0); 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. */ /* Here's a subroutine we need because C lacks lambdas. */
......
...@@ -398,7 +398,7 @@ break_out_calls (exp) ...@@ -398,7 +398,7 @@ break_out_calls (exp)
} }
extern struct obstack *current_obstack; 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 *saveable_obstack;
extern struct obstack *expression_obstack; extern struct obstack *expression_obstack;
...@@ -1110,7 +1110,7 @@ list_hash_add (hashcode, list) ...@@ -1110,7 +1110,7 @@ list_hash_add (hashcode, list)
{ {
register struct list_hash *h; 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->hashcode = hashcode;
h->list = list; h->list = list;
h->next = list_hash_table[hashcode % TYPE_HASH_SIZE]; h->next = list_hash_table[hashcode % TYPE_HASH_SIZE];
...@@ -1129,7 +1129,6 @@ tree ...@@ -1129,7 +1129,6 @@ tree
hash_tree_cons (purpose, value, chain) hash_tree_cons (purpose, value, chain)
tree purpose, value, chain; tree purpose, value, chain;
{ {
struct obstack *ambient_obstack = current_obstack;
tree t; tree t;
int hashcode = 0; int hashcode = 0;
...@@ -1141,15 +1140,12 @@ hash_tree_cons (purpose, value, chain) ...@@ -1141,15 +1140,12 @@ hash_tree_cons (purpose, value, chain)
return t; return t;
} }
current_obstack = &class_obstack;
t = tree_cons (purpose, value, chain); t = tree_cons (purpose, value, chain);
/* If this is a new list, record it for later reuse. */ /* If this is a new list, record it for later reuse. */
if (! debug_no_list_hash) if (! debug_no_list_hash)
list_hash_add (hashcode, t); list_hash_add (hashcode, t);
current_obstack = ambient_obstack;
return t; return t;
} }
...@@ -2040,9 +2036,6 @@ extern int depth_reached; ...@@ -2040,9 +2036,6 @@ extern int depth_reached;
void void
print_lang_statistics () 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_search_statistics ();
print_class_statistics (); print_class_statistics ();
#ifdef GATHER_STATISTICS #ifdef GATHER_STATISTICS
......
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