On Fri, 2015-09-04 at 09:44 -0600, Jeff Law wrote: > On 09/04/2015 09:40 AM, David Kunsman wrote: > > what do you think about the sub project in the wiki: > > > > Parallel Compilation: > > > > One approach is to make the front end multi-threaded. (I've pretty > > much abandoned this idea. There are too many mutable tree fields, > > making this a difficult project. Also, threads do not interact well > > with fork, which is currently needed by the code generation approach.) > You should get in contact with David Malcolm as these issues are > directly related to his JIT work. > > > > This will entail removing most global variables, marking some with > > __thread, and wrapping a few with locks. > Yes, but that's work that is already in progress. Right now David's got > a big log and context switch in place, but we really want to drive down ^^^ "lock" > the amount of stuff in that context switch.
FWIW, grep for "ACQUIRE MUTEX" and "RELEASE MUTEX" within: https://gcc.gnu.org/onlinedocs/jit/internals/index.html#overview-of-code-structure I probably should better document what state is guarded by jit_mutex: basically it's anything within libbackend.a, including anything that interacts with GTY/ggc. (in fact, it's basically every source file, apart from libgccjit.c, jit-recording.c, and parts of jit-playback.c). You may or may not want to read this doc I wrote in 2013: https://dmalcolm.fedorapeople.org/gcc/global-state/ (Re-reading it now, it's very out-of-date and I no longer agree with much of what I wrote in that doc, so I don't know if it's useful).