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]
Other format: [Raw text]

[incremental] Patch: FYI: add missing dependency registration


I'm checking this in on the incremental-compiler branch.

When looking up the most recent version of a type, we have to make
sure to register a dependency on the new type in the current hunk.
Otherwise, we might reuse the hunk while not reusing all its
dependencies -- which yields obscure bugs.

With this change, the incremental compiler can now be used to
configure and build the combined gdb+binutils tree.

Tom

ChangeLog:
2008-03-31  Tom Tromey  <tromey@redhat.com>

	* c-parser.c (c_parser_find_binding): Rename 'decl' argument.
	Register hunk dependency if update is found.
	* c-tree.h (C_SMASHED_TYPE_VARIANT): Update comment.

Index: c-tree.h
===================================================================
--- c-tree.h	(revision 133653)
+++ c-tree.h	(working copy)
@@ -478,8 +478,10 @@
    convert between smashed types.  */
 #define C_SMASHED_P(T) TREE_LANG_FLAG_5 (T)
 
-/* Return the smashed variant of TYPE.  This will look up the
-   canonical type if it exists.  FIXME: better comment here.  */
+/* Return the smashed variant of TYPE.  If TYPE has been redeclared in
+   the current compilation, the appropriate redeclared variant will be
+   returned.  Note that this may have a side effect on the parser's
+   prerequisite state.  */
 #define C_SMASHED_TYPE_VARIANT(TYPE)					\
   (C_SMASHED_P (TYPE_MAIN_VARIANT (TYPE))				\
    ? build_qualified_type (c_parser_find_binding (TYPE_MAIN_VARIANT (TYPE)), \
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 133728)
+++ c-parser.c	(working copy)
@@ -1101,28 +1101,37 @@
   return se1->key == se2->key;
 }
 
-/* Given a decl (or a type), find its smashed variant.  If no smashed
+/* Given a decl or a type, find its smashed variant.  If no smashed
    variant is found, return the argument.  */
 tree
-c_parser_find_binding (tree decl)
+c_parser_find_binding (tree obj)
 {
   struct smash_entry **slot;
   struct smash_entry temp;
 
   if (! global_smash_map)
-    return decl;
+    return obj;
 
-  temp.key = decl;
+  temp.key = obj;
   temp.value = NULL;
   slot = (struct smash_entry **) htab_find_slot (global_smash_map,
 						 &temp, NO_INSERT);
   if (slot != NULL)
     {
-      decl = (*slot)->value->value;
-      gcc_assert (decl);
+      obj = (*slot)->value->value;
+      gcc_assert (obj);
+
+      /* If we found an update to a named type, we must make sure to
+	 register a dependency on the new type for the current hunk.
+	 This ensures that future re-use of this hunk will also
+	 require this update to be in place.  */
+      if (TREE_CODE_CLASS (TREE_CODE (obj)) == tcc_type
+	  && TYPE_NAME (TYPE_MAIN_VARIANT (obj)))
+	c_parser_lookup_callback (TYPE_NAME (TYPE_MAIN_VARIANT (obj)),
+				  obj, true);
     }
 
-  return decl;
+  return obj;
 }
 
 /* Hash function for c_tree_map_entry.  */


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