예제 #1
0
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();
}
예제 #2
0
파일: bf-jit.cpp 프로젝트: myoan/trainJack
void execute(Xbyak::CodeGenerator &gen) {
    void (*codes)() = (void (*)()) gen.getCode();
    codes();
}