Example extension: Stacks; fixes to allow module data storage in thread context
This commit is contained in:
@@ -4,13 +4,15 @@ use num_traits::PrimInt;
|
||||
|
||||
use crsn::asm::instr::op::{OpTrait, EvalRes};
|
||||
use crsn::runtime::fault::Fault;
|
||||
use crsn::runtime::frame::{CallStack, StackFrame};
|
||||
use crsn::runtime::program::Program;
|
||||
|
||||
|
||||
|
||||
use crate::defs::ArithOp;
|
||||
use crsn::runtime::run_thread::{ThreadInfo, RunState};
|
||||
|
||||
impl OpTrait for ArithOp {
|
||||
fn execute(&self, _program: &Program, _call_stack: &mut CallStack, frame: &mut StackFrame) -> Result<EvalRes, Fault> {
|
||||
fn execute(&self, _ti : &ThreadInfo, state: &mut RunState) -> Result<EvalRes, Fault> {
|
||||
let frame = &mut state.frame;
|
||||
let eres = EvalRes::default();
|
||||
match self {
|
||||
ArithOp::Test { a } => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub use parse::ArithOpParser;
|
||||
pub use parse::ArithOps;
|
||||
|
||||
mod defs;
|
||||
mod parse;
|
||||
|
||||
@@ -7,11 +7,11 @@ use crsn::asm::parse::arg_parser::ArgParser;
|
||||
use crate::defs::ArithOp;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ArithOpParser {
|
||||
pub struct ArithOps {
|
||||
_internal: ()
|
||||
}
|
||||
|
||||
impl ArithOpParser {
|
||||
impl ArithOps {
|
||||
pub fn new() -> Box<dyn AsmModule> {
|
||||
Box::new(Self {
|
||||
_internal: ()
|
||||
@@ -19,7 +19,7 @@ impl ArithOpParser {
|
||||
}
|
||||
}
|
||||
|
||||
impl AsmModule for ArithOpParser {
|
||||
impl AsmModule for ArithOps {
|
||||
fn name(&self) -> &'static str {
|
||||
"arith"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user