Skip to content

Commit

Permalink
Change to max 256 thread locals
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Sep 5, 2024
1 parent 9165d3f commit 70144e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ pub enum Op
*/

// Set thread-local variable
// thread_set <idx:u16> (val)
// thread_set <idx:u8> (val)
thread_set,

// Get thread-local variable
// thread_get <idx:u16>
// thread_get <idx:u8>
thread_get,

// NOTE: may want to wait for this because it's not RISC,
Expand Down Expand Up @@ -1443,7 +1443,7 @@ impl Thread
}

Op::thread_set => {
let idx = self.code.read_pc::<u16>(&mut pc) as usize;
let idx = self.code.read_pc::<u8>(&mut pc) as usize;
let val = self.pop();

if idx >= self.locals.len() {
Expand All @@ -1454,7 +1454,7 @@ impl Thread
}

Op::thread_get => {
let idx = self.code.read_pc::<u16>(&mut pc) as usize;
let idx = self.code.read_pc::<u8>(&mut pc) as usize;

if idx >= self.locals.len() {
self.push(Value::from(0));
Expand Down

0 comments on commit 70144e0

Please sign in to comment.