public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Basile Starynkevitch <basile@starynkevitch.net>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Simon Feltman <s.feltman@gmail.com>, jit <jit@gcc.gnu.org>
Subject: Re: gcc_jit_context (was Re: Python API (was Re: Build errors))
Date: Tue, 01 Jan 2013 00:00:00 -0000	[thread overview]
Message-ID: <1382645033.4722.7.camel@glinka.lesours> (raw)
In-Reply-To: <1382638833.2675.82.camel@surprise>

On Thu, 2013-10-24 at 14:20 -0400, David Malcolm wrote:
[...]
> So I've been thinking about reworking some of the existing C API to do
> this, eliminating the context ptr from them.  So e.g. 
> 
>   extern gcc_jit_rvalue *
>   gcc_jit_context_new_rvalue_from_int (gcc_jit_context *ctxt,
>                                        gcc_jit_type *type,
>                                        int value);
>   extern gcc_jit_rvalue *
>   gcc_jit_context_zero (gcc_jit_context *ctxt,
>                         gcc_jit_type *type);
> 
> might become:
> 
>   extern gcc_jit_rvalue *
>   gcc_jit_type_rvalue_from_int (gcc_jit_type *type,
>                                 int value);
>   extern gcc_jit_rvalue *
>   gcc_jit_type_zero (gcc_jit_type *type);


For readability reasons, I am not sure it is a good decision. Having one
argument passing the full context of the compilation everywhere is
probably more readable. (It might be preferable for performance reasons,
but you'll need to benchmark to be sure).

But it is really a matter of taste. At least if you don't pass a
gcc_jit_context explicitly document very loudly that it is getting
wrapped in gcc_jit_type, and perhaps publish a function retrieving the
context from a type, etc etc.

Cheers.


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


  reply	other threads:[~2013-10-24 20:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-01  0:00 Python API (was Re: Build errors) Simon Feltman
2013-01-01  0:00 ` Simon Feltman
2013-01-01  0:00   ` gcc_jit_context (was Re: Python API (was Re: Build errors)) David Malcolm
2013-01-01  0:00     ` Basile Starynkevitch [this message]
2013-01-01  0:00 ` Python API (was Re: Build errors) David Malcolm

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=1382645033.4722.7.camel@glinka.lesours \
    --to=basile@starynkevitch.net \
    --cc=dmalcolm@redhat.com \
    --cc=jit@gcc.gnu.org \
    --cc=s.feltman@gmail.com \
    /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).