[Gambas-user] New Jit system merged on master

Benoît Minisini g4mba5 at gmail.com
Wed Jun 13 01:38:16 CEST 2018


Hi,

I have just merged the 'jit-with-c' branch to 'master'.

The JIT compiler is not finished, but is advanced enough to run all the 
fast methods of the IDE, the gb.form.editor and the gb.form.terminal 
components. The benchmarks run too.

Many features are still not implemented:

- Functions with variable number of arguments.
- Structures.
- Static arrays.
- ON GOTO and ON GOSUB.
- Error management.
- BYREF.
- Extern functions.
- WITH ... END WITH.

And many implemented features are not tested.

And many optimizations could be done too, especially in properties and 
methods calls, that are mostly run by the interpreter at the moment.

The performance gain is about the same as the old JIT compiler. Often a 
bit slower, sometimes unexpectedly faster. The biggest gains are when 
dealing with loops, integers and native arrays. On the other side, you 
won't gain anything with string routines, the 'string' benchmark even 
being a bit slower!

Note that the JIT compiler is not a compiler, but a Gambas to C 
translator, about 3,000 lines of code, whose result is preprocessed, 
compiled and linked by the gcc compiler at runtime.

To disable the JIT compiler, set the environment variable GB_NO_JIT to 
1. To have some debugging messages, set GB_JIT_DEBUG to 1.

Otherwise, I fixed the thousand separator management in the Format() 
function, and optimized the string search routine used by InStr(), 
RInstr() and Replace(). The "string" benchmark now runs 4 times faster.

Apart from the previous limitations, you can start to play with it, to 
help me test the following:

- Does it work with 32 bits x86?
- Does it work with ARM?
- Does it work with clang?
- ...

Enjoy it!

-- 
Benoît Minisini


More information about the User mailing list