froofyJIT 0.21 review

Download
by rbytes.net on

froofyJIT is a C++ 'syntactic sugar' front-end for Paolo Bonzini's GNU lightning library for dynamic native code generation

License: LGPL (GNU Lesser General Public License)
File size: 30K
Developer: froofyJIT Team
0 stars award from rbytes.net

froofyJIT is a C++ 'syntactic sugar' front-end for Paolo Bonzini's GNU lightning library for dynamic native code generation. froofyJIT program uses C++'s powerful language facilities to allow GNU lightning instructions to be expressed in a more concise way that approximates a 'real' assembly language.

Below is a program which uses froofyJIT to compute a Fibonacci number (directly translated from tests/fib.c in GNU lightning):

#include < cstdlib >
#include < iostream >
#include "froofy/jit.h"

static jit_insn codeBuffer[1024];

typedef int (*pifi)(int);

int main()
{
pifi nfibs;
int in;
{
using namespace froofy::jit;
label< > basis;

nfibs/ !org, codeBuffer;
prolog, 1;
!arg< ui > in;
getarg< ui > v0, in;
blti< ui > basis, v0, 2;
subi< ui > v1, v0, 1;
subi< ui > v2, v0, 2;
prepare< i > 1;
pusharg< ui > v1;
finish, nfibs;
retval< i > v1;
prepare< i > 1;
pusharg< ui > v2;
finish, nfibs;
retval< i > v2;
addi< ui > v1, v1, 1;
addr< ui > rr, v1, v2;
ret --;
basis/ movi< i > rr, 1;
ret --;
!end, codeBuffer;
}
std::cout

froofyJIT 0.21 keywords