Skip to content
Merged
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"aarchmrs-parser",
"aarchmrs-types",
"harm",
"harm-runtime",
"harm-types",
"tools/aarchmrs-generate",
"tools/harm-asm-regen",
Expand Down
15 changes: 15 additions & 0 deletions harm-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "harm-runtime"
version = "0.1.0"
edition = "2024"
description = "AArch64 (ARM64) dynamic assembler runtime"
license = "BSD-3-Clause"
authors = ["Ivan Boldyrev <lispnik@gmail.com>"]
repository = "https://github.com/monoid/harm/"
keywords = ["arm", "aarch64", "aarchmrs", "assembler", "jit"]
categories = ["compilers", "hardware-support"]
publish = false

[dependencies]
harm = { workspace = true }
memmap2 = "0.9.9"
13 changes: 13 additions & 0 deletions harm-runtime/src/labels.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Copyright (C) 2025 Ivan Boldyrev
*
* This document is licensed under the BSD 3-clause license.
*/

use harm::reloc::Offset;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LabelInfo {
Forward,
// TODO segment
Offset(Offset),
}
6 changes: 6 additions & 0 deletions harm-runtime/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Copyright (C) 2025 Ivan Boldyrev
*
* This document is licensed under the BSD 3-clause license.
*/

pub mod labels;
10 changes: 5 additions & 5 deletions harm/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use aarchmrs_types::InstructionCode;

use crate::reloc::Reloc;
use crate::reloc::Rel64;

pub mod arith;
pub mod control;
Expand All @@ -20,14 +20,14 @@ pub trait RawInstruction {
}

pub trait RelocatableInstruction {
fn to_code_with_reloc(&self) -> (InstructionCode, Option<Reloc>);
fn to_code_with_reloc(&self) -> (InstructionCode, Option<Rel64>);
}

impl<I> RelocatableInstruction for I
where
I: RawInstruction,
{
fn to_code_with_reloc(&self) -> (InstructionCode, Option<Reloc>) {
fn to_code_with_reloc(&self) -> (InstructionCode, Option<Rel64>) {
(self.to_code(), None)
}
}
Expand All @@ -42,7 +42,7 @@ where
// When the bug is fixed, it can be changed to &self.
// // OTOH, currently all implementations are `Copy`.
pub trait InstructionSeq: Sized {
fn encode(self) -> impl Iterator<Item = (InstructionCode, Option<Reloc>)> + 'static;
fn encode(self) -> impl Iterator<Item = (InstructionCode, Option<Rel64>)> + 'static;

#[inline]
fn instructions(self) -> impl Iterator<Item = InstructionCode> + 'static {
Expand All @@ -60,7 +60,7 @@ impl<I> InstructionSeq for I
where
I: RelocatableInstruction,
{
fn encode(self) -> impl Iterator<Item = (InstructionCode, Option<Reloc>)> + 'static {
fn encode(self) -> impl Iterator<Item = (InstructionCode, Option<Rel64>)> + 'static {
let code = self.to_code_with_reloc();
core::iter::once(code)
}
Expand Down
Loading