void test2()
{
JitRuntime runtime;//JIT
CodeHolder code;//代码
//代码与JIT绑定
code.init(runtime.codeInfo());
//代码 与 平台绑定 X86汇编
ASMAssembler myAsm(&code); //X86汇编
//利用CALL 获取返回地址 eax=返回地址
Gp sp = myAsm.zsp();//ESP
Gp _ebx = myAsm.zbx();//EBX
myAsm.mov(eax, x86::ptr(sp));// 等同 myAsm.mov(x86::eax,x86::ptr(x86::esp));
myAsm.mov(_ebx, _ebx);
myAsm.ret();
_Func1 Func1;
runtime.add(&Func1, &code);
int ret = Func1();
printf("ret:0x %x", ret);
runtime.release(Func1);
}
Fucn1:
000F0000 8B 04 24 mov eax,dword ptr [esp]
000F0003 8B DB mov ebx,ebx
000F0005 C3 ret