From 8c3037662ba572a6935170dbd4cb8cc8a3636417 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 22 Jun 2024 18:22:24 +0100 Subject: compilation of functions, and some parts of interpreting them --- vm.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'vm.h') diff --git a/vm.h b/vm.h index c75df82..74fe506 100644 --- a/vm.h +++ b/vm.h @@ -10,12 +10,21 @@ typedef struct _thread Thread; #include "val.h" #include "com.h" -#define STACKSIZE 128 +typedef struct { + size_t ip; + Chunk *ch; + +} StackFrame; + +#define MAXDEPTH 64 +#define STACKSIZE 256*MAXDEPTH typedef struct _thread { Chunk *ch; size_t ip; Val stack[STACKSIZE]; size_t sp; + StackFrame rstack[MAXDEPTH]; + size_t rsp; } Thread; Thread thread_new(State *S); @@ -34,6 +43,7 @@ typedef enum { OP_EQU, OP_CMP, + OP_HALT, OP_DROP, @@ -47,6 +57,8 @@ typedef enum { OP_0BRANCH, OP_SKIP, OP_REDO, + + OP_CALL, } Op; int runvm(State *S); -- cgit v1.2.3