JIT_FUNCTION jit_compile(Xbyak::CodeGenerator &gen, const char *source) { int ch; gen.mov(gen.eax, 0); while ((ch = *source++) != '\0') { switch (ch) { case '+': gen.inc(gen.eax); break; case '-': gen.dec(gen.eax); break; } } gen.ret(); return (JIT_FUNCTION) gen.getCode(); }
void execute(Xbyak::CodeGenerator &gen) { void (*codes)() = (void (*)()) gen.getCode(); codes(); }