Skip to content

Commit

Permalink
chore: release v0.12.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Nov 15, 2024
1 parent 92bad20 commit 802587f
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "aluvm"
description = "Functional registry-based RISC virtual machine"
version = "0.12.0-beta.1"
version = "0.12.0-beta.2"
authors = ["Dr Maxim Orlovsky <[email protected]>"]
repository = "https://github.com/aluvm/rust-aluvm"
homepage = "https://aluvm.org"
Expand Down
13 changes: 9 additions & 4 deletions src/core/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ pub struct Core<
#[strict_type(lib = LIB_NAME_ALUVM)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]

Check warning on line 127 in src/core/core.rs

View check run for this annotation

Codecov / codecov/patch

src/core/core.rs#L127

Added line #L127 was not covered by tests
pub struct CoreConfig {
/// Initial value for the [`Core::ch`] flag.
/// Initial value for the `CH` register.
pub halt: bool,
/// Initial value for the [`Core::cl`] flag.
/// Initial value for the `CL` register.
pub complexity_lim: Option<u64>,
}

Expand All @@ -141,15 +141,20 @@ impl Default for CoreConfig {
///
/// - [`CoreConfig::halt`]
/// - [`CoreConfig::complexity_lim`]
/// - [`CoreConfig::field_order`]
fn default() -> Self { CoreConfig { halt: true, complexity_lim: None } }
}

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Default
for Core<Id, Cx, CALL_STACK_SIZE>
{
fn default() -> Self { Core::new() }

Check warning on line 150 in src/core/core.rs

View check run for this annotation

Codecov / codecov/patch

src/core/core.rs#L150

Added line #L150 was not covered by tests
}

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Core<Id, Cx, CALL_STACK_SIZE> {
/// Initializes registers. Sets `st0` to `true`, counters to zero, call stack to empty and the
/// rest of registers to `None` value.
///
/// An alias for [`AluCore::with`]`(`[`CoreConfig::default()`]`)`.
/// An alias for [`Core::with`]`(`[`CoreConfig::default()`]`)`.
#[inline]
pub fn new() -> Self {
assert!(CALL_STACK_SIZE <= CALL_STACK_SIZE_MAX as usize, "Call stack size is too large");
Expand Down
1 change: 1 addition & 0 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

//! AluVM registers system
#[allow(clippy::module_inception)]
mod core;
mod microcode;
mod util;
Expand Down
3 changes: 3 additions & 0 deletions src/core/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,20 @@ pub trait Register: Copy + Ord + Debug + Display {

#[derive(Debug)]
pub enum NoRegs {}
#[allow(clippy::non_canonical_clone_impl)]
impl Clone for NoRegs {
fn clone(&self) -> Self { unreachable!() }

Check warning on line 40 in src/core/util.rs

View check run for this annotation

Codecov / codecov/patch

src/core/util.rs#L40

Added line #L40 was not covered by tests
}
impl Copy for NoRegs {}
#[allow(clippy::non_canonical_clone_impl)]
impl PartialEq for NoRegs {
fn eq(&self, _: &Self) -> bool { unreachable!() }

Check warning on line 45 in src/core/util.rs

View check run for this annotation

Codecov / codecov/patch

src/core/util.rs#L45

Added line #L45 was not covered by tests
}
impl Eq for NoRegs {}
impl Ord for NoRegs {
fn cmp(&self, _: &Self) -> Ordering { unreachable!() }

Check warning on line 49 in src/core/util.rs

View check run for this annotation

Codecov / codecov/patch

src/core/util.rs#L49

Added line #L49 was not covered by tests
}
#[allow(clippy::non_canonical_partial_ord_impl)]
impl PartialOrd for NoRegs {
fn partial_cmp(&self, _: &Self) -> Option<Ordering> { unreachable!() }

Check warning on line 53 in src/core/util.rs

View check run for this annotation

Codecov / codecov/patch

src/core/util.rs#L53

Added line #L53 was not covered by tests
}
Expand Down
2 changes: 1 addition & 1 deletion src/isa/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl From<&'static str> for IsaId {
fn from(id: &'static str) -> Self { Self(RString::from(id)) }
}

/// Reserved instruction, which equal to [`ControlFlowOp::Fail`].
/// Reserved instruction, which equal to [`crate::ExecStep::FailHalt`].
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Display, Default)]
#[display("halt {0:#02X}#h")]
pub struct ReservedInstr(/** Reserved instruction op code value */ pub(super) u8);
Expand Down
6 changes: 3 additions & 3 deletions src/isa/ctrl/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl<Id: SiteId> Instruction<Id> for Instr<Id> {
_: &Self::Context<'_>,
) -> ExecStep<Site<Id>> {
match self {
Instr::Ctrl(instr) => instr.exec(site, core, &mut ()),
Instr::Reserved(instr) => instr.exec(site, core, &mut ()),
Instr::Ctrl(instr) => instr.exec(site, core, &()),
Instr::Reserved(instr) => instr.exec(site, core, &()),

Check warning on line 73 in src/isa/ctrl/exec.rs

View check run for this annotation

Codecov / codecov/patch

src/isa/ctrl/exec.rs#L73

Added line #L73 was not covered by tests
}
}
}
Expand Down Expand Up @@ -153,7 +153,7 @@ impl<Id: SiteId> Instruction<Id> for CtrlInstr<Id> {
let Some(pos) = current.offset.checked_add_signed(shift as i16) else {
return ExecStep::FailHalt;

Check warning on line 154 in src/isa/ctrl/exec.rs

View check run for this annotation

Codecov / codecov/patch

src/isa/ctrl/exec.rs#L153-L154

Added lines #L153 - L154 were not covered by tests
};
return ExecStep::Jump(pos);
ExecStep::Jump(pos)
};

Check warning on line 157 in src/isa/ctrl/exec.rs

View check run for this annotation

Codecov / codecov/patch

src/isa/ctrl/exec.rs#L156-L157

Added lines #L156 - L157 were not covered by tests

match *self {
Expand Down
2 changes: 1 addition & 1 deletion src/isa/instr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub trait Instruction<Id: SiteId>: Display + Debug + Bytecode<Id> {
type Context<'ctx>;

fn isa_ext() -> TinyOrdSet<IsaId> {
let iter = Self::ISA_EXT.into_iter().copied().map(IsaId::from);
let iter = Self::ISA_EXT.iter().copied().map(IsaId::from);
TinyOrdSet::from_iter_checked(iter)
}

Expand Down
2 changes: 1 addition & 1 deletion src/library/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use strict_encoding::{StrictDeserialize, StrictSerialize};
use crate::core::SiteId;
use crate::{IsaId, Site, LIB_NAME_ALUVM};

pub const LIB_ID_TAG: &'static str = "urn:ubideco:aluvm:lib:v01#241020";
pub const LIB_ID_TAG: &str = "urn:ubideco:aluvm:lib:v01#241020";

/// Unique identifier for an AluVM library.
#[derive(Wrapper, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Default, Debug, From)]
Expand Down
2 changes: 1 addition & 1 deletion src/library/marshaller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ where
if len >= u16::MAX as usize {
return Err(MarshallError::DataExceedsLimit(len));
}
let offset = self.write_unique(&data)?;
let offset = self.write_unique(data)?;
self.write_word(offset)?;
self.write_word(len as u16)
}

Check warning on line 429 in src/library/marshaller.rs

View check run for this annotation

Codecov / codecov/patch

src/library/marshaller.rs#L421-L429

Added lines #L421 - L429 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::isa::{Instr, Instruction};
use crate::library::{Lib, LibId, LibSite};

/// Alu virtual machine providing single-core execution environment
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct Vm<Isa = Instr<LibId>>
where Isa: Instruction<LibId>
{
Expand Down

0 comments on commit 802587f

Please sign in to comment.