Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
Signed-off-by: Shaw Summa <[email protected]>
  • Loading branch information
ShawSumma committed Feb 12, 2024
1 parent 8ae5ece commit 2c37f9d
Show file tree
Hide file tree
Showing 18 changed files with 184 additions and 287 deletions.
31 changes: 0 additions & 31 deletions vm/ast/comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ static vm_arg_t *vm_ast_args(size_t nargs, ...) {

static vm_block_t *vm_ast_comp_new_block(vm_ast_comp_t *comp) {
if (comp->blocks->len + 1 >= comp->blocks->alloc) {
// comp->blocks.alloc = (comp->blocks->len + 1) * 4;
comp->blocks->alloc = (comp->blocks->len + 1) * 128;
comp->blocks->blocks = vm_realloc(comp->blocks->blocks, sizeof(vm_block_t *) * comp->blocks->alloc);
}
Expand Down Expand Up @@ -743,8 +742,6 @@ static vm_arg_t vm_ast_comp_to(vm_ast_comp_t *comp, vm_ast_node_t node) {
break;
}
}
// printf("block %zi\n", comp->cur->id);
// printf("op: %i\n", (int) op);
vm_ast_blocks_instr(
comp,
(vm_instr_t){
Expand Down Expand Up @@ -901,33 +898,15 @@ static vm_arg_t vm_ast_comp_to(vm_ast_comp_t *comp, vm_ast_node_t node) {
return out;
}
case VM_AST_FORM_WHILE: {
// vm_block_t *cond = vm_ast_comp_new_block(comp);
vm_block_t *body = vm_ast_comp_new_block(comp);
vm_block_t *after = vm_ast_comp_new_block(comp);
// vm_ast_blocks_branch(
// comp,
// (vm_branch_t){
// .op = VM_BOP_JUMP,
// .args = vm_ast_args(0),
// .targets[0] = cond,
// }
// );
// comp->cur = cond;
vm_ast_comp_br(comp, form.args[0], body, after);
comp->cur = body;
vm_block_t *old_break = comp->on_break;
comp->on_break = after;
vm_ast_comp_to(comp, form.args[1]);
comp->on_break = old_break;
vm_ast_comp_br(comp, form.args[0], body, after);
// vm_ast_blocks_branch(
// comp,
// (vm_branch_t){
// .op = VM_BOP_JUMP,
// .args = vm_ast_args(0),
// .targets[0] = cond,
// }
// );
comp->cur = after;
return vm_arg_nil();
}
Expand Down Expand Up @@ -977,15 +956,6 @@ static vm_arg_t vm_ast_comp_to(vm_ast_comp_t *comp, vm_ast_node_t node) {
.value.str = vm_strdup(num.value.str),
},
};
// vm_arg_t ret = vm_ast_comp_reg(comp);
// vm_ast_blocks_instr(
// comp,
// (vm_instr_t){
// .op = VM_IOP_MOVE,
// .out = ret,
// .args = vm_ast_args(1, str),
// }
// );
return str;
} else if (num.tag == VM_TAG_ERROR) {
comp->is_error = true;
Expand Down Expand Up @@ -1087,5 +1057,4 @@ void vm_ast_comp_more(vm_ast_node_t node, vm_blocks_t *blocks) {
vm_ast_names_free(names);
comp.blocks->entry->isfunc = true;
vm_block_info(comp.blocks->len - start, comp.blocks->blocks + start);
// vm_block_info(comp.blocks->len, comp.blocks->blocks);
}
17 changes: 0 additions & 17 deletions vm/backend/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@ void *vm_cache_comp(const char *comp, const char **srcs, const char *entry) {
#if defined(EMSCRIPTEN)
#include <emscripten.h>

#if 0
EM_ASYNC_JS(void, vm_compile_c_to_wasm, (int n), {
await window.vm_compile_c_to_wasm(n);
});
#endif

// EM_JS(void, vm_compile_c_to_wasm, (int n), {
// Asyncify.handleAsync(async () => {
// await window.vm_compile_c_to_wasm(n);
// })
// });

#if 0
void vm_compile_c_to_wasm(int n);
#endif

#if 0
void vm_compile_c_to_wasm(int n);
#endif
Expand Down Expand Up @@ -91,7 +75,6 @@ void *vm_cache_comp(const char *comp, const char **srcs, const char *entry) {
void *sym = dlsym(handle, entry);
remove(c_file);
remove(so_file);
// dlclose(handle);
printf("<funcptr: %p>\n", sym);
return sym;
}
Expand Down
Loading

0 comments on commit 2c37f9d

Please sign in to comment.