public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mukul Sabharwal <mjsabby@gmail.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: jit@gcc.gnu.org
Subject: Re: [Announce] GCCSharp - libgccjit bindings for C#
Date: Thu, 01 Jan 2015 00:00:00 -0000	[thread overview]
Message-ID: <CAC6EoopA2vX1P5hTF=qKzQ=qFd_JOmy6Vb7qgTYnxMtQA=Z=BQ@mail.gmail.com> (raw)
In-Reply-To: <1429888157.32584.162.camel@surprise>

I did not know libgccjit had a C++ API as well, I suppose I can model
the C# API to look like that.

Thanks for the feedback, I agree it'll make the API less-verbose.

For folks who do like the verbosity, I'll keep the C-ish API around,
but the OOP approach will make it cleaner.

On Fri, Apr 24, 2015 at 8:09 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Thu, 2015-04-23 at 12:29 -0700, Mukul Sabharwal wrote:
>> I'd like to introduce GCCSharp [ http://github.com/mjsabby/GCCSharp ]
>> - libgccjit bindings for C# that are are modeled after the C Bindings,
>> but improve type-safety by strongly typing the different pointers used
>> (i.e. gcc_jit_context* is different from gcc_jit_result*, etc.); this
>> also improves productivity in a C# IDE.
>>
>> My primary use case for libgccjit is actually not using it is as JIT
>> but as an AOT for a toy-but-turing-complete language, hence the
>> project name GCCSharp which does not include the term JIT.
>>
>> The bindings have only been tested on Linux (which is where I need
>> this for my language port), I suppose for completeness I will work on
>> testing this on Windows, but that will likely require a source build
>> of GCC that I haven't gotten to yet.
>>
>> Feedback and patches are welcome.
>
> Hi Mukul; thanks for working on this!
>
> I've added a link to your project to the wiki page at:
> https://gcc.gnu.org/wiki/JIT
>
> On the subject of feedback, libgccjit's C API is rather verbose, but in
> an object-oriented language it's possible to greatly simplify the client
> code by using methods and namespaces.
>
> (Caveat: I have zero C# experience, and am relying on the syntax
> similarity with Java, with which I have close-to-but-not-zero
> experience)
>
> So rather than e.g.
>       GCCJITTypeRef voidType = GCC.JITContextGetType(ctxt,
>                                                      GCC_JIT_TYPES.GCC_JIT_TYPE_VOID);
>
> would it be possible to have something like:
>
>       TypeRef voidType = ctxt.GetType(TYPES.VOID);
>
> where "TypeRef" would be a namespaced-lookup of
>
>    "GCCSharp.TypeRef"
>
> and "TYPES" would be (after namespace lookup) be "GCCSharp.TYPES", with
> the GetType being a method of the
> GCCSharp.Context class?
>
> I did something like this for the C++ bindings, and for the Python
> bindings.  The Python bindings do it by using two layers: a low-level
> layer that binds the C API into the Python world, and then a
> higher-level layer that adds an object-oriented approach to the API.
>
> I hope that this would still work well within IDEs, and I think it looks
> more elegant.
>
> Hope this is constructive (and please forgive me if I'm missing
> something)
>
> Dave
>
>

      reply	other threads:[~2015-04-24 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01  0:00 Mukul Sabharwal
2015-01-01  0:00 ` David Malcolm
2015-01-01  0:00   ` Mukul Sabharwal [this message]

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='CAC6EoopA2vX1P5hTF=qKzQ=qFd_JOmy6Vb7qgTYnxMtQA=Z=BQ@mail.gmail.com' \
    --to=mjsabby@gmail.com \
    --cc=dmalcolm@redhat.com \
    --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).