This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[incremental] Patch: FYI: gengtype, threads, and 'length'
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Oct 2007 11:06:03 -0600
- Subject: [incremental] Patch: FYI: gengtype, threads, and 'length'
- Reply-to: Tom Tromey <tromey at redhat dot com>
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.
Tom
ChangeLog:
2007-10-16 Tom Tromey <tromey@redhat.com>
* 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;