This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Compiler identifier hashtable improvements (and ObjC cleanup)


Further to what Zack and I were discussing a couple of days ago, I bit
the bullet and converted GCC's identifier hashtable so that an entry
is now one of the following 3 things:

o an empty entry is a NULL_TREE
o a non-empty entry that has undergone a get_identifier () call is
  a pointer to an IDENTIFIER_NODE
o a non-empty entry that has not undergone a get_identifier () call is
  a pointer to an IDENTIFIER_NODE, but that temporarily has its "code"
  set to ERROR_MARK instead of IDENTIFIER_NODE.

Previously it was a "string header" structure, which would contain a
pointer to the identifier text, its length, and a tree pointer.  The
analogous 3 states were:

o a NULL text pointer
o a non-NULL text pointer and a non-NULL tree pointer
o a non-NULL text pointer and a NULL tree pointer.

This is nice because each hash entry now takes up the space of one
pointer, rather than 3, saving 2 pointers (8 or 16 bytes) per
identifier.  This is true for all front-ends - there is nothing
front-end specific here.  The text pointer and length were being
stored twice in the previous implementation.

The Objective C front-end has 6 reserved words (protocol qualifiers)
that are only reserved in certain contexts.  It handled this by
switching the tree pointers of the string headers of those identifiers
in the hashtable when entering and leaving those contexts.  This
involved tricky tree handling and 2 new gc roots, and 6 hash table
lookups on each entry and exit from those contexts.

This patch replaces that mechanism with something a more efficient -
we simply toggle a boolean flag when entering and leaving those
contexts, leaving the identifiers flagged as reserved words.  If we
notice a reserved word that is one of these identifiers, we only treat
it as reserved if we're in the right context according to the boolean
flag.

Strings are now allocated from an obstack, and don't get hashed in the
hashtable.

What is cool about this patch, though, is that converting CPP to use
this same hashtable will be very simple, without much of the hackery
I'd originally intended (thanks, Zack!).  In fact, I intend that CPP's
hashnode will actually be an extension of the identifier structure
that will be common to the C front ends.  That will bring speedups and
more memory savings to those 3 front ends.

This patch has bootstrapped all front ends apart from ObjC before I
got ObjC working.  I've just bootstrapped ObjC and C alone.  I'm now
doing all the front ends together to make sure.

OK to commit on mainline?

Neil.

	* c-common.h (RID_FIRST_PQ): New.
	* c-parse.in (objc_pq_context): New.
	(objc parser): Set objc_pq_context rather than calling
	remember_protocol_qualifiers and forget_protocol_qualifiers.
	Don't call save_and_forget_protocol_qualifiers.
	(yylexname): Handle objc protocol qualifiers here.
	* stringpool.c (struct str_header): Replace with sp_hashnode.
	(SP_EMPTY, SP_LEN, SP_TREE, SP_STR, SP_VALID): New.
	(alloc_string): Rename alloc_ident.  Use the SP_ accessors.
	Allocate an IDENTIFIER_NODE for each identifier.
	(FORALL_STRINGS, set_identifier): Delete.
	(FORALL_IDS, expand_string_table, stringpool_statistics): Update.
	(ggc_alloc_string): Use an obstack.
	(get_identifier, maybe_get_identifier, mark_string_hash): Update.
	* tree.h: Update comments.
	(set_identifier): Delete.
	* objc/objc-act.c (N_PQ, saved_pq, saved_not_pq,
	save_and_forget_protocol_qualifiers, forget_protocol_qualifiers,
	remember_protocol_qualifiers): Delete.

Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.69
diff -u -p -r1.69 c-common.h
--- c-common.h	2001/05/11 06:38:47	1.69
+++ c-common.h	2001/05/15 21:22:27
@@ -61,7 +61,7 @@ enum rid
   RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
 
   /* ObjC */
-  RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
+  RID_FIRST_PQ, RID_IN = RID_FIRST_PQ, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
 
   /* C */
   RID_INT,     RID_CHAR,   RID_FLOAT,    RID_DOUBLE, RID_VOID,
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.88
diff -u -p -r1.88 c-parse.in
--- c-parse.in	2001/05/12 17:58:41	1.88
+++ c-parse.in	2001/05/15 21:22:41
@@ -271,6 +271,7 @@ tree objc_ivar_context;
 enum tree_code objc_inherit_code;
 int objc_receiver_context;
 int objc_public_flag;
+int objc_pq_context;
 
 end ifobjc
 
@@ -2837,13 +2838,13 @@ classdef:
 protocoldef:
 	  PROTOCOL identifier protocolrefs
 		{
-		  remember_protocol_qualifiers ();
+		  objc_pq_context = 1;
 		  objc_interface_context
 		    = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
 		}
 	  methodprotolist END
 		{
-		  forget_protocol_qualifiers();
+		  objc_pq_context = 0;
 		  finish_protocol(objc_interface_context);
 		  objc_interface_context = NULL_TREE;
 		}
@@ -2949,7 +2950,7 @@ ivar_declarator:
 methoddef:
 	  '+'
 		{
-		  remember_protocol_qualifiers ();
+		  objc_pq_context = 1;
 		  if (objc_implementation_context)
 		    objc_inherit_code = CLASS_METHOD_DECL;
                   else
@@ -2957,7 +2958,7 @@ methoddef:
 		}
 	  methoddecl
 		{
-		  forget_protocol_qualifiers ();
+		  objc_pq_context = 0;
 		  add_class_method (objc_implementation_context, $3);
 		  start_method_def ($3);
 		  objc_method_context = $3;
@@ -2974,7 +2975,7 @@ methoddef:
 
 	| '-'
 		{
-		  remember_protocol_qualifiers ();
+		  objc_pq_context = 1;
 		  if (objc_implementation_context)
 		    objc_inherit_code = INSTANCE_METHOD_DECL;
                   else
@@ -2982,7 +2983,7 @@ methoddef:
 		}
 	  methoddecl
 		{
-		  forget_protocol_qualifiers ();
+		  objc_pq_context = 0;
 		  add_instance_method (objc_implementation_context, $3);
 		  start_method_def ($3);
 		  objc_method_context = $3;
@@ -3023,13 +3024,13 @@ methodproto:
 	  '+'
 		{
 		  /* Remember protocol qualifiers in prototypes.  */
-		  remember_protocol_qualifiers ();
+		  objc_pq_context = 1;
 		  objc_inherit_code = CLASS_METHOD_DECL;
 		}
 	  methoddecl
 		{
 		  /* Forget protocol qualifiers here.  */
-		  forget_protocol_qualifiers ();
+		  objc_pq_context = 0;
 		  add_class_method (objc_interface_context, $3);
 		}
 	  semi_or_error
@@ -3037,13 +3038,13 @@ methodproto:
 	| '-'
 		{
 		  /* Remember protocol qualifiers in prototypes.  */
-		  remember_protocol_qualifiers ();
+		  objc_pq_context = 1;
 		  objc_inherit_code = INSTANCE_METHOD_DECL;
 		}
 	  methoddecl
 		{
 		  /* Forget protocol qualifiers here.  */
-		  forget_protocol_qualifiers ();
+		  objc_pq_context = 0;
 		  add_instance_method (objc_interface_context, $3);
 		}
 	  semi_or_error
@@ -3615,9 +3616,6 @@ ifobjc
 	  = get_identifier (reswords[i].word + 1);
 end ifobjc
     }
-ifobjc
-  save_and_forget_protocol_qualifiers ();
-end ifobjc
 }
 
 const char *
@@ -3683,22 +3681,28 @@ yylexname ()
   if (C_IS_RESERVED_WORD (yylval.ttype))
     {
       enum rid rid_code = C_RID_CODE (yylval.ttype);
-      int yycode = rid_to_yy[(int) rid_code];
 
-      if (yycode == STRING_FUNC_NAME)
-	{
-	   /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
-	      to string constants.  */
-	  const char *name = fname_string (rid_code);
+ifobjc
+      if (!((unsigned int) rid_code - (unsigned int) RID_FIRST_PQ < 6)
+	  || objc_pq_context)
+end ifobjc
+      {
+	int yycode = rid_to_yy[(int) rid_code];
+	if (yycode == STRING_FUNC_NAME)
+	  {
+	    /* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
+	       to string constants.  */
+	    const char *name = fname_string (rid_code);
 	  
-	  yylval.ttype = build_string (strlen (name) + 1, name);
-	  last_token = CPP_STRING;  /* so yyerror won't choke */
-	  return STRING;
-	}
+	    yylval.ttype = build_string (strlen (name) + 1, name);
+	    last_token = CPP_STRING;  /* so yyerror won't choke */
+	    return STRING;
+	  }
       
-      /* Return the canonical spelling for this keyword.  */
-      yylval.ttype = ridpointers[(int) rid_code];
-      return yycode;
+	/* Return the canonical spelling for this keyword.  */
+	yylval.ttype = ridpointers[(int) rid_code];
+	return yycode;
+      }
     }
 
   decl = lookup_name (yylval.ttype);
Index: stringpool.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stringpool.c,v
retrieving revision 1.4
diff -u -p -r1.4 stringpool.c
--- stringpool.c	2001/03/02 00:39:59	1.4
+++ stringpool.c	2001/05/15 21:22:42
@@ -49,21 +49,19 @@ const char digit_vector[] = {
 
 static struct obstack string_stack;
 
-/* This is the hash entry associated with each string.  It lives in
-   the hash table; only the string lives in the obstack.  Note that
-   the string is not necessarily NUL terminated.  */
-
-struct str_header
-{
-  const char *ptr;
-  tree data;	/* for get_identifier */
-  unsigned int len;
-};
+/* Each hashnode is just a pointer to a TREE_IDENTIFIER.  */
+typedef struct tree_identifier *sp_hashnode;
+
+#define SP_EMPTY(NODE) ((NODE) == NULL)
+#define SP_LEN(NODE) ((NODE)->length)
+#define SP_TREE(NODE) ((tree) NODE)
+#define SP_STR(NODE) ((NODE)->pointer)
+#define SP_VALID(NODE) (TREE_CODE (SP_TREE (NODE)) == IDENTIFIER_NODE)
 
 /* This is the hash table structure.  There's only one.  */
 struct str_hash
 {
-  struct str_header *entries;
+  sp_hashnode *entries;
   size_t nslots;	/* total slots in the entries array */
   size_t nelements;	/* number of live elements */
 
@@ -77,24 +75,17 @@ static struct str_hash string_hash = { 0
 
 enum insert_option { INSERT, NO_INSERT };
 
-static struct str_header *alloc_string PARAMS ((const char *, size_t,
-						enum insert_option));
+static sp_hashnode alloc_ident PARAMS ((const char *, size_t,
+					enum insert_option));
 static inline unsigned int calc_hash PARAMS ((const unsigned char *, size_t));
 static void mark_string_hash PARAMS ((void *));
-static struct str_header *expand_string_table PARAMS ((struct str_header *));
+static void expand_string_table PARAMS ((void));
 
 /* Convenience macro for iterating over the hash table.  E is set to
    each live entry in turn.  */
-#define FORALL_STRINGS(E) \
-for (E = string_hash.entries; E < string_hash.entries+string_hash.nslots; E++) \
-  if (E->ptr != NULL)
-    /* block here */
-
-/* Likewise, but tests ->data instead of ->ptr (for cases where we only
-   care about entries with ->data set)  */
 #define FORALL_IDS(E) \
 for (E = string_hash.entries; E < string_hash.entries+string_hash.nslots; E++) \
-  if (E->data != NULL)
+  if (!SP_EMPTY (*E) && SP_VALID (*E))
 
 /* 0 while creating built-in identifiers.  */
 static int do_identifier_warnings;
@@ -109,8 +100,8 @@ init_stringpool ()
   /* Strings need no alignment.  */
   obstack_alignment_mask (&string_stack) = 0;
 
-  string_hash.entries = (struct str_header *)
-    xcalloc (string_hash.nslots, sizeof (struct str_header));
+  string_hash.entries = (sp_hashnode *)
+    xcalloc (string_hash.nslots, sizeof (sp_hashnode));
 }
 
 /* Enable warnings on similar identifiers (if requested).
@@ -150,13 +141,13 @@ calc_hash (str, len)
 #undef HASHSTEP
 }
 
-/* Internal primitive: returns the header structure for the string of
-   length LENGTH, containing CONTENTS.  If that string already exists
-   in the table, returns the existing entry.  If the string hasn't
-   been seen before and the last argument is INSERT, inserts and returns
-   a new entry. Otherwise returns NULL.  */
-static struct str_header *
-alloc_string (contents, length, insert)
+/* Internal primitive: returns the header structure for the identifier
+   of length LENGTH, containing CONTENTS.  If that identifier already
+   exists in the table, returns the existing entry.  If the identifier
+   hasn't been seen before and the last argument is INSERT, inserts
+   and returns a new entry. Otherwise returns NULL.  */
+static sp_hashnode
+alloc_ident (contents, length, insert)
      const char *contents;
      size_t length;
      enum insert_option insert;
@@ -165,8 +156,7 @@ alloc_string (contents, length, insert)
   unsigned int hash2;
   unsigned int index;
   size_t sizemask;
-  struct str_header *entry;
-  struct str_header *entries = string_hash.entries;
+  sp_hashnode entry;
 
   sizemask = string_hash.nslots - 1;
   index = hash & sizemask;
@@ -178,13 +168,13 @@ alloc_string (contents, length, insert)
 
   for (;;)
     {
-      entry = entries + index;
+      entry = string_hash.entries[index];
 
-      if (entry->ptr == NULL)
+      if (SP_EMPTY (entry))
 	break;
 
-      if (entry->len == length
-	  && !memcmp (entry->ptr, contents, length))
+      if ((size_t) SP_LEN (entry) == length
+	  && !memcmp (SP_STR (entry), contents, length))
 	return entry;
 
       index = (index + hash2) & sizemask;
@@ -194,50 +184,47 @@ alloc_string (contents, length, insert)
   if (insert == NO_INSERT)
     return NULL;
 
-  obstack_grow0 (&string_stack, contents, length);
-  entry->ptr = (const char *) obstack_finish (&string_stack);
-  entry->len = length;
-  entry->data = NULL;
+  entry = (sp_hashnode) make_node (IDENTIFIER_NODE);
+  string_hash.entries[index] = entry;
+  SP_STR (entry) = ggc_alloc_string (contents, length);
+  SP_LEN (entry) = length;
+  /* This is not yet an identifier.  */
+  TREE_SET_CODE (entry, ERROR_MARK);
 
-  if (++string_hash.nelements * 4 < string_hash.nslots * 3)
-    return entry;
+  if (++string_hash.nelements * 4 >= string_hash.nslots * 3)
+    /* Must expand the string table.  */
+    expand_string_table ();
 
-  /* Must expand the string table.  */
-  return expand_string_table (entry);
+  return entry;
 }
 
-/* Subroutine of alloc_string which doubles the size of the hash table
+/* Subroutine of alloc_ident which doubles the size of the hash table
    and rehashes all the strings into the new table.  Returns the entry
    in the new table corresponding to ENTRY.  */
-static struct str_header *
-expand_string_table (entry)
-     struct str_header *entry;
+static void
+expand_string_table ()
 {
-  struct str_header *nentries;
-  struct str_header *e, *nentry = NULL;
+  sp_hashnode *nentries;
+  sp_hashnode *e;
   size_t size, sizemask;
 
   size = string_hash.nslots * 2;
-  nentries = (struct str_header *) xcalloc (size, sizeof (struct str_header));
+  nentries = (sp_hashnode *) xcalloc (size, sizeof (sp_hashnode));
   sizemask = size - 1;
 
-  FORALL_STRINGS (e)
+  FORALL_IDS (e)
     {
       unsigned int index, hash, hash2;
 
-      hash = calc_hash ((const unsigned char *) e->ptr, e->len);
+      hash = calc_hash ((const unsigned char *) SP_STR (*e), SP_LEN (*e));
       hash2 = ((hash * 17) & sizemask) | 1;
       index = hash & sizemask;
 
       for (;;)
 	{
-	  if (nentries[index].ptr == NULL)
+	  if (SP_EMPTY (nentries[index]))
 	    {
-	      nentries[index].ptr = e->ptr;
-	      nentries[index].len = e->len;
-	      nentries[index].data = e->data;
-	      if (e == entry)
-		nentry = nentries + index;
+	      nentries[index] = *e;
 	      break;
 	    }
 
@@ -248,7 +235,6 @@ expand_string_table (entry)
   free (string_hash.entries);
   string_hash.entries = nentries;
   string_hash.nslots = size;
-  return nentry;
 }
 
 /* Allocate and return a string constant of length LENGTH, containing
@@ -262,8 +248,6 @@ ggc_alloc_string (contents, length)
      const char *contents;
      int length;
 {
-  struct str_header *str;
-
   if (length == -1)
     length = strlen (contents);
 
@@ -272,8 +256,8 @@ ggc_alloc_string (contents, length)
   if (length == 1 && contents[0] >= '0' && contents[0] <= '9')
     return digit_string (contents[0] - '0');
 
-  str = alloc_string (contents, length, INSERT);
-  return str->ptr;
+  obstack_grow0 (&string_stack, contents, length);
+  return obstack_finish (&string_stack);
 }
 
 /* Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string).
@@ -283,43 +267,36 @@ tree
 get_identifier (text)
      const char *text;
 {
-  tree idp;
-  struct str_header *str;
+  sp_hashnode node;
   size_t length = strlen (text);
 
-  str = alloc_string (text, length, INSERT);
-  idp = str->data;
-  if (idp == NULL)
+  node = alloc_ident (text, length, INSERT);
+  if (!SP_VALID (node))
     {
-      if (TREE_CODE_LENGTH (IDENTIFIER_NODE) < 0)
-	abort ();	/* set_identifier_size hasn't been called.  */
-
       /* If this identifier is longer than the clash-warning length,
 	 do a brute force search of the entire table for clashes.  */
       if (warn_id_clash && do_identifier_warnings && length >= (size_t) id_clash_len)
 	{
-	  struct str_header *e;
+	  sp_hashnode *e;
 	  FORALL_IDS (e)
 	    {
-	      if (e->len >= (size_t)id_clash_len
-		  && !strncmp (e->ptr, text, id_clash_len))
+	      if (SP_LEN (*e) >= id_clash_len
+		  && !strncmp (SP_STR (*e), text, id_clash_len))
 		{
 		  warning ("\"%s\" and \"%s\" identical in first %d characters",
-			   text, e->ptr, id_clash_len);
+			   text, SP_STR (*e), id_clash_len);
 		  break;
 		}
 	    }
 	}
 
-      idp = make_node (IDENTIFIER_NODE);
-      IDENTIFIER_LENGTH (idp) = length;
-      IDENTIFIER_POINTER (idp) = str->ptr;
+      TREE_SET_CODE (node, IDENTIFIER_NODE);
 #ifdef GATHER_STATISTICS
       id_string_size += length;
 #endif
-      str->data = idp;
     }
-  return idp;
+
+  return SP_TREE (node);
 }
 
 /* If an identifier with the name TEXT (a null-terminated string) has
@@ -330,33 +307,14 @@ tree
 maybe_get_identifier (text)
      const char *text;
 {
-  struct str_header *str;
+  sp_hashnode node;
   size_t length = strlen (text);
 
-  str = alloc_string (text, length, NO_INSERT);
-  if (str)
-    return str->data;  /* N.B. str->data might be null here, if the
-			  string has been used but not as an identifier.  */
-  return NULL_TREE;
-}
+  node = alloc_ident (text, length, NO_INSERT);
+  if (!SP_EMPTY (node) && SP_VALID (node))
+    return SP_TREE (node);
 
-/* Look up an identifier with the name TEXT, replace its identifier
-   node with NODE, and return the old identifier node.  This is used
-   by languages which need to enable and disable keywords based on
-   context; e.g. see remember_protocol_qualifiers in objc/objc-act.c.  */
-tree
-set_identifier (text, node)
-     const char *text;
-     tree node;
-{
-  struct str_header *str;
-  tree old;
-  size_t length = strlen (text);
-
-  str = alloc_string (text, length, INSERT);
-  old = str->data;	/* might be null */
-  str->data = node;
-  return old;
+  return NULL_TREE;
 }
 
 /* Report some basic statistics about the string pool.  */
@@ -367,7 +325,7 @@ stringpool_statistics ()
   size_t nelts, nids, overhead, headers;
   size_t total_bytes, longest, sum_of_squares;
   double exp_len, exp_len2, exp2_len;
-  struct str_header *e;
+  sp_hashnode *e;
 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
 		  ? (x) \
 		  : ((x) < 1024*1024*10 \
@@ -376,21 +334,21 @@ stringpool_statistics ()
 #define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
 
   total_bytes = longest = sum_of_squares = nids = 0;
-  FORALL_STRINGS (e)
+  FORALL_IDS (e)
     {
-      size_t n = e->len;
+      size_t n = SP_LEN (*e);
 
       total_bytes += n;
       sum_of_squares += n*n;
       if (n > longest)
 	longest = n;
-      if (e->data)
+      if (SP_VALID (*e))
 	nids++;
     }
       
   nelts = string_hash.nelements;
   overhead = obstack_memory_used (&string_stack) - total_bytes;
-  headers = string_hash.nslots * sizeof (struct str_header);
+  headers = string_hash.nslots * sizeof (sp_hashnode);
 
   fprintf (stderr,
 "\nString pool\n\
@@ -429,10 +387,10 @@ static void
 mark_string_hash (arg)
      void *arg ATTRIBUTE_UNUSED;
 {
-  struct str_header *h;
+  sp_hashnode *h;
 
   FORALL_IDS (h)
     {
-      ggc_mark_tree (h->data);
+      ggc_mark_tree (SP_TREE (*h));
     }
 }
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.237
diff -u -p -r1.237 tree.h
--- tree.h	2001/04/27 23:25:20	1.237
+++ tree.h	2001/05/15 21:22:53
@@ -188,7 +188,7 @@ struct tree_common
        TREE_OVERFLOW in
            INTEGER_CST, REAL_CST, COMPLEX_CST
        TREE_PUBLIC in
-           VAR_DECL or FUNCTION_DECL
+           VAR_DECL or FUNCTION_DECL or IDENTIFIER_NODE
        TREE_VIA_PUBLIC in
            TREE_LIST or TREE_VEC
        EXPR_WFL_EMIT_LINE_NOTE in
@@ -261,7 +261,8 @@ struct tree_common
    bounded_flag:
 
        TREE_BOUNDED in
-	   expressions, VAR_DECL, PARM_DECL, FIELD_DECL, FUNCTION_DECL
+	   expressions, VAR_DECL, PARM_DECL, FIELD_DECL, FUNCTION_DECL,
+	   IDENTIFIER_NODE
        TYPE_BOUNDED in
 	   ..._TYPE
 */
@@ -517,7 +518,7 @@ extern void tree_class_check_failed PARA
 
 /* In a VAR_DECL or FUNCTION_DECL,
    nonzero means name is to be accessible from outside this module.
-   In an identifier node, nonzero means an external declaration
+   In an IDENTIFIER_NODE, nonzero means an external declaration
    accessible from outside this module was previously seen
    for this name in an inner scope.  */
 #define TREE_PUBLIC(NODE) ((NODE)->common.public_flag)
@@ -1951,13 +1952,6 @@ extern tree get_identifier		PARAMS ((con
    NULL_TREE.  */
 
 extern tree maybe_get_identifier	PARAMS ((const char *));
-
-/* Look up an identifier with the name TEXT, replace its identifier
-   node with NODE, and return the old identifier node.  This is used
-   by languages which need to enable and disable keywords based on
-   context; e.g. see remember_protocol_qualifiers in objc/objc-act.c.  */
-
-extern tree set_identifier		PARAMS ((const char *, tree));
 
 /* Construct various types of nodes.  */
 
Index: objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.81
diff -u -p -r1.81 objc-act.c
--- objc-act.c	2001/05/15 19:54:53	1.81
+++ objc-act.c	2001/05/15 21:23:14
@@ -8661,46 +8661,3 @@ lookup_objc_ivar (id)
   else
     return 0;
 }
-
-/* Parser callbacks.
-   Some ObjC keywords are reserved only in a particular context:
-   in out inout bycopy byref oneway.
-   We have to save and restore the IDENTIFIER_NODEs that describe
-   them as keywords, when appropriate.  */
-
-#define N_PQ 6
-static tree saved_pq[N_PQ];
-static tree saved_not_pq[N_PQ];
-static const char *const pq_strings[N_PQ] = {
-  "bycopy", "byref", "in", "inout", "oneway", "out"
-};
-
-void
-save_and_forget_protocol_qualifiers ()
-{
-  int i;
-  for (i = 0; i < N_PQ; i++)
-    saved_pq[i] = set_identifier (pq_strings[i], NULL_TREE);
-
-  ggc_add_tree_root (saved_pq, N_PQ);
-  ggc_add_tree_root (saved_not_pq, N_PQ);
-}
-
-void
-forget_protocol_qualifiers ()
-{
-  int i;
-  for (i = 0; i < N_PQ; i++)
-    {
-      set_identifier (pq_strings[i], saved_not_pq[i]);
-      saved_not_pq[i] = NULL_TREE;
-    }
-}
-
-void
-remember_protocol_qualifiers ()
-{
-  int i;
-  for (i = 0; i < N_PQ; i++)
-    saved_not_pq[i] = set_identifier (pq_strings[i], saved_pq[i]);
-}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]