Compare commits

..

No commits in common. "49e46d045bebf718b1f02f6779ac9b32419cd185" and "f09caabfcbf73adb1f3198682d4c174c6b3ef430" have entirely different histories.

4 changed files with 9 additions and 18 deletions

View File

@ -494,8 +494,5 @@ Here's a list of things that need doing:
- I need this fixed for optimization reasons. - I need this fixed for optimization reasons.
- I _think_ I just fixed this by fixing tail position tracking in collections - I _think_ I just fixed this by fixing tail position tracking in collections
- [ ] test this - [ ] test this
* [x] Dict patterns are giving me stack discipline grief. Why is stack discipline so hard? * [ ] Dict patterns are giving me stack discipline grief. Why is stack discipline so hard?
* [ ] This is in the service of getting turtle graphics working
* Other forms in the language need help:
* [ ] repeat needs its stack discipline updated, it currently crashes the compiler

View File

@ -35,11 +35,6 @@
& & (:background, _) -> state & & (:background, _) -> state
& } & }
box foos = [] let foo = #{:a 1, :b 2, :c 3}
let #{a, b, ...c} = foo
repeat 4 {
update! (foos, append (_, :foo))
}
do foos > unbox > count

View File

@ -724,7 +724,6 @@ impl<'a> Compiler<'a> {
}; };
self.emit_constant(Value::Keyword(key)); self.emit_constant(Value::Keyword(key));
self.emit_op(Op::DropDictEntry); self.emit_op(Op::DropDictEntry);
self.stack_depth -= 1;
} }
if let Some(splatt) = splattern { if let Some(splatt) = splattern {
@ -1242,7 +1241,7 @@ impl<'a> Compiler<'a> {
// begin repeat // begin repeat
self.emit_op(Op::Decrement); self.emit_op(Op::Decrement);
let repeat_begin = self.len(); let repeat_begin = self.len();
self.duplicate(); self.emit_op(Op::Duplicate);
let jiz_idx = self.stub_jump(Op::JumpIfZero); let jiz_idx = self.stub_jump(Op::JumpIfZero);
// compile the body // compile the body
self.visit(body); self.visit(body);

View File

@ -910,7 +910,7 @@ impl Vm {
for i in 0..arity as usize { for i in 0..arity as usize {
self.return_register[arity as usize - i - 1] = self.pop(); self.return_register[arity as usize - i - 1] = self.pop();
} }
// self.print_stack(); self.print_stack();
// then pop everything back to the current stack frame // then pop everything back to the current stack frame
self.stack.truncate(self.frame.stack_base); self.stack.truncate(self.frame.stack_base);
@ -976,10 +976,10 @@ impl Vm {
// self.ip = self.frame.ip; // self.ip = self.frame.ip;
// // finally, throw the value on the stack // // finally, throw the value on the stack
self.push(value); self.push(value);
// println!( println!(
// "=== returning to {} ===", "=== returning to {} ===",
// self.frame.function.as_fn().name() self.frame.function.as_fn().name()
// ); );
} }
Value::Partial(partial) => { Value::Partial(partial) => {
let last_arg = self.pop(); let last_arg = self.pop();