public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Basile Starynkevitch <basile@starynkevitch.net>, akrl <akrl@sdf.org>
Cc: jit@gcc.gnu.org
Subject: Re: about header file parsing
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <1547048594.7788.120.camel@redhat.com> (raw)
In-Reply-To: <85568212-cec8-f8c8-2941-8db5d19e2989@starynkevitch.net>

On Wed, 2019-01-09 at 16:13 +0100, Basile Starynkevitch wrote:
> On 1/9/19 4:03 PM, akrl wrote:
> > Sorry I try to explain it better.
> > I was thinking to a gcc plugin (or potentially something else)
> > that 
> > given a C file produce the libgccjit code necessary to fill a
> > context
> > with what is in the source file.
> 
> That could not work in general, because C has macros (think of the
> `EOF` 
> macro constant in `<stdio.h>`) that have no equivalent in libgccjit. 

Although possibly not working "in general" I think it could work for
most important cases.   A macro in C typically can be handled as either
a client-side function invocation in libgccjit, or as a libgccjit
function.

For example, CPython has various reference-counting macros:

 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)

and in my "coconut" JIT-compiler for CPython I implement this as a
libgccjit function:

https://github.com/davidmalcolm/coconut/blob/master/coconut/compiler.py
#L501

(effectively treating it as a static inline function).

> And 
> in practice C macros are very important (and a lot of API for C are 
> using macros, see also macros such as WIFEXITED in wait(2) on some
> Linux 
> system).
> 
> We have to admit that C and libgccjit are different "languages" (even
> if 
> conceptually very close). And a C API is not exactly a set of
> "objects" 
> that libgccjit can handle.

They're not the same, but it is important that libgccjit be able to
interoperate well with C APIs.

Dave

  reply	other threads:[~2019-01-09 15:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 akrl
2019-01-01  0:00 ` Basile Starynkevitch
2019-01-01  0:00   ` Marc Nieper-Wißkirchen
2019-01-01  0:00     ` Marc Nieper-Wißkirchen
2019-01-01  0:00       ` David Malcolm
2019-01-01  0:00         ` Marc Nieper-Wißkirchen
2019-01-01  0:00           ` akrl
2019-01-01  0:00             ` David Malcolm
2019-01-01  0:00               ` akrl
2019-01-01  0:00                 ` Marc Nieper-Wißkirchen
2019-01-01  0:00                   ` akrl
2019-01-01  0:00                     ` Marc Nieper-Wißkirchen
2019-01-01  0:00                       ` akrl
2019-01-01  0:00                         ` Marc Nieper-Wißkirchen
2019-01-01  0:00                           ` akrl
2019-01-01  0:00           ` David Malcolm
2019-01-01  0:00   ` Marc Nieper-Wißkirchen
2019-01-01  0:00 ` David Malcolm
2019-01-01  0:00   ` akrl
2019-01-01  0:00     ` David Malcolm
2019-01-01  0:00       ` akrl
2019-01-01  0:00         ` David Malcolm
2019-01-01  0:00     ` Basile Starynkevitch
2019-01-01  0:00       ` David Malcolm
2019-01-01  0:00       ` akrl
2019-01-01  0:00         ` Basile Starynkevitch
2019-01-01  0:00           ` David Malcolm [this message]
2019-01-01  0:00             ` Marc Nieper-Wißkirchen
2019-01-01  0:00               ` akrl
2019-01-01  0:00                 ` Marc Nieper-Wißkirchen
2019-01-01  0:00               ` Basile Starynkevitch
     [not found] <df8944b7-1fbe-b56f-cc48-ab926d0cb5ad@starynkevitch.net>
2019-01-01  0:00 ` Basile Starynkevitch
2019-01-01  0:00   ` Marc Nieper-Wißkirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1547048594.7788.120.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=akrl@sdf.org \
    --cc=basile@starynkevitch.net \
    --cc=jit@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).