Chasm is an easy-to-use, high-performance runtime assembler that assembles up to 100 million instructions per second. Ideal for JIT compilers, emulators, and runtime optimizations, it supports AVX-256 and various x86 extensions with minimal function calls, simplifying dynamic code generation.
The Chasm Runtime Assembler, or Chasm, is a high-performance assembler designed for ease of use and efficiency, allowing dynamic generation of machine code across various platforms. Leveraging a simple API, Chasm brings advanced features such as AVX-256 support, making it ideal for applications requiring runtime code generation.
x64stringify simplify debugging and inspection of intermediate representation (IR).0 to indicate failure and quick access to error details with x64error(NULL).Chasm excels in scenarios where code is dynamically generated or executed at runtime, including:
Optimized to handle assembly tasks efficiently, Chasm precomputes as much as it can, often assembling instructions within 15 to 30 nanoseconds, varying with optimization levels.
Chasm uses an array of x64Ins structs to define code:
x64 code = { MOV, rax, imm(0) };
Here, rax is an example of x86 registers, predefined as macros, making code definition straightforward.
Leverage powerful macros like mem(), m<size>(), or rel() to define complex memory address computations:
x64 code = { LEA, rax, mem($rax, 0x0ffe, $rdx, 2, $ds) };
x64as(): Assembles and links code, supporting rel() and mem($riprel) syntax.x64emit(): Assembles a single instruction quickly without linking.x64exec(): Allocates executable memory for the assembled code and provides a callable function pointer.x64exec_free(): Frees memory allocated by x64exec().x64stringify(): Converts IR sequences to string format for easier debugging.Currently, Chasm does not support some instruction sets and platforms:
Chasm remains an adaptable tool with plans for expanded instruction set support in future updates.
No comments yet.
Sign in to be the first to comment.