about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/vm.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/vm.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/bytecode/vm.rs b/users/tazjin/rlox/src/bytecode/vm.rs
index 4432473ee649..10d0f595d6d4 100644
--- a/users/tazjin/rlox/src/bytecode/vm.rs
+++ b/users/tazjin/rlox/src/bytecode/vm.rs
@@ -194,6 +194,16 @@ impl VM {
                         }
                     });
                 }
+
+                OpCode::OpGetLocal(local_idx) => {
+                    let value = self.stack[*local_idx].clone();
+                    self.push(value);
+                }
+
+                OpCode::OpSetLocal(local_idx) => {
+                    debug_assert!(self.stack.len() > *local_idx, "stack is not currently large enough for local");
+                    self.stack[*local_idx] = self.stack.last().unwrap().clone();
+                }
             }
 
             #[cfg(feature = "disassemble")]