runtime: adapt to new instruction set

This commit is contained in:
Michael Sippel 2024-05-13 21:51:28 +02:00
parent f26e24bba1
commit c910265531
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -59,11 +59,11 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
linker.add_procedure(
"i+",
tisc::Assembler::new()
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::IntAdd)
.build(),
);
/* Floating-point Additionu
/* Floating-point Addition
*/
symbols.write().unwrap().declare_proc_parse(
"f+",
@ -78,7 +78,7 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
linker.add_procedure(
"f+",
tisc::Assembler::new()
.inst(tisc::VM_Instruction::Addf)
.inst(tisc::VM_Instruction::FltAdd)
.build(),
);
@ -97,10 +97,10 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
"i-",
tisc::Assembler::new()
.inst(tisc::VM_Instruction::Swap)
.inst(tisc::VM_Instruction::BitwiseNot)
.inst(tisc::VM_Instruction::BitNeg)
.lit(1)
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::IntAdd)
.inst(tisc::VM_Instruction::IntAdd)
.build(),
);
@ -173,7 +173,7 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
.lit(3)
.inst(tisc::VM_Instruction::Pick)
// [ a b sum a -- a b (sum+a) ]
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::IntAdd)
// [ a b sum -- a sum b ]
.inst(tisc::VM_Instruction::Swap)
// [ a sum b -- a sum b 1 ]
@ -218,7 +218,7 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
tisc::Assembler::new()
.static_ref("data-frame-ptr")
.inst(tisc::VM_Instruction::Fetch)
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::IntAdd)
.inst(tisc::VM_Instruction::Store)
.build(),
);
@ -234,7 +234,7 @@ pub fn init_runtime(linker: &mut Linker) -> Arc<RwLock<Scope>> {
tisc::Assembler::new()
.static_ref("data-frame-ptr")
.inst(tisc::VM_Instruction::Fetch)
.inst(tisc::VM_Instruction::Add)
.inst(tisc::VM_Instruction::IntAdd)
.inst(tisc::VM_Instruction::Fetch)
.build(),
);