Refactored all OP_ functions to vm/CATEGORY/ and renamed the files.
This commit is contained in:
parent
108be8c41e
commit
50a91d0b6f
67 changed files with 91 additions and 92 deletions
12
src/vm/core/store_local.c
Normal file
12
src/vm/core/store_local.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
case OP_STORE_LOCAL: {
|
||||
int slot = inst.operand;
|
||||
if (slot < 0 || slot >= FRAME_MAX_LOCALS) {
|
||||
fprintf(stderr, "Runtime error: local slot out of range\n");
|
||||
exit(1);
|
||||
}
|
||||
Value v = pop_value(vm);
|
||||
/* free previous local then move v into it */
|
||||
free_value(f->locals[slot]);
|
||||
f->locals[slot] = v;
|
||||
break;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue