[Vm-dev] GNUification, Clang
piumarta at speakeasy.net
Sun Sep 15 11:30:34 UTC 2013
Gnuification does two things:
1. explicitly assigns registers to the most-often used local variables within the interpret() loop so that the compiler keeps them in registers all the time, and
2. removes the overhead of the interpret() loop by inserting at the end of every bytecode's implementation an explicit fetch of the next bytecode and a jump to its implementation.
Both of these rely on GNU extensions to C in order to work (hence the name). The transformations are source-to-source by recognising the standard C declarations and control constructs present in the generated interp.c file's interpret() procedure and replacing them with GNU-optimised ones. It is applied after generation of the source files, by an awk script, and so after VMMaker has already finished its work. For Unix, the commands to do this can be found in unix/vm/build.cmake and the awk script is in unix/cmake/gnuify.awk.
The optimal assignment of registers to variables was determined empirically and might be usefully revisited given the number of years that has passed since the original experiments were performed and the changes that have occurred both in GCC's back end and in processor architecture.
AFAIK, clang/LLVM accepts the same language as GCC so it is not clear that there is anything more it can do for us. If anyone knows of something new in clang of potential benefit then I'd be happy to try to extend or modify the gnuification step to take advantage of it.
On Sep 15, 2013, at 00:24 , Casey Ransberger wrote:
> I'd like to understand what goes on with the GNUify step. Where in VMMaker should I look to start understanding that part? Is there documentation somewhere I should look at to educate myself about it?
> I remember that at one point there was some discussion of performance issues after building the system with Clang. I'm curious about that. Still a thing, or just stuff the LLVM crowd hadn't gotten round to optimizing at the time? Would "Clangification" help? Hence, wanting to know what GNUification does.
> Again, sorry about the noise. Googling "gnuify squeak vm" seems to give me commit messages, which isn't really what I'm after.
More information about the Vm-dev