From fc565d78596a44f6e6253932d726c830e3f6e509 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Mon, 22 Aug 2022 20:05:23 -0700 Subject: Simplify the heap. Garbage collection is no longer recursive, heap takes an offset explicitly, and we use the vector length to store the free pointer. --- bytecode/src/bytecode.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bytecode/src/bytecode.rs') diff --git a/bytecode/src/bytecode.rs b/bytecode/src/bytecode.rs index e784d57..41302ad 100644 --- a/bytecode/src/bytecode.rs +++ b/bytecode/src/bytecode.rs @@ -183,7 +183,7 @@ impl Interpreter { if o < 0 { return Err(String::from("pointer offset can't be negative")); } - let result = self.heap.peek(p.offset(usize::try_from(o).unwrap()))?; + let result = self.heap.peek(p, usize::try_from(o).unwrap())?; self.set_arg(dest, result); Ok(()) } @@ -195,7 +195,7 @@ impl Interpreter { if o < 0 { return Err(String::from("pointer offset can't be negative")); } - self.heap.poke(w, p.offset(usize::try_from(o).unwrap()))?; + self.heap.poke(w, p, usize::try_from(o).unwrap())?; Ok(()) } -- cgit v1.3.1