Core types for dynasm Nim port. Mirrors runtime/src/lib.rs AssemblyOffset, DynamicLabel, errors.
Types
ArchKind = enum akX64, akX86, akAarch64
AssemblyOffset = distinct int
- Offset into assembling buffer in bytes.
DynamicLabel = distinct int
- ID for a dynamic label.
DynasmError = object of CatchableError kind*: DynasmErrorKind labelName*: string labelKind*: LabelKindDesc dynId*: int
DynasmErrorKind = enum dekCheckFailed, dekDuplicateLabel, dekUnknownLabel, dekImpossibleRelocation
LabelKindDesc = enum lkLocal, lkGlobal, lkDynamic
Procs
proc `$`(d: DynamicLabel): string {....raises: [], tags: [], forbids: [].}
proc `$`(o: AssemblyOffset): string {....raises: [], tags: [], forbids: [].}
proc `==`(a, b: AssemblyOffset): bool {.borrow, ...raises: [], tags: [], forbids: [].}
proc `==`(a, b: DynamicLabel): bool {.borrow, ...raises: [], tags: [], forbids: [].}
proc checkFailed(): ref DynasmError {....raises: [], tags: [], forbids: [].}
proc duplicateLabel(name: string; k: LabelKindDesc; dynId = -1): ref DynasmError {. ...raises: [], tags: [], forbids: [].}
proc impossibleRelocation(msg: string): ref DynasmError {....raises: [], tags: [], forbids: [].}
proc unknownLabel(name: string; k: LabelKindDesc; dynId = -1): ref DynasmError {. ...raises: [], tags: [], forbids: [].}