[PATCH 2/2] jit: add switch statements
David Malcolm
dmalcolm@redhat.com
Thu Jan 1 00:00:00 GMT 2015
On Thu, 2015-06-25 at 21:47 +0200, Basile Starynkevitch wrote:
> On 06/25/2015 09:13 PM, David Malcolm wrote:
> > Some interpreters/VMs support a switch statement (for example the JVM
> > has opcodes "lookupswitch" and "tableswitch"). GCC has a set of
> > optimizations for efficiently handling switch statements, so it makes
> > sense to directly expose switch statements in the libgccjit API.
>
> Yes, I hope that feature will be incorporated quickly in gccjit. I don't
> have the power to approve that patch, but I hope it will be approved.
> > This patch implements a switch statement, but it isn't quite ready for
> > committing to trunk yet:
> >
> > * It relies on gcc/typed-splay-tree.h in the previous patch
> >
> > * It extends the libgccjit API. It's not clear to me yet how to
> > manage extensions of the libgccjit API: should I use symbol maps
> > and versioning, or bump the SONAME? I'm thinking of providing
> > precanned feature macros within libgccjit.h e.g:
> >
> > #define LIBGCCJIT_HAVE_SWITCH_STATEMENT
> >
> > for the benefit of client code that doesn't use configure
> > scripts.
>
>
> Perhaps just exposing the major and minor version of the GCC supporting
> that GCCJIT is enough (like it was done for plugins, e.g.
> GCCPLUGIN_VERSION etc)?
That approach rapidly gets messy if we backport anything; doing it by
feature seems saner.
More information about the Jit
mailing list