Skip to content

Commit

Permalink
remove exec's value now
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenthz committed Dec 18, 2023
1 parent e4467cd commit 40b947a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 86 deletions.
17 changes: 16 additions & 1 deletion werbolg-exec/src/exec.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
use crate::Valuable;

use super::NIFCall;
use super::{ExecutionError, ExecutionMachine};
use werbolg_compile::{CallArity, Instruction, InstructionAddress, LocalStackSize};
use werbolg_core as ir;
use werbolg_core::ValueFun;

/// Native Implemented Function
pub struct NIF<'m, L, T, V> {
pub name: &'static str,
pub call: NIFCall<'m, L, T, V>,
}

/// 2 Variants of Native calls
///
/// * "Pure" function that don't have access to the execution machine
/// * "Mut" function that have access to the execution machine and have more power / responsability.
pub enum NIFCall<'m, L, T, V> {
Pure(fn(&[V]) -> Result<V, ExecutionError>),
Mut(fn(&mut ExecutionMachine<'m, L, T, V>, &[V]) -> Result<V, ExecutionError>),
}

/// Execute the module, calling function identified by FunId, with the arguments in parameters
pub fn exec<'module, L, T, V: Valuable>(
em: &mut ExecutionMachine<'module, L, T, V>,
call: ir::FunId,
Expand Down
4 changes: 1 addition & 3 deletions werbolg-exec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ use werbolg_core as ir;

mod exec;
mod valuable;
mod value;

use alloc::{string::String, vec::Vec};
pub use valuable::{Valuable, ValueKind};
pub use value::{NIFCall, NIF};

pub use exec::{exec, exec_continue, step};
pub use exec::{exec, exec_continue, step, NIFCall, NIF};

pub struct ExecutionEnviron<'m, L, T, V> {
pub nifs: IdVec<NifId, NIF<'m, L, T, V>>,
Expand Down
82 changes: 0 additions & 82 deletions werbolg-exec/src/value.rs

This file was deleted.

0 comments on commit 40b947a

Please sign in to comment.