summaryrefslogtreecommitdiff
path: root/vm.h
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-22 18:22:24 +0100
committerubq323 <ubq323@ubq323.website>2024-06-22 18:22:24 +0100
commit8c3037662ba572a6935170dbd4cb8cc8a3636417 (patch)
tree1d585a5f0eab8eed96d0741421656f11c99c7c33 /vm.h
parent1d496f5f7f01b20fb34e63d1c85a33d8decd1894 (diff)
compilation of functions, and some parts of interpreting them
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);