asmjit
RepositoryFreeLow-latency machine code generation
Capabilities13 decomposed
multi-level code generation abstraction with direct instruction emission
Medium confidenceProvides three distinct emitter abstraction levels (BaseAssembler, BaseBuilder, BaseCompiler) that allow developers to choose between low-level direct instruction encoding to a CodeBuffer, intermediate node-based IR with reordering capabilities, or high-level virtual register allocation with automatic spilling. Each level inherits from the previous, enabling progressive complexity and automation while maintaining control over generated machine code at any abstraction tier.
Three-tier emitter hierarchy with inheritance-based composition allows seamless progression from raw instruction encoding (BaseAssembler) through IR-based optimization (BaseBuilder) to automated register management (BaseCompiler), all sharing unified operand and instruction APIs across x86/x64 and AArch64 backends without code duplication.
Offers more granular control than LLVM's IR-only approach while maintaining higher-level abstractions than raw assemblers, enabling latency-sensitive JIT compilers to choose their abstraction level per code path.
architecture-agnostic instruction encoding with backend-specific opcode tables
Medium confidenceImplements unified instruction encoding through architecture-specific backends (X86/X64 and AArch64) that use pre-generated opcode lookup tables and instruction signature matching. The X86 backend uses a table generation system that encodes instruction signatures, operand constraints, and opcode patterns into compact lookup structures; AArch64 uses similar table-driven encoding. A single instruction API call (e.g., `mov(dst, src)`) resolves to the correct machine code encoding based on operand types and target architecture.
Uses pre-generated instruction signature tables that encode operand constraints, size variants, and opcode patterns into compact lookup structures, enabling O(1) instruction resolution without runtime parsing or regex matching; X86 table generation system automatically derives signatures from ISA specifications.
Faster instruction encoding than LLVM's table-driven approach due to simpler operand model; more maintainable than hand-coded switch statements because table generation is automated from ISA specs.
aarch64 instruction database with table-driven encoding
Medium confidenceImplements AArch64 instruction support through a table-driven encoding system similar to x86/x64, with pre-generated instruction signatures and opcode patterns for AArch64 ISA. The AArch64 Instruction Database encodes instruction variants, operand constraints, and encoding rules into lookup tables. At runtime, instruction encoding resolves operand types to the correct AArch64 opcode and encoding format through signature matching.
Provides AArch64 instruction encoding through table-driven lookup matching x86/x64 architecture, enabling unified cross-architecture code generation APIs while maintaining architecture-specific instruction databases.
Enables ARM64 code generation with the same API as x86-64, simplifying cross-platform JIT compiler development; more complete than minimal ARM64 assemblers due to comprehensive instruction coverage.
cross-platform virtual memory abstraction with platform-specific backends
Medium confidenceAbstracts platform-specific virtual memory operations (mmap/mprotect on POSIX, VirtualAlloc/VirtualProtect on Windows) through a unified VirtMem interface. The abstraction handles page allocation, protection transitions, and memory deallocation across operating systems. Platform-specific implementations are selected at compile time based on detected OS, enabling single-source code to work on Linux, Windows, macOS, and other platforms.
Provides unified VirtMem interface that abstracts POSIX mmap/mprotect and Windows VirtualAlloc/VirtualProtect with compile-time platform selection, enabling W^X enforcement without platform-specific code in user code.
More portable than OS-specific memory APIs while maintaining lower overhead than full abstraction layers; handles W^X enforcement transparently across platforms.
cmake-based modular build system with feature flags
Medium confidenceImplements a CMake-based build system that enables fine-grained control over compiled features through feature flags (ASMJIT_BUILD_X86, ASMJIT_BUILD_ARM, etc.). Developers can selectively enable/disable architecture backends, instruction databases, and optional features at build time, reducing binary size and compilation time. The build system automatically detects platform capabilities and generates appropriate compiler flags.
Uses CMake feature flags to enable selective compilation of architecture backends and optional features, allowing developers to build minimal asmjit instances for embedded systems or specific use cases without modifying source code.
More flexible than monolithic builds while maintaining simpler configuration than autotools; enables binary size optimization for embedded systems.
automatic register allocation with virtual register abstraction
Medium confidenceThe BaseCompiler emitter provides virtual register allocation by allowing developers to request unlimited virtual registers (VReg) that are automatically mapped to physical registers and spilled to stack as needed. The allocator tracks register liveness, performs greedy allocation, and inserts spill/reload instructions transparently. This abstraction hides the complexity of manual register management while maintaining control over register-level optimizations through explicit virtual register declarations.
Provides virtual register abstraction at the emitter level (not IR level), allowing direct instruction emission with automatic physical register mapping and transparent spilling, eliminating the need for separate IR-to-assembly lowering passes while maintaining single-pass code generation.
Simpler API than LLVM's register allocator (no need to understand interference graphs) while still supporting complex register pressure scenarios; faster compilation than graph-coloring allocators due to greedy strategy.
executable memory management with w^x security enforcement
Medium confidenceManages allocation and lifecycle of executable memory through JitRuntime and JitAllocator, enforcing Write-XOR-Execute (W^X) security semantics where memory is either writable or executable, never both simultaneously. The VirtMem layer abstracts platform-specific virtual memory APIs (mmap on POSIX, VirtualAlloc on Windows) and handles page protection transitions. Code is written to writable memory, then protected as executable before execution, preventing code injection attacks.
Implements W^X enforcement at the allocator level with platform abstraction (VirtMem) that unifies POSIX mmap/mprotect and Windows VirtualAlloc/VirtualProtect, ensuring security guarantees across operating systems without exposing platform-specific APIs to users.
Provides stronger security guarantees than manual mprotect calls (prevents TOCTOU attacks) while maintaining lower overhead than full sandboxing; more portable than OS-specific memory APIs.
node-based intermediate representation with instruction reordering and optimization
Medium confidenceBaseBuilder emits instructions as nodes in a linked list (Node system) rather than directly to a buffer, enabling instruction reordering, dead code elimination, and optimization passes before final encoding. Each instruction becomes a Node with metadata about operands, dependencies, and side effects. Nodes can be inserted, removed, or reordered before the builder finalizes code, converting the node graph to machine code through the emitter hierarchy.
Uses a linked-list node representation that preserves instruction order while enabling arbitrary reordering and optimization before finalization, avoiding the complexity of full IR graphs (like LLVM) while maintaining single-pass code generation semantics.
Lighter-weight than LLVM's SSA IR (lower memory overhead, faster compilation) while still enabling instruction reordering; more flexible than BaseAssembler's direct emission for optimization-focused use cases.
unified operand system with type-safe register and memory references
Medium confidenceProvides a unified operand abstraction (Operand class hierarchy) that represents registers, immediates, labels, and memory references with type safety and architecture awareness. Operands encode register class (GP, XMM, etc.), size, and constraints into a compact representation. Memory operands support complex addressing modes (base + index*scale + displacement) with automatic validation. The operand system enables generic instruction APIs that work across different operand combinations without overloading.
Encodes operand information (register class, size, addressing mode) into a compact representation with type-safe C++ API, enabling generic instruction methods that accept multiple operand types without overloading while maintaining architecture-specific validation.
More type-safe than string-based operand specifications (like inline assembly) while maintaining simpler API than LLVM's operand hierarchy; compact representation enables efficient operand storage in node metadata.
function prologue/epilogue generation with calling convention support
Medium confidenceProvides automatic generation of function prologue and epilogue code based on declared calling conventions (x86-64 System V, x86-64 Windows, AArch64 AAPCS). Developers declare function arguments, return values, and clobbered registers; the compiler automatically generates stack frame setup, register saves, and cleanup. This abstraction handles platform-specific calling convention details (argument passing, return value location, stack alignment) transparently.
Abstracts calling convention details into FuncSignature declarations that automatically generate platform-specific prologue/epilogue code, eliminating manual stack frame management while maintaining compatibility with native calling conventions across x86-64 and AArch64.
Simpler than manual prologue/epilogue writing while more flexible than fixed-format function templates; automatically handles platform differences without conditional code.
label-based code relocation and forward reference resolution
Medium confidenceImplements a label system that enables forward references and code relocation through a two-pass approach: labels are declared during code emission, then resolved during finalization. The CodeHolder maintains a relocation table mapping label references to code offsets. Relocations support multiple types (absolute, relative, section-relative) and are resolved when code is finalized and moved to executable memory, enabling jumps and calls to unresolved targets.
Uses a deferred relocation model where labels are collected during emission and resolved during finalization, enabling forward references without requiring multiple passes while maintaining compact relocation records.
Simpler than LLVM's relocation model (fewer relocation types) while supporting the common cases; more efficient than runtime relocation patching due to batch resolution at finalization.
section-based code organization with metadata storage
Medium confidenceOrganizes generated code into sections (code, data, read-only data) within a CodeHolder, enabling separation of concerns and metadata storage. Each section has its own buffer, relocation table, and label namespace. This abstraction allows code generators to emit code and data independently, then combine them during finalization. Sections support different protection levels (executable, writable, read-only) and can be linked together.
Provides section abstraction at the CodeHolder level, enabling logical separation of code and data with independent buffers and relocation tables, while maintaining unified finalization and memory allocation.
Simpler than ELF/Mach-O section models (fewer section types) while supporting the common cases; more flexible than flat code buffers for organizing complex generated code.
x86/x64 instruction database with signature-based encoding
Medium confidenceImplements a comprehensive x86/x64 instruction database (~1500+ instructions) using a table generation system that derives instruction signatures, operand constraints, and opcode patterns from ISA specifications. The X86 Instruction Database encodes each instruction's valid operand combinations, size variants, and encoding rules into lookup tables. At runtime, instruction encoding resolves operand types to the correct opcode and encoding format through signature matching.
Uses automated table generation from ISA specifications to derive instruction signatures and opcode patterns, enabling O(1) instruction resolution without hand-coded switch statements; encodes operand constraints into compact lookup structures.
More maintainable than hand-coded instruction encoders due to automated table generation; faster than regex-based instruction matching due to pre-computed lookup tables.
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with asmjit, ranked by overlap. Discovered automatically through the match graph.
llvm
Project moved to: https://github.com/llvm/llvm-project
DeepSeek Coder V2
DeepSeek's 236B MoE model specialized for code.
CodeT5
Home of CodeT5: Open Code LLMs for Code Understanding and Generation
Qwen: Qwen3 Coder 30B A3B Instruct
Qwen3-Coder-30B-A3B-Instruct is a 30.5B parameter Mixture-of-Experts (MoE) model with 128 experts (8 active per forward pass), designed for advanced code generation, repository-scale understanding, and agentic tool use. Built on the...
Codestral
Mistral's dedicated 22B code generation model.
EssentialAI: Rnj 1 Instruct
Rnj-1 is an 8B-parameter, dense, open-weight model family developed by Essential AI and trained from scratch with a focus on programming, math, and scientific reasoning. The model demonstrates strong performance...
Best For
- ✓JIT compiler developers building scripting engines
- ✓performance optimization framework authors
- ✓dynamic instrumentation tool builders requiring sub-microsecond code generation latency
- ✓cross-platform JIT compiler developers
- ✓portable dynamic code generation frameworks
- ✓ISA researchers building multi-target code generators
- ✓ARM64 JIT compiler developers
- ✓cross-platform dynamic code generators targeting ARM64
Known Limitations
- ⚠BaseAssembler provides no instruction reordering or optimization — instructions emit in order
- ⚠BaseBuilder's node-based IR adds memory overhead for intermediate representation storage
- ⚠BaseCompiler's register allocation uses greedy algorithms, not graph-coloring, limiting optimization for highly register-constrained scenarios
- ⚠Cross-architecture code generation requires separate emitter instances per target ISA
- ⚠Instruction database is static and pre-generated at build time — runtime instruction definition is not supported
- ⚠X86 instruction encoding handles ~1500+ instructions but excludes some esoteric or vendor-specific extensions
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
Repository Details
Last commit: Mar 26, 2026
About
Low-latency machine code generation
Categories
Alternatives to asmjit
Are you the builder of asmjit?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →