Hello, I have released a JIT assembler for x86/x64 for C++ named as
Xbyak.
You can write x86/x64 mnemonics by writing C++ member function.
This library sup****ts Windows(32bit, 64bit), Linux(32bit, 64bit),
Intel Mac.
http://homepage1.nifty.com/herumi/soft/xbyak_e.html
For example
---
#include <stdio.h>
#include "xbyak.h"
struct AddFunc : public Xbyak::CodeGenerator {
AddFunc(int y)
{
mov(eax, ptr[esp+4]);
add(eax, y);
ret();
}
};
int main()
{
AddFunc a(3);
int (*add3)(int) = (int (*)(int))a.getCode();
printf("3 + 2 = %d\n", add3(2));
}
---
In the above sample, add(eax, y) function generates add eax, 3 when
this program is runnning(y = 3).
The other sample is a fast quantization for JPEG(http://
homepage1.nifty.com/herumi/soft/xbyak/quantize.cpp).
This sample generates fast division in runtime.
Please try this if you are interested in Xbyak.
Thank you,
herumi


|