public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* External references
@ 2015-01-01  0:00 Dibyendu Majumdar
  2015-01-01  0:00 ` David Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: Dibyendu Majumdar @ 2015-01-01  0:00 UTC (permalink / raw)
  To: jit

If a JIT compiled function needs to call externally defined C
functions, can I define these references in the parent context and use
in child contexts?

Regards
Dibyendu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: External references
  2015-01-01  0:00 External references Dibyendu Majumdar
@ 2015-01-01  0:00 ` David Malcolm
  2015-01-01  0:00   ` David Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: David Malcolm @ 2015-01-01  0:00 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: jit

On Tue, 2015-06-09 at 21:39 +0100, Dibyendu Majumdar wrote:
> If a JIT compiled function needs to call externally defined C
> functions, can I define these references in the parent context and use
> in child contexts?

Yes: you ought to be able to declare the functions with
GCC_JIT_FUNCTION_IMPORTED in the parent context to get a long-lived
gcc_jit_function * object, and then call them from child contexts.

I believe I did something like this when porting GNU Octave's JIT to
libgccjit.

I don't think there's an example of this in the docs yet (we probably
should have a tutorial showing the use of a parent context for shared
setup).

Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: External references
  2015-01-01  0:00 ` David Malcolm
@ 2015-01-01  0:00   ` David Malcolm
  0 siblings, 0 replies; 3+ messages in thread
From: David Malcolm @ 2015-01-01  0:00 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: jit

On Tue, 2015-06-09 at 16:49 -0400, David Malcolm wrote:
> On Tue, 2015-06-09 at 21:39 +0100, Dibyendu Majumdar wrote:
> > If a JIT compiled function needs to call externally defined C
> > functions, can I define these references in the parent context and use
> > in child contexts?
> 
> Yes: you ought to be able to declare the functions with
> GCC_JIT_FUNCTION_IMPORTED in the parent context to get a long-lived
> gcc_jit_function * object, and then call them from child contexts.
or, rather, *create callsites to them* within child contexts, if that
makes sense.

(snip)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-09 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01  0:00 External references Dibyendu Majumdar
2015-01-01  0:00 ` David Malcolm
2015-01-01  0:00   ` David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).