diff options
author | Geoffrey Keating <geoffk@redhat.com> | 2002-06-04 07:11:05 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2002-06-04 07:11:05 +0000 |
commit | e2500fedef1a1c5b9e818fd1e2c281adff80df4a (patch) | |
tree | 720630adca0f6b357e05c4feb8cbe33d556925ce /gcc/objc | |
parent | c2ae66169b8326bbf9b1dfa63083d2560fea7ddf (diff) | |
download | gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.zip gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.tar.gz gcc-e2500fedef1a1c5b9e818fd1e2c281adff80df4a.tar.bz2 |
Merge from pch-branch up to tag pch-commit-20020603.
From-SVN: r54232
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/Make-lang.in | 4 | ||||
-rw-r--r-- | gcc/objc/config-lang.in | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 80 | ||||
-rw-r--r-- | gcc/objc/objc-act.h | 16 | ||||
-rw-r--r-- | gcc/objc/objc-lang.c | 4 |
5 files changed, 19 insertions, 87 deletions
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index da26dba..86b3dab 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -93,10 +93,12 @@ objc-act.o : $(srcdir)/objc/objc-act.c \ $(C_COMMON_H) $(srcdir)/c-tree.h \ $(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h \ - $(srcdir)/langhooks.h $(LANGHOOKS_DEF_H) + $(srcdir)/langhooks.h $(LANGHOOKS_DEF_H) gtype-objc.h $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-act.c +gtype-objc.h : s-gtype ; @true + # # Build hooks: diff --git a/gcc/objc/config-lang.in b/gcc/objc/config-lang.in index 57066a4..62ff455 100644 --- a/gcc/objc/config-lang.in +++ b/gcc/objc/config-lang.in @@ -32,3 +32,5 @@ compilers="cc1obj\$(exeext)" stagestuff="" target_libs=target-libobjc + +gtfiles="\$(srcdir)/objc/objc-act.h" diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 132c28e..2835f83 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -294,9 +294,6 @@ static void generate_classref_translation_entry PARAMS ((tree)); static void handle_class_ref PARAMS ((tree)); static void generate_struct_by_value_array PARAMS ((void)) ATTRIBUTE_NORETURN; -static void objc_act_parse_init PARAMS ((void)); -static void ggc_mark_imp_list PARAMS ((void *)); -static void ggc_mark_hash_table PARAMS ((void *)); /*** Private Interface (data) ***/ @@ -516,8 +513,6 @@ objc_init (filename) if (print_struct_values) generate_struct_by_value_array (); - objc_act_parse_init (); - return filename; } @@ -1234,8 +1229,6 @@ build_objc_string_object (strings) VARRAY_PUSH_TREE (vstrings, strings); string = combine_strings (vstrings); - - VARRAY_FREE (vstrings); } else string = strings; @@ -5279,8 +5272,8 @@ hash_func (sel_name) static void hash_init () { - nst_method_hash_list = (hash *) xcalloc (SIZEHASHTABLE, sizeof (hash)); - cls_method_hash_list = (hash *) xcalloc (SIZEHASHTABLE, sizeof (hash)); + nst_method_hash_list = (hash *) ggc_calloc (SIZEHASHTABLE, sizeof (hash)); + cls_method_hash_list = (hash *) ggc_calloc (SIZEHASHTABLE, sizeof (hash)); } /* WARNING!!!! hash_enter is called with a method, and will peek @@ -5293,18 +5286,10 @@ hash_enter (hashlist, method) hash *hashlist; tree method; { - static hash hash_alloc_list = 0; - static int hash_alloc_index = 0; hash obj; int slot = hash_func (METHOD_SEL_NAME (method)) % SIZEHASHTABLE; - if (! hash_alloc_list || hash_alloc_index >= HASH_ALLOC_LIST_SIZE) - { - hash_alloc_index = 0; - hash_alloc_list = (hash) xmalloc (sizeof (struct hashed_entry) - * HASH_ALLOC_LIST_SIZE); - } - obj = &hash_alloc_list[hash_alloc_index++]; + obj = (hash) ggc_alloc (sizeof (struct hashed_entry)); obj->list = 0; obj->next = hashlist[slot]; obj->key = method; @@ -5336,17 +5321,9 @@ hash_add_attr (entry, value) hash entry; tree value; { - static attr attr_alloc_list = 0; - static int attr_alloc_index = 0; attr obj; - if (! attr_alloc_list || attr_alloc_index >= ATTR_ALLOC_LIST_SIZE) - { - attr_alloc_index = 0; - attr_alloc_list = (attr) xmalloc (sizeof (struct hashed_attribute) - * ATTR_ALLOC_LIST_SIZE); - } - obj = &attr_alloc_list[attr_alloc_index++]; + obj = (attr) ggc_alloc (sizeof (struct hashed_attribute)); obj->next = entry->list; obj->value = value; @@ -6147,7 +6124,7 @@ continue_class (class) if (!objc_class_template) build_class_template (); - imp_entry = (struct imp_entry *) xmalloc (sizeof (struct imp_entry)); + imp_entry = (struct imp_entry *) ggc_alloc (sizeof (struct imp_entry)); imp_entry->next = imp_list; imp_entry->imp_context = class; @@ -8319,51 +8296,6 @@ handle_impent (impent) } } -static void -ggc_mark_imp_list (arg) - void *arg; -{ - struct imp_entry *impent; - - for (impent = *(struct imp_entry **)arg; impent; impent = impent->next) - { - ggc_mark_tree (impent->imp_context); - ggc_mark_tree (impent->imp_template); - ggc_mark_tree (impent->class_decl); - ggc_mark_tree (impent->meta_decl); - } -} - -static void -ggc_mark_hash_table (arg) - void *arg; -{ - hash *hash_table = *(hash **)arg; - hash hst; - attr list; - int i; - - if (hash_table == NULL) - return; - for (i = 0; i < SIZEHASHTABLE; i++) - for (hst = hash_table [i]; hst; hst = hst->next) - { - ggc_mark_tree (hst->key); - for (list = hst->list; list; list = list->next) - ggc_mark_tree (list->value); - } -} - -/* Add GC roots for variables local to this file. */ -static void -objc_act_parse_init () -{ - ggc_add_tree_root (objc_global_trees, OCTI_MAX); - ggc_add_root (&imp_list, 1, sizeof imp_list, ggc_mark_imp_list); - ggc_add_root (&nst_method_hash_list, 1, sizeof nst_method_hash_list, ggc_mark_hash_table); - ggc_add_root (&cls_method_hash_list, 1, sizeof cls_method_hash_list, ggc_mark_hash_table); -} - /* Look up ID as an instance variable. */ tree lookup_objc_ivar (id) @@ -8384,3 +8316,5 @@ lookup_objc_ivar (id) else return 0; } + +#include "gtype-objc.h" diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index b4917f7..17e5bd5 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -133,28 +133,26 @@ enum objc_tree_code { typedef struct hashed_entry *hash; typedef struct hashed_attribute *attr; -struct hashed_attribute +struct hashed_attribute GTY(()) { attr next; tree value; }; -struct hashed_entry +struct hashed_entry GTY(()) { attr list; hash next; tree key; }; -extern hash *nst_method_hash_list; -extern hash *cls_method_hash_list; +extern GTY ((length ("SIZEHASHTABLE"))) hash *nst_method_hash_list; +extern GTY ((length ("SIZEHASHTABLE"))) hash *cls_method_hash_list; -#define HASH_ALLOC_LIST_SIZE 170 -#define ATTR_ALLOC_LIST_SIZE 170 #define SIZEHASHTABLE 257 /* Objective-C/Objective-C++ @implementation list. */ -struct imp_entry +struct imp_entry GTY(()) { struct imp_entry *next; tree imp_context; @@ -163,7 +161,7 @@ struct imp_entry tree meta_decl; /* _OBJC_METACLASS_<my_name>; */ }; -extern struct imp_entry *imp_list; +extern GTY(()) struct imp_entry *imp_list; extern int imp_count; /* `@implementation' */ extern int cat_count; /* `@category' */ @@ -248,7 +246,7 @@ enum objc_tree_index OCTI_MAX }; -extern tree objc_global_trees[OCTI_MAX]; +extern GTY(()) tree objc_global_trees[OCTI_MAX]; /* List of classes with list of their static instances. */ #define objc_static_instances objc_global_trees[OCTI_STATIC_NST] diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 647baf3..f5b7448 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -45,8 +45,6 @@ static void objc_init_options PARAMS ((void)); #define LANG_HOOKS_POST_OPTIONS c_common_post_options #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE c_common_parse_file -#undef LANG_HOOKS_MARK_TREE -#define LANG_HOOKS_MARK_TREE c_mark_tree #undef LANG_HOOKS_EXPAND_EXPR #define LANG_HOOKS_EXPAND_EXPR c_expand_expr #undef LANG_HOOKS_MARK_ADDRESSABLE @@ -74,8 +72,6 @@ static void objc_init_options PARAMS ((void)); #define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context #undef LANG_HOOKS_FUNCTION_LEAVE_NESTED #define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context -#undef LANG_HOOKS_FUNCTION_MARK -#define LANG_HOOKS_FUNCTION_MARK c_mark_function_context /* Attribute hooks. */ #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE |