From 6b374739b1c19348628263c83bdc677f45381b14 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 11 Feb 2021 11:28:19 +0100 Subject: [PATCH] :art: Update --- include/vm.h | 1 + src/parse/check.c | 5 +++-- src/plug.c | 10 +++++++++- src/vm/vm.c | 2 +- src/vm/vm_code.c | 9 +++------ util | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/include/vm.h b/include/vm.h index 156a6b52..9da8493c 100644 --- a/include/vm.h +++ b/include/vm.h @@ -23,6 +23,7 @@ struct VM_Code_ { uint16_t ref; ae_flag flag; int builtin; + int callback; }; typedef struct Shreduler_* Shreduler; diff --git a/src/parse/check.c b/src/parse/check.c index af106694..b630281d 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -436,7 +436,8 @@ ANN2(1,2) static Func find_func_match_actual(const Env env, Func func, const Exp return func; CHECK_OO(func->next); return find_func_match_actual(env, func->next, args, implicit, specific); - } + } else if(!e->type) //fix bug found with Cytosol + return NULL; if(e1->type == env->gwion->type[et_auto] || (func->def->base->tmpl && is_fptr(env->gwion, func->value_ref->type) > 0)) { const Type owner = func->value_ref->from->owner_class; @@ -515,7 +516,7 @@ next_arg(Arg_List) ANN static void print_current_args(Exp e) { gw_err(_("and not\n ")); - do gw_err(" \033[32m%s\033[0m", e->type->name); + do gw_err(" \033[32m%s\033[0m", e->type ? e->type->name : "Unknown"); while((e = next_arg_Exp(e))); gw_err("\n"); } diff --git a/src/plug.c b/src/plug.c index 2d811c92..42800aed 100644 --- a/src/plug.c +++ b/src/plug.c @@ -151,7 +151,7 @@ ANN static m_bool dependencies(struct Gwion_ *gwion, const Plug plug) { return GW_OK; } -ANN m_bool plugin_ini(struct Gwion_ *gwion, const m_str iname) { +ANN static m_bool _plugin_ini(struct Gwion_ *gwion, const m_str iname) { const Map map = &gwion->data->plug; for(m_uint i = 0; i < map_size(map); ++i) { const Plug plug = (Plug)VVAL(map, i); @@ -181,6 +181,14 @@ ANN m_bool plugin_ini(struct Gwion_ *gwion, const m_str iname) { return GW_ERROR; } +ANN m_bool plugin_ini(struct Gwion_ *gwion, const m_str iname) { + const Context ctx = gwion->env->context; + gwion->env->context = NULL; + const m_bool ret = _plugin_ini(gwion, iname); + gwion->env->context = ctx; + return ret; +} + ANN m_bool driver_ini(const struct Gwion_ *gwion) { const Map map = &gwion->data->plug; m_str dname = gwion->vm->bbq->si->arg; diff --git a/src/vm/vm.c b/src/vm/vm.c index 5133dde7..1789a880 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -122,7 +122,7 @@ ANN static inline m_bool overflow_(const m_bit* mem, const VM_Shred c) { return mem > (((m_bit*)c + sizeof(struct VM_Shred_) + SIZEOF_REG) + (SIZEOF_MEM) - (MEM_STEP*16)); } -ANN static inline VM_Shred init_spork_shred(const VM_Shred shred, const VM_Code code) { +ANN /*static inline */VM_Shred init_spork_shred(const VM_Shred shred, const VM_Code code) { const VM_Shred sh = new_shred_base(shred, code); vm_add_shred(shred->info->vm, sh); sh->tick->parent = shred->tick; diff --git a/src/vm/vm_code.c b/src/vm/vm_code.c index 30d38ff6..e30fbe00 100644 --- a/src/vm/vm_code.c +++ b/src/vm/vm_code.c @@ -21,17 +21,14 @@ ANN void free_code_instr(const Vector v, const Gwion gwion) { } } -ANN static void _free_code_instr(const Vector v, const Gwion gwion) { - free_code_instr(v, gwion); - free_vector(gwion->mp, v); -} - ANN void free_vmcode(VM_Code a, Gwion gwion) { if(a->memoize) memoize_end(gwion->mp, a->memoize); if(!a->builtin) { _mp_free(gwion->mp, vector_size(a->instr) * BYTECODE_SZ, a->bytecode); - _free_code_instr(a->instr, gwion); + if(likely(!a->callback)) + free_code_instr(a->instr, gwion); + free_vector(gwion->mp, a->instr); } if(a->closure) free_closure(a->closure, gwion); diff --git a/util b/util index 0696b88c..9da3e2b7 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit 0696b88ce453490a27e449faf4f25a907bef7c46 +Subproject commit 9da3e2b76e09c603f1b84217c9c2432618014a88 -- 2.43.0