Update WIP with jump table for words and conditions
This commit is contained in:
parent
df73353bc6
commit
00bab636db
10 changed files with 234 additions and 116 deletions
|
@ -166,14 +166,14 @@ impl Compiler {
|
|||
.collect::<Result<Vec<_>>>()?
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect(),
|
||||
.collect::<Vec<_>>(),
|
||||
c.else_instructions
|
||||
.iter()
|
||||
.map(|ins| ins.compile(self))
|
||||
.collect::<Result<Vec<_>>>()?
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect(),
|
||||
.collect::<Vec<_>>(),
|
||||
),
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1228,10 +1228,7 @@ impl compiler::Compilable<compiler::Compiler, hence::parser::ast::Body> for Inst
|
|||
if w.times_used > 1 {
|
||||
Ok(vec![hence::parser::ast::Node::MacroCall {
|
||||
name: "call_stack_jump".to_string(),
|
||||
args: vec![
|
||||
hence::arg::Arg::Variable(format!("words_{}", w.id)),
|
||||
hence::arg::Arg::Variable("OFFSET".to_string()),
|
||||
],
|
||||
args: vec![hence::arg::Arg::Variable(format!("words_{}", w.id))],
|
||||
}])
|
||||
} else {
|
||||
Ok(w.instructions
|
||||
|
@ -1252,10 +1249,7 @@ impl compiler::Compilable<compiler::Compiler, hence::parser::ast::Body> for Inst
|
|||
Some(cond) => Ok(vec![if cond.only_if() {
|
||||
hence::parser::ast::Node::MacroCall {
|
||||
name: "call_stack_jump_cond_if".to_string(),
|
||||
args: vec![
|
||||
hence::arg::Arg::Variable(format!("conditions_if_{}", x)),
|
||||
hence::arg::Arg::Variable("OFFSET".to_string()),
|
||||
],
|
||||
args: vec![hence::arg::Arg::Variable(format!("conditions_if_{}", x))],
|
||||
}
|
||||
} else {
|
||||
hence::parser::ast::Node::MacroCall {
|
||||
|
@ -1263,7 +1257,6 @@ impl compiler::Compilable<compiler::Compiler, hence::parser::ast::Body> for Inst
|
|||
args: vec![
|
||||
hence::arg::Arg::Variable(format!("conditions_if_{}", x)),
|
||||
hence::arg::Arg::Variable(format!("conditions_else_{}", x)),
|
||||
hence::arg::Arg::Variable("OFFSET".to_string()),
|
||||
],
|
||||
}
|
||||
}]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue