diff --git a/test/tables/trees2.lua b/test/tables/trees2.lua index e6cf9a95..68156ff6 100644 --- a/test/tables/trees2.lua +++ b/test/tables/trees2.lua @@ -12,11 +12,16 @@ end local function ItemCheck(tree) if #tree == 3 then - return tree[1] + ItemCheck(tree[2]) - ItemCheck(tree[3]) + local v1 = tree[1] + local v2 = ItemCheck(tree[2]) + local v3 = ItemCheck(tree[3]) + print(v1, v2, v3) + return v1 + v2 - v3 else + print(tree[1]) return tree[1] end end -local stretchtree = BottomUpTree(0, 12) +local stretchtree = BottomUpTree(0, 3) print(ItemCheck(stretchtree)) diff --git a/vm/backend/exec.c b/vm/backend/exec.c index 4492d176..788b73f3 100644 --- a/vm/backend/exec.c +++ b/vm/backend/exec.c @@ -73,12 +73,13 @@ void *vm_cache_comp(const char *comp, const char **srcs, const char *entry) { fwrite(src_buf->buf, src_buf->len, 1, out); fclose(out); vm_io_buffer_t *cmd_buf = vm_io_buffer_new(); - vm_io_buffer_format(cmd_buf, "%s -shared -O2 -foptimize-sibling-calls -fPIC %s -o %s -w -pipe", comp, c_file, so_file); + // vm_io_buffer_format(cmd_buf, "%s -shared -O2 -foptimize-sibling-calls -fPIC %s -o %s -w -pipe", comp, c_file, so_file); + vm_io_buffer_format(cmd_buf, "%s -shared -g2 -foptimize-sibling-calls -fPIC %s -o %s -w -pipe", comp, c_file, so_file); int res = system(cmd_buf->buf); if (res) { return NULL; } - remove(c_file); + // remove(c_file); } void *handle = dlopen(so_file, RTLD_LAZY); void *sym = dlsym(handle, entry); diff --git a/vm/config.h b/vm/config.h index 54b26b5f..2e69a37b 100644 --- a/vm/config.h +++ b/vm/config.h @@ -5,7 +5,7 @@ #include #define VM_USE_DUMP 1 -#define VM_NO_TAILCALL 0 +#define VM_NO_TAILCALL 1 #define VM_FORMAT_FLOAT "%.14g" struct vm_config_t; diff --git a/vm/ir/tag.h b/vm/ir/tag.h index 9dfbc600..afe23a7c 100644 --- a/vm/ir/tag.h +++ b/vm/ir/tag.h @@ -33,7 +33,7 @@ struct vm_type_value_t { uint32_t tag; }; -extern const vm_type_value_t vm_type_base[VM_TAG_MAX]; +extern vm_type_value_t vm_type_base[VM_TAG_MAX]; #define VM_TYPE_UNK (NULL) #define VM_TYPE_NIL (&vm_type_base[VM_TAG_NIL]) diff --git a/vm/ir/type.c b/vm/ir/type.c index d02dac2e..ba3414c4 100644 --- a/vm/ir/type.c +++ b/vm/ir/type.c @@ -3,7 +3,7 @@ #include "ir.h" -const vm_type_value_t vm_type_base[VM_TAG_MAX] = { +vm_type_value_t vm_type_base[VM_TAG_MAX] = { [VM_TAG_NIL] = {VM_TAG_NIL}, [VM_TAG_BOOL] = {VM_TAG_BOOL}, [VM_TAG_I8] = {VM_TAG_I8},