aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:14:14 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:14:14 +0000
commit5d800d43668360b5752277108247fdd5c5069301 (patch)
tree3cd0c7feaca40a2cc3fe17e3fc7425b09f549fe2
parent14a3820e7406aa403aab67254f91886d30244b82 (diff)
downloadovm-5d800d43668360b5752277108247fdd5c5069301.tar.gz
ovm-5d800d43668360b5752277108247fdd5c5069301.tar.bz2
ovm-5d800d43668360b5752277108247fdd5c5069301.zip
Moved inst module to lib
As it has no dependencies on vm specifically, and it's more necessary for any vendors who wish to target the virtual machine, it makes more sense for inst to be a lib module rather than a vm module.
-rw-r--r--Makefile6
-rw-r--r--asm/parser.h2
-rw-r--r--examples/fib.c2
-rw-r--r--lib/inst.c (renamed from vm/inst.c)0
-rw-r--r--lib/inst.h (renamed from vm/inst.h)0
-rw-r--r--vm/main.c2
-rw-r--r--vm/runtime.h2
7 files changed, 7 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d0d8c00..285953a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ TERM_RESET:=$(shell echo -e "\e[0;0m")
## Lib setup
LIB_DIST=$(DIST)/lib
LIB_SRC=lib
-LIB_CODE:=$(addprefix $(LIB_SRC)/, base.c darr.c)
+LIB_CODE:=$(addprefix $(LIB_SRC)/, base.c darr.c inst.c)
LIB_OBJECTS:=$(LIB_CODE:$(LIB_SRC)/%.c=$(LIB_DIST)/%.o)
LIB_DEPS:=$(LIB_OBJECTS:%.o=%.d)
LIB_CFLAGS=$(CFLAGS)
@@ -22,7 +22,7 @@ LIB_CFLAGS=$(CFLAGS)
## VM setup
VM_DIST=$(DIST)/vm
VM_SRC=vm
-VM_CODE:=$(addprefix $(VM_SRC)/, inst.c runtime.c)
+VM_CODE:=$(addprefix $(VM_SRC)/, runtime.c)
VM_OBJECTS:=$(VM_CODE:$(VM_SRC)/%.c=$(VM_DIST)/%.o)
VM_DEPS:=$(VM_OBJECTS:%.o=%.d) $(VM_DIST)/main.d
VM_CFLAGS:=$(CFLAGS)
@@ -71,7 +71,7 @@ $(VM_DIST)/%.o: $(VM_SRC)/%.c
@echo -e "$(TERM_GREEN)$@$(TERM_RESET): $<"
## ASSEMBLY Recipes
-$(ASM_OUT): $(LIB_OBJECTS) $(VM_DIST)/inst.o $(ASM_OBJECTS) $(ASM_DIST)/main.o
+$(ASM_OUT): $(LIB_OBJECTS) $(ASM_OBJECTS) $(ASM_DIST)/main.o
@$(CC) $(ASM_CFLAGS) $^ -o $@ $(LIBS)
@echo -e "$(TERM_GREEN)$@$(TERM_RESET): $^"
diff --git a/asm/parser.h b/asm/parser.h
index 9da1117..1921c7e 100644
--- a/asm/parser.h
+++ b/asm/parser.h
@@ -15,7 +15,7 @@
#include "./lexer.h"
-#include <vm/inst.h>
+#include <lib/inst.h>
typedef enum
{
diff --git a/examples/fib.c b/examples/fib.c
index e6982b7..aceab48 100644
--- a/examples/fib.c
+++ b/examples/fib.c
@@ -16,7 +16,7 @@
#include <stdio.h>
#include <string.h>
-#include <vm/inst.h>
+#include <lib/inst.h>
#include <vm/runtime.h>
int main(void)
diff --git a/vm/inst.c b/lib/inst.c
index 5be2438..5be2438 100644
--- a/vm/inst.c
+++ b/lib/inst.c
diff --git a/vm/inst.h b/lib/inst.h
index 929c068..929c068 100644
--- a/vm/inst.h
+++ b/lib/inst.h
diff --git a/vm/main.c b/vm/main.c
index 2594edc..c0b576a 100644
--- a/vm/main.c
+++ b/vm/main.c
@@ -14,8 +14,8 @@
#include <stdio.h>
#include <string.h>
-#include "./inst.h"
#include "./runtime.h"
+#include <lib/inst.h>
int interpret_bytecode(const char *filepath)
{
diff --git a/vm/runtime.h b/vm/runtime.h
index c2acfce..1a03700 100644
--- a/vm/runtime.h
+++ b/vm/runtime.h
@@ -16,7 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "./inst.h"
+#include <lib/inst.h>
typedef enum
{