From: Basile Starynkevitch <basile@starynkevitch.net>
To: jit@gcc.gnu.org
Subject: client data for GCCJIT objects?
Date: Thu, 01 Jan 2015 00:00:00 -0000 [thread overview]
Message-ID: <20151013133204.GA7100@ovh.starynkevitch.net> (raw)
Hello All,
It would be nice if some client data could be attached to each GCCJIT object.
Or at least, within libgccjit++.h, to be able to use gccjit::object as
some key either for std::map or for std::unordered_map (so either an
ordered relation on their internal address, or an equality test with
some hashing). Then a user compilation context could associate
application data with GCCJIT objects. This is quite useful: an
application JIT translating some bytecode or AST would keep an
association between GCCJIT objects and application values (think of
s-exprs for GUILE) and create GCCJIT objects only if none is
associated to some application value...
In C, on could dream of a function giving, from some GCCJIT object,
its unique index in the "recording" class.
// get the object of some given index in the context
gcc_jit_object* gcc_jit_get_object_from_index(gcc_jit_context* ctx, unsigned index);
// get the positive index of some object, or 0 if NULL is given
unsigned gcc_jit_object_index(gcc_jit_object*obj);
I would be very happy to have dynamic upcasts, e.g.
// check that an object is a field, otherwise return NULL
gcc_jit_field* gcc_jit_object_to_field(gcc_jit_object* obj);
Comments are welcome. I could supply a patch if explained how to do such things...
Regards.
--
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} ***
next reply other threads:[~2015-10-13 13:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-01 0:00 Basile Starynkevitch [this message]
2015-01-01 0:00 ` 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=20151013133204.GA7100@ovh.starynkevitch.net \
--to=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).