This commit is contained in:
Nilton Constantino
2026-02-02 16:31:06 +00:00
parent 6330c6cbae
commit f80cb64f66
17 changed files with 594 additions and 157 deletions
@@ -130,6 +130,13 @@ pub enum InstrKind {
/// Calls a function by ID with the specified number of arguments.
/// Arguments should be pushed onto the stack before calling.
Call { func_id: FunctionId, arg_count: u32 },
/// Calls a function from another project.
ImportCall {
dep_alias: String,
module_path: String,
symbol_name: String,
arg_count: u32,
},
/// Returns from the current function. The return value (if any) should be on top of the stack.
Ret,
@@ -238,6 +245,12 @@ mod tests {
InstrKind::JmpIfFalse(Label("target".to_string())),
InstrKind::Label(Label("target".to_string())),
InstrKind::Call { func_id: FunctionId(0), arg_count: 0 },
InstrKind::ImportCall {
dep_alias: "std".to_string(),
module_path: "math".to_string(),
symbol_name: "abs".to_string(),
arg_count: 1,
},
InstrKind::Ret,
InstrKind::Syscall(0),
InstrKind::FrameSync,
@@ -324,6 +337,14 @@ mod tests {
"arg_count": 0
}
},
{
"ImportCall": {
"dep_alias": "std",
"module_path": "math",
"symbol_name": "abs",
"arg_count": 1
}
},
"Ret",
{
"Syscall": 0