From: Jérémie Astor Date: Sun, 15 Dec 2019 11:50:10 +0000 (+0100) Subject: :art: Improve gwion_cleaner X-Git-Tag: nightly~1988 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=4748a030f2ff6e336249656a2bd0ff9077275c1d;p=gwion.git :art: Improve gwion_cleaner --- diff --git a/include/vm.h b/include/vm.h index ac1925f2..cd7d7a10 100644 --- a/include/vm.h +++ b/include/vm.h @@ -81,6 +81,7 @@ ANN void vm_lock(VM const*); ANN void vm_unlock(VM const*); ANN m_bool vm_running(VM const*); ANN void free_vm(VM* vm); +ANN void vm_ini_shred(const VM* vm, const VM_Shred shred)__attribute__((hot)); ANN void vm_add_shred(const VM* vm, const VM_Shred shred)__attribute__((hot)); ANN void vm_remove(const VM* vm, const m_uint index)__attribute__((hot)); ANN m_str code_name_set(MemPool p, const m_str, const m_str); diff --git a/src/gwion.c b/src/gwion.c index c6f48a57..84986050 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -44,11 +44,9 @@ ANN static inline void gwion_compile(const Gwion gwion, const Vector v) { } ANN static void gwion_cleaner(const Gwion gwion) { - if(!gwion->type[et_shred]) - return; const VM_Code code = new_vm_code(gwion->mp, NULL, 0, ae_flag_builtin, "in code dtor"); gwion->vm->cleaner_shred = new_vm_shred(gwion->mp, code); - vm_add_shred(gwion->vm, gwion->vm->cleaner_shred); + vm_ini_shred(gwion->vm, gwion->vm->cleaner_shred); } ANN VM* gwion_cpy(const VM* src) { @@ -77,6 +75,7 @@ ANN static m_bool gwion_ok(const Gwion gwion, Arg* arg) { gwion->data->plug = new_pluginfo(gwion->mp, &arg->lib); shreduler_set_loop(gwion->vm->shreduler, arg->loop); if(gwion_audio(gwion) > 0 && gwion_engine(gwion)) { + gwion_cleaner(gwion); plug_run(gwion, &arg->mod); gwion_compile(gwion, &arg->add); return GW_OK; @@ -127,7 +126,6 @@ ANN void gwion_end_child(const VM_Shred shred, const Gwion gwion) { } ANN void gwion_end(const Gwion gwion) { - gwion_cleaner(gwion); gwion_end_child(gwion->vm->cleaner_shred, gwion); free_env(gwion->env); if(gwion->vm->cleaner_shred)