On Fri, 2023-11-17 at 14:09 -0700, Jeff Law wrote:
> 
> 
> On 11/17/23 14:08, Antoni Boucher wrote:
> > In contrast with the other frontends, libgccjit can be executed
> > multiple times in a row in the same process.
> Yup.  I'm aware of that.  Even so calling init_emit_once more than
> one 
> time still seems wrong.

There are two approaches we follow when dealing with state stored in
global variables:
(a) clean it all up via the various functions called from
toplev::finalize
(b) make it effectively constant once initialized, with idempotent
initialization

The multiple in-process executions of libgccjit could pass in different
code-generation options.  Does the RTL-initialization logic depend
anywhere on flags passed in, because if so, we're probably going to
need to re-run the initialization.

init_emit_once says it creates "some permanent unique rtl objects
shared between all functions" - but it seems non-trivial; are there any
places where what's created could be affected by command-line flags? 
If so, (a) seems necessary; if not (b) may be viable.  Antoni's patch
implements (b).

Antoni: do you know what's reusing the const_int_rtx?  If we have to go
with approach (a), we might need to have those things use the up-to-
date const_int_rtx (not sure)

Hope this is constructive
Dave

Reply via email to