Skip to content

Commit

Permalink
vendor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Shaw Summa <[email protected]>
  • Loading branch information
ShawSumma committed Mar 11, 2024
1 parent 0389d50 commit bd23a05
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
9 changes: 7 additions & 2 deletions test/tables/trees2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
5 changes: 3 additions & 2 deletions vm/backend/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion vm/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdbool.h>

#define VM_USE_DUMP 1
#define VM_NO_TAILCALL 0
#define VM_NO_TAILCALL 1
#define VM_FORMAT_FLOAT "%.14g"

struct vm_config_t;
Expand Down
2 changes: 1 addition & 1 deletion vm/ir/tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion vm/ir/type.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit bd23a05

Please sign in to comment.