5#define XBYAK_NO_OP_NAMES
13 explicit Code(
int mode,
size_t size,
void *
p)
14 :
Xbyak::CodeGenerator(size,
p)
18 const Xbyak::Reg64&
a = rax;
19 const Xbyak::Reg64& c = rcx;
53 jmp(
ptr [c +
a * (
int)
sizeof(
size_t)]);
87 jmp(
ptr [c +
a * (
int)
sizeof(
size_t)]);
108 for (
int mode = 0; mode < 3; mode++) {
109 printf(
"mode=%d\n", mode);
110 for (
int grow = 0; grow < 2; grow++) {
111 printf(
"auto grow=%s\n", grow ?
"on" :
"off");
113 int (*
f)(int) = c.
getCode<int (*)(int)>();
115 for (
int i = 0; i < 3; i++) {
119 printf(
"ERR i=%d, a=%d, b=%d\n", i,
a, b);
126}
catch (std::exception& e) {
127 printf(
"ERR %s\n", e.what());
const uint8 * getCode() const
void align(size_t x=16, bool useMultiByteNop=true)
void jmp(const Operand &op)
void mov(const Operand ®1, const Operand ®2)
void lea(const Reg ®, const Address &addr)
void L(const std::string &label)
void putL(std::string label)
LOGGING_API void printf(Category category, const char *format,...)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Code(int mode, size_t size, void *p)
Xbyak ; JIT assembler for x86(IA32)/x64 by C++.