dwarf1 incomplete types patch
Jason Merrill
jason@cygnus.com
Wed Jun 16 10:44:00 GMT 1999
This is parallel to the dwarf2 change from a week or so ago.
Wed Jun 16 10:33:02 1999 Jason Merrill <jason@yorick.cygnus.com>
* dwarfout.c (add_incomplete_type): New fn.
(output_type): Call it.
(retry_incomplete_types): New fn.
(dwarfout_finish): Call it.
Index: dwarfout.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarfout.c,v
retrieving revision 1.35
diff -c -p -r1.35 dwarfout.c
*** dwarfout.c 1999/04/18 13:09:27 1.35
--- dwarfout.c 1999/06/16 17:35:46
*************** static unsigned pending_types;
*** 270,275 ****
--- 270,291 ----
#define PENDING_TYPES_INCREMENT 64
+ /* A pointer to the base of a list of incomplete types which might be
+ completed at some later time. */
+
+ static tree *incomplete_types_list;
+
+ /* Number of elements currently allocated for the incomplete_types_list. */
+ static unsigned incomplete_types_allocated;
+
+ /* Number of elements of incomplete_types_list currently in use. */
+ static unsigned incomplete_types;
+
+ /* Size (in elements) of increments by which we may expand the incomplete
+ types list. Actually, a single hunk of space of this size should
+ be enough for most typical programs. */
+ #define INCOMPLETE_TYPES_INCREMENT 64
+
/* Pointer to an artificial RECORD_TYPE which we create in dwarfout_init.
This is used in a hack to help us get the DIEs describing types of
formal parameters to come *after* all of the DIEs describing the formal
*************** output_pending_types_for_scope (containi
*** 4216,4222 ****
--- 4232,4272 ----
}
}
+ /* Remember a type in the incomplete_types_list. */
+
+ static void
+ add_incomplete_type (type)
+ tree type;
+ {
+ if (incomplete_types == incomplete_types_allocated)
+ {
+ incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT;
+ incomplete_types_list
+ = (tree *) xrealloc (incomplete_types_list,
+ sizeof (tree) * incomplete_types_allocated);
+ }
+
+ incomplete_types_list[incomplete_types++] = type;
+ }
+
+ /* Walk through the list of incomplete types again, trying once more to
+ emit full debugging info for them. */
+
static void
+ retry_incomplete_types ()
+ {
+ register tree type;
+
+ finalizing = 1;
+ while (incomplete_types)
+ {
+ --incomplete_types;
+ type = incomplete_types_list[incomplete_types];
+ output_type (type, NULL_TREE);
+ }
+ }
+
+ static void
output_type (type, containing_scope)
register tree type;
register tree containing_scope;
*************** output_type (type, containing_scope)
*** 4380,4386 ****
&& TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_TYPE
&& TREE_CODE (TYPE_CONTEXT (type)) != METHOD_TYPE))
&& !finalizing)
! return; /* EARLY EXIT! Avoid setting TREE_ASM_WRITTEN. */
/* Prevent infinite recursion in cases where the type of some
member of this type is expressed in terms of this type itself. */
--- 4430,4439 ----
&& TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_TYPE
&& TREE_CODE (TYPE_CONTEXT (type)) != METHOD_TYPE))
&& !finalizing)
! {
! add_incomplete_type (type);
! return; /* EARLY EXIT! Avoid setting TREE_ASM_WRITTEN. */
! }
/* Prevent infinite recursion in cases where the type of some
member of this type is expressed in terms of this type itself. */
*************** void
*** 5843,5848 ****
--- 5900,5907 ----
dwarfout_finish ()
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
+
+ retry_incomplete_types ();
fputc ('\n', asm_out_file);
ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
More information about the Gcc-patches
mailing list