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)?
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} ***