summaryrefslogtreecommitdiff
path: root/vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm.h')
-rw-r--r--vm.h14
1 files changed, 13 insertions, 1 deletions
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);