dynasm
A plugin for assembling code at runtime. Combined with the runtime crate dynasmrt it can be used to write JIT compilers easily.
5.1.0
8.2M downloads/mo
#3477 most downloaded on crates.io
CensoredUsername/dynasm-rs
What this package is like to depend on
Last release 1 months ago
22 Jul 2026
Release timing varies
gaps range from 3 weeks to 1.7 years
Most releases are documented
notes for 31 of 43 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
43 releases · first in 2016
5 releases in the last 12 months
see the full history below
Release timeline
43 releases · Aug 2016 to Jul 2026Releases
latest 43-
5.1.022 Jul 2026 -
5.0.012 Feb 2026Release notes
Open source →Plugin
- Moves error generation from the unmaintaned
proc-macro-error2to the maintainedproc-macro-error3
- Moves error generation from the unmaintaned
-
4.0.212 Dec 2025Release notes
Open source →Bugfix
Fixes an issue for the x64
outinstruction, where the formatout imm8, axaccidentally didn't get a 16-bit operand size override prefix. -
4.0.112 Sep 2025Release notes
Open source →Bugfix
This bugfix release fixes a failure to compile the
dynasmrtcrate on non-unix RISC-V. -
4.0.010 Sep 2025Release notes
Open source →Summary
This release adds ergonomics improvements to dynamic registers. Where it was previously required to explicitly convert the type for dynamic registers as follows:
let dyn_reg = dynasmrt::x64::Rq::RAX; dynasm!(ops ; add Rq(dyn_reg.into()), 5 );This is no longer necessary. Instead, the conversion is now performed implicitly via
Into<u8>.let dyn_reg = dynasmrt::x64::Rq::RAX; dynasm!(ops ; add Rq(dyn_reg), 5 );General
- dependencies have been updated
Plugin
- Dynamic registers now accept any value that is convertible via
Into<u8>. This significantly improves the ergonomics of using dynamic register values with custom wrapper types. Unfortunately, this might break code which already does this conversion explicitly, leading to an unknown type error. To remedy this, simply remove the explicit conversion.
Runtime
- Assembler has gained a
new_with_capacitymethod.
-
3.2.120 Jun 2025Release notes
Open source →Runtime
- Cache invalidation on aarch64 Apple hardware now does not crash with an illegal instruction exception.
-
3.2.013 Mar 2025Release notes
Open source →Architecture support
- RISC-V targets got support for the
Zfinx,Zhinx,Zdinx,ZhinxminandZfhmininstruction set extensions. - RISC-V targets now automatically expand the
Bcollection of ISA EXTENSIONS - RISC-V targets now ignore the
Ztsoextension instead of it causing an error (as it doesn't actually add any new instructions).
- RISC-V targets got support for the
-
3.1.013 Mar 2025Release notes
Open source →Summary
This release adds support for several architectures from the RISC-V family of instruction sets. These are
riscv64i,riscv64e,riscv32iandriscv32e. There's also support for a large set of instruction set extensions. This architecture support is introduced with the same standards as currently supported targets, meaning that they come with full runtime support, immediate checking and cache management support out of the box.This architecture support has been sponsored by Wasmer.
General
- dependencies have been updated
- handled many clippy warnings (Thanks to waywardmonkeys!)
Architecture support
- added
riscv32i,riscv32e,riscv64iandriscv64earchitecture targets. x64gained support for theRDPRUinstruction (Thanks to eigenform!).
-
3.0.129 Oct 2024Release notes
Open source →Bugfix
x64immediate const evaluation now handles negative displacements properly again, generating 8-bit displacements where possible.
-
3.0.009 Oct 2024Release notes
Open source →Summary
This release brings significant improvements to the
aarch64experience. The runtime assemblers now handle cache invalidation internally where necessary. Furthermore, where previously overly large immediates would just wrap during encoding, they are now fully checked and error at compile time, or panic at runtime. One major backwards compatibility break is that the syntax for data directives has changed. This syntax now uses the relevant rust type names, and supports significantly more types. Next to this, several long-standing bugs have been fixed, dependencies have been updated, and the crate has moved to rust edition 2021. The minimum supported rust version is now1.77.General
- Moved to rust edition 2021
- Dependencies have been updated.
- minimum supported rust version increased to
1.77to allow for the use ofmem::offset_of!. - data directives now use
.u8,.i16,.f32syntax. - Several documentation improvements have been made.
- More tests have been introduced.
Architecture support
x64gained support for theMOVDIRIinstructionx64gained support for theZWORDoperand size (needed for AVX512 support in the future)- the
aarch64assemblers now handle cache control internally. It is no longer needed for the user to handle this. - Immediates in
aarch64assembly are now fully size checked, where possible at compile time. Attempting to assemble an impossible immediate at runtime will cause a panic.
Bugfixes
- All documentation/example crates now compile on stable rustc.
- Worked around a rustc compiler bug that was causing operator precedence issues in emitted code.
- Fixed x64/x86 register names used in compiler error debug messages.
- Renamed several documentation bin targets due to artefact name collision errors in the workspace.
- Fix unneeded parenthesis warnings in emitted code.
- Eliminated warnings during plugin build.
- the aarch64 instruction
mov w0, immu32now expects au32as immediate instead of anu64.
Several of these changes were the result of external contributions, we'd like to thank everyone who contributed to this release.
-
2.0.031 Jan 2023Release notes
Open source →Plugin
- Be stricter on X/W or XSP/WSP differentiation in x64.
Runtime
- Significant performance optimization of label processing.
- Rework of various components.
- Additional APIs to reuse Assemblers, or to allocate them with pre-reserved buffers.
Documentation
- Various fixes
-
1.2.331 Mar 2022Release notes
Open source →Plugin
- add x64 ud1 opcode.
- Bugfix the REPNE prefix so it can actually be used.
-
1.2.231 Mar 2022 -
1.2.119 Dec 2021 -
1.2.019 Nov 2021 -
1.1.007 May 2021 -
1.0.112 Jan 2021 -
1.0.020 Jul 2020Release notes
Open source →Global
- First release on rust stable (1.45+)!
Plugin
- Use new Span::mixed_site hygiene to replace call_site hygiene wherever relevant.
-
0.7.101 Jul 2020Release notes
Open source →Runtime
- Fixed an issue where calls to Modifier.extend would cause invalid code to be emitted.
-
0.7.030 Jun 2020Release notes
Open source →Global
- Updated everything to the 2018 edition of rust.
- The crate will be able to be used on a rust 1.45 stable compiler!
Plugin
- File-local directives now requires the
filelocalfeature and a nightly compiler. - Now compiles and is usable on a stable 1.45 rust compiler.
- Added
dynasm_backwards!, which emits templates in reverse order. This allows writing assemblers that compile code backwards.
Runtime
dynasmrtnow re-exports thedynasm!macro fromdynasm, so projects only need thedynasmrtdependency.- Refactoring PatchLoc and Relocation to generalize relocation handling between architectures.
- Added register family listings, to facilitate dynamic register usage. This feature was contributed by vext01.
-
0.6.024 Feb 2020Release notes
Open source →Runtime
- Significant internal refactoring: Architectural support is now abstracted through the Relocation trait, that all assemblers are generic over. Aliases for the previous architecture-specific assemblers are kept for backwards compatibility.
- Made assembler components public to facilitate writing custom assemblers.
Tests
- Reduced compile time significantly by migrating simple instruction format tests to
SimpleAssembler.
-
0.5.222 Nov 2019Release notes
Open source →Plugin
- Remove a problematic semicolon that might cause errors in the future.
- README update.
-
0.5.115 Sep 2019Release notes
Open source →Runtime
- Fix a bug that caused emitted code corruption corruption in Aarch64's B and ADRP relocation calculations.
-
0.5.004 Sep 2019Release notes
Open source →Plugin
- We now support an arbitrary offset added to any jump. This feature allows direct addressing of literal pools or arrays of values without generating labels for every single item in them.
Runtime
- Added LitPool, a tool to automatically build literal pools.
- Impossible relocations no longer panic. Instead they cause an error to be emitted from
Assembler::commit(). - Significant refactoring.
-
0.4.026 Aug 2019Release notes
Open source →Architecture support
- Added Aarch64 support, thanks to sponsoring from Wasmer.
Plugin
- Remove use of mem::unitialized when calculating the offsets of members in structs in generated code. -Optimization of opmap and register tables to reduce compile time and file size.
Documentation
- Split architecture-specific DSL documentation and generic DSL documentation.
- Ported examples to Aarch64.
-
0.3.211 Apr 2019Release notes
Open source →Plugin
- x64/x86: Always escape into SIB encoding with a displacement when a register is used as a memory reference base, to allow RBP to be encoded.
- x64/x86: Properly handle dynamic registers in VEX prefixes
-
0.3.105 Mar 2019Release notes
Open source →Plugin
- Fixed an issue where dynamic registers caused wrong code generation.
Runtime
- Added an API for returning the offset of a dynamic label directly.
-
0.3.025 Dec 2018Release notes
Open source →Architecture support
- Fixed SETB and SETNB not being present in x64/x86
Plugin
- The plugin has been updated to the new procedural macro system. This means it should no longer break when new compiler versions are released.
- Directives are now scoped file-local instead of crate-local.
Runtime
- The alter API can now return values produced by the user-defined closure.
Versions 0.2.1, 0.2.2 and 0.2.3
Plugin
- Updates so it stays compatible with rustc as the plugin API changes.
-
0.2.311 Oct 2018Nothing published for this version
-
0.2.216 Aug 2018Nothing published for this version
-
0.2.121 May 2018Nothing published for this version
-
0.2.024 Apr 2018Release notes
Open source →Architecture support
- Added support for x86
- Enabled relocation support in x64 when additional immediate fields are present.
Plugin
- Significant refactoring of the x64 backend to also handle x86
- Added x64 feature selection support.
Runtime
- Added managed relocation support to handle non-relative relocations.
-
0.1.429 Mar 2018Release notes
Open source →Plugin
- Updates so it stays compatible with rustc as the plugin API changes.
-
0.1.317 Oct 2017Nothing published for this version
-
0.1.221 Aug 2017Nothing published for this version
-
0.1.122 Apr 2017Nothing published for this version
-
0.1.022 Feb 2017Release notes
Open source →Global
- Initial library experiments, starting with basic x64 support, refactoring to support multiple architectures, and cleanup.
-
0.0.627 Oct 2016Nothing published for this version
-
0.0.516 Oct 2016Nothing published for this version
-
0.0.425 Sep 2016Nothing published for this version
-
0.0.325 Sep 2016Nothing published for this version
-
0.0.201 Sep 2016Nothing published for this version
-
0.0.129 Aug 2016Nothing published for this version