-
Global
asmjit_cast<>
removed and introduced a more type-safeasmjit::ptr_cast<>
, which can cast a function tovoid*
(and vice-versa), but will refuse to cast a function tovoid**
, for example. Just changeasmjit_cast
toasmjit::ptr_cast
and everything should work as usual. As a consequence, the Runtime now contains a typesafe (templated)add()
andremove()
methods that accept a function type directly, no need to cast manually tovoid*
andvoid**
. If you use your own runtime rename your virtual methods fromadd
to_add
and fromrelease
to_release
and enjoy the type-safe wrappers. -
Removed
Logger::Style
anduint32_t style
parameter in Logging API. It was never used for anything so it was removed. -
There is a new
CodeEmitter
base class that defines assembler building blocks that are implemented byAssembler
andCodeBuilder
.CodeCompiler
is now based onCodeBuilder
and shares its instruction storage functionality. Most API haven't changed, just base classes and new functionality has been added. It's now possible to serialize code for further processing by usingCodeBuilder
. -
Renamed compile-time macro
ASMJIT_DISABLE_LOGGER
toASMJIT_DISABLE_LOGGING
. There is a newFormatter
class which is also disabled with this option. -
Operand API is mostly intact, omitting Var/Reg should fix most compile-time errors. There is now no difference between a register index and register id internally. If you ever used
reg.getRegIndex()
then usereg.getId()
instead. Also renamedisInitialized()
toisValid()
.- There are much more changes, but they are mostly internal and keeping most operand methods compatible.
- Added new functionality into
asmjit::x86
namespace related to operands. - X86Xmm/X86Ymm/X86Zmm register operands now inherit from X86Vec.
- Register kind (was register class) is now part of
Reg
operand, you can get it by usingreg.getRegKind()
. - Register class enum moved to
X86Reg
,kX86RegClassGp
is nowX86Reg::kKindGp
. - Register type enum moved to
X86Reg
,kX86RegTypeXmm
is nowX86Reg::kRegXmm
. - Register index enum moved to
X86Gp
,kX86RegIndexAx
is nowX86Gp::kIdAx
. - Segment index enum moved to
X86Seg
,kX86SegFs
is nowX86Seg::kIdFs
. - If you used
asmjit::noOperand
for any reason, change it toOperand()
.
-
CodeBuilder and CodeCompiler now contain different prefix of their nodes to distinguish between them:
- Rename
HLNode
toCBNode
(CodeBuilder node). - Rename all other
HL
toCB
. - Rename
X86FuncNode
toCCFunc
(CodeCompiler function), no more arch specific prefixes here. - Rename
X86CallNode
toCCFuncCall
(CodeCompiler function-call), also, no more X86 prefix.
- Rename
-
AsmJit now uses CodeHolder to hold code. You don't need
Runtime
anymore if you don't plan to execute the code or if you plan to relocate it yourself:
CodeHolder code; // Create CodeHolder (holds the code).
code.init(CodeInfo(ArchInfo::kIdX64)); // Initialize CodeHolder to hold X64 code.
// Everything else as usual:
X86Assembler a(&code); // Create the emitter (Assembler, CodeBuilder, CodeCompiler).
- Initializing with JitRuntime involves using CodeHolder:
JitRuntime rt; // Create JitRuntime.
CodeHolder code; // Create CodeHolder.
code.init(rt.getCodeInfo()); // Initialize CodeHolder to match the JitRuntime.
X86Assembler a(&code); // Create the emitter (Assembler, CodeBuilder, CodeCompiler).
... // Generate some code.
typedef void (*SomeFunc)(void); // Prototype of the function you generated.
SomeFunc func; // Function pointer.
Error err = rt.add(&func, &code); // Add the generated function to the runtime.
rt.remove(func); // Remove the generated function from the runtime.
- Merged virtual registers (known as variables or Vars) into registers themselves, making the interface simpler:
X86GpReg/X86GpVar merged to X86Gp
X86MmReg/X86MmVar merged to X86Mm
X86XmmReg/X86XmmVar merged to X86Xmm
X86YmmReg/X86YmmVar merged to X86Ymm
- Refactored instruction database, moved many enums related to instructions into
X86Inst
. Also some instructions were wrong (having wrong signature in Assembler and Compiler) and were fixed.
X86InstInfo renamed to X86Inst
kX86InstIdSomething renamed to X86Inst::kIdSomething
kX86InstOptionSomething renamed to X86Inst::kOptionSomething
kX86CondSomething renamed to X86Inst::kCondSomething
kX86CmpSomething renamed to X86Inst::kCmpSomething
kX86VCmpSomething renamed to X86Inst::kVCmpSomething
kX86PrefetchSomething renamed to X86Inst::kPrefetchSomething