Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawSumma committed May 17, 2024
1 parent 02893f3 commit 611a13d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion main/minivm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ void vm_lang_lua_repl(vm_config_t *config, vm_table_t *std, vm_blocks_t *blocks)
int main(int argc, char **argv) {
vm_config_t val_config = (vm_config_t) {
.use_num = VM_USE_NUM_I32,
.tb_lbbv = false,
.tb_lbbv = true,
.tb_regs_cast = true,
.tb_recompile = true,
#if defined(EMSCRIPTEN)
.target = VM_TARGET_TB_EMCC,
Expand Down
8 changes: 5 additions & 3 deletions vm/backend/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void *vm_cache_comp(const char *comp, const char *flags, const char *src, const
fwrite(src, 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 %s -o %s -w -pipe", comp, flags, c_file, so_file);
// vm_io_buffer_format(cmd_buf, "%s -shared -g3 -foptimize-sibling-calls -fPIC %s %s -o %s -w -pipe", comp, flags, c_file, so_file);
vm_io_buffer_format(cmd_buf, "%s -shared -O3 -foptimize-sibling-calls -fPIC %s %s -o %s -w -pipe", comp, flags, c_file, so_file);
int res = system(cmd_buf->buf);
if (res) {
return NULL;
Expand Down Expand Up @@ -97,15 +98,16 @@ void *vm_cache_comp(const char *comp, const char *flags, const char *src, const
fclose(out);
vm_io_buffer_t *cmd_buf = vm_io_buffer_new();
vm_io_buffer_format(cmd_buf, "%s -shared -O3 -foptimize-sibling-calls -fPIC %s %s -o %s -w -pipe", comp, flags, c_file, so_file);
// vm_io_buffer_format(cmd_buf, "%s -shared -g3 -fsanitize=memory -foptimize-sibling-calls -fPIC %s %s -o %s -w -pipe", comp, flags, 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);
remove(so_file);
// remove(so_file);
return sym;
}
#endif
Expand Down

0 comments on commit 611a13d

Please sign in to comment.