From a2af9f98b571cc81a1b9cc3635454c99b8a25d4f Mon Sep 17 00:00:00 2001 From: dvtate Date: Sat, 2 Mar 2024 21:29:47 -0600 Subject: [PATCH] this lang has some bugs I don't remember encountering in the past --- CMakeLists.txt | 4 ++-- vm/operators/internal_tools.cpp | 6 +++--- vm/vm.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9133633..47052a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,9 @@ find_package(Threads REQUIRED) link_libraries(dl) # Debug -#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -lefence -g -Wall -Wextra") +#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -Wall -Wextra") # Production -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g") set(SOURCE_FILES util.cpp util.hpp debug.hpp diff --git a/vm/operators/internal_tools.cpp b/vm/operators/internal_tools.cpp index b3f7564..779b5b1 100644 --- a/vm/operators/internal_tools.cpp +++ b/vm/operators/internal_tools.cpp @@ -33,7 +33,7 @@ namespace vm_util { f.gc_make(f)); // - f.rt->running->stack.emplace_back(new Frame(f.rt, c)); + f.rt->running->stack.emplace_back(std::make_shared(f.rt, c)); return; } @@ -59,7 +59,7 @@ namespace vm_util { index += list.size(); // Out of range - if (index >= list.size()) + if (index >= (ValueTypes::int_t) list.size()) return Value(); // Return indexed value @@ -73,7 +73,7 @@ namespace vm_util { index += str.size(); // Out of range - if (index >= str.size()) + if (index >= (ValueTypes::int_t) str.size()) return Value(); // Return indexed value diff --git a/vm/vm.hpp b/vm/vm.hpp index 2b092fc..87c5d63 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -227,7 +227,7 @@ class Frame { std::vector eval_stack; Frame(Runtime* rt, Closure body, unsigned int pos = 0, std::vector eval_stack = {}): - rt(rt), closure(body), pos(pos), eval_stack(std::move(eval_stack)) + rt(rt), closure(std::move(body)), pos(pos), eval_stack(std::move(eval_stack)) {} ~Frame() {}