it's tricky, but I found your problem. When using memory operand and
immediate operand, it's needed to specify the memory operand size.
This matches the intel assembler syntax.
Your first mov is compiled correctly, because you use:
c.mov(tmp, ptr(stack));
But the behavior is different across 32-bit and 64-bit mode, because
register size is implicitly defined as sizeof(void*) - This matches
the mode used. You can correct this by using VARIABLE_TYPE_GPD /
VARIABLE_TYPE_GPQ / VARIABLE_TYPE_INTPTR, etc...
But your second mov is
c.mov(ptr(tmp), imm(instr->arg.i));
Translated to intel syntax: mov ptr [someReg], someNumber. No
assembler can't compile this, so you have to provide the type size,
for example try one of these
c.mov(byte_ptr(tmp), imm(instr->arg.i));
c.mov(word_ptr(tmp), imm(instr->arg.i));
c.mov(dword_ptr(tmp), imm(instr->arg.i));
c.mov(qword_ptr(tmp), imm(instr->arg.i));
c.mov(sysint_ptr(tmp), imm(instr->arg.i));
Hope that helps,
but anyway thanks for this report, I will fix some asserts to improve
the message generated by AsmJit.
Best regards
Petr Kobalicek