The patch also involves different memory management optimizations such as allocating as mush as possible on the stack and avoiding unnecessary memcpy'es, but the first thing that I have rewritten was "variable_buffer". Instead of using a single global pointer and swapping it when necessary, a special "struct vbuffer" object was introduced, which is passed in every 'func_xxx' function and other variable expansion routines. Practically, it is possible to create a local buffer, and perform an expansion into it, without interfering with any global structure. So, I think, such interface could be a part of gmake-/emake-independent API for plugins.
Now the patch is mostly done, but I didn't send it because some parts of code are still poorly documented. I planned to complete in a few weeks, but I have no time right now, so you could take a look at draft version here:
http://pastebin.com/UGs6aawV
I would appreciate any comments.
--
Best regards,
Eldar Sh. Abusalimov