This is the mail archive of the 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: gengtype, threads, and 'length'

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

Due to the way mark functions are constructed, we can't have a GCable
array whose length is taken from a global variable.  In this situation
the mark function will use the thread-local length -- but we want to
mark each thread's object.

The simplest fix is to simply disallow this case and require a
thread-local object's length to be found relative to the object.  So
far this only affects dwarf2out.c (I have a patch to turn these uses
into VECs instead).

I considered an alternate implementation where, before pausing for a
GC, a thread would copy these length variables into structures visible
to the GC.  However, that was more work and I didn't see the need.


2007-10-16  Tom Tromey  <>

	* gengtype.c (write_roots): Ensure thread-local variable does not
	use global for 'length'.

Index: gengtype.c
--- gengtype.c	(revision 129239)
+++ gengtype.c	(working copy)
@@ -3445,7 +3445,13 @@
       for (o = v->opt; o; o = o->next)
 	if (strcmp (o->name, "length") == 0)
-	  length_p = 1;
+	  {
+	    length_p = 1;
+	    if (v->thread_local && !strchr (o->info, '%'))
+	      error_at_line (&v->line,
+			     "thread-local `%s' has non-relative `length'",
+			     v->name);
+	  }
 	else if (strcmp (o->name, "deletable") == 0
 		 || strcmp (o->name, "if_marked") == 0)
 	  skip_p = 1;

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