This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug jit/64722] On 2nd time libgccjit is run in-process on i686, generated code clobbers %ebx register
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Jan 2015 15:04:54 +0000
- Subject: [Bug jit/64722] On 2nd time libgccjit is run in-process on i686, generated code clobbers %ebx register
- Auto-submitted: auto-generated
- References: <bug-64722-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64722
--- Comment #9 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> Can you explain it? Usually when this function is called,
> pic_offset_table_rtx is NULL and your i386.h macro relies on that.
> When initializing default target during initialization it is NULL of course,
> and apparently even in target_reinit, when it is called with freshly cleared
> heap object for the non-default target.
> It is just when jit calls the initialization again without clearing all the
> variables...
Indeed: I believe the issue here is specifically with the JIT, which is
re-running the compiler multiple times in-process, and in particular, is
re-running init_emit_regs.
> So I believe my proposed change is correct.
Agreed, fwiw.
> In any case, perhaps jit shouldn't reinitialize everything all the time, at
> least if the compilation options don't change.
Ideally, yes. Currently the out-of-process invocation of the driver (and thus
collect2) dominates the profile, and fixing that is probably GCC 6 material.
I've tried hacking it out to directly invoke "as" and "ld", and after fixing
that, the per-compilation RTL reinit does show up significantly in the profile,
but that probably ought to be tracked as a separate bug. I suspect that
avoiding re-initing RTL may have to wait for gcc 6.
In the meantime your patch from comment #3 seems a suitable workaround; thanks.
I'll attempt a bootstrap with it.