From 409658781b81e6dd895063f38b3d9e3b0b84613e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 14 Sep 2020 12:21:13 +0200 Subject: [PATCH] :art: Rewrite class_parent --- src/import/cdef.c | 7 ++++--- src/main.c | 5 ++++- src/vm/vm.c | 3 ++- util | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/import/cdef.c b/src/import/cdef.c index 32b62f49..4419336f 100644 --- a/src/import/cdef.c +++ b/src/import/cdef.c @@ -27,11 +27,12 @@ ANN static m_bool mk_xtor(MemPool p, const Type type, const m_uint d, const ae_f } ANN2(1,2) static inline m_bool class_parent(const Env env, Type t) { - while(t && !GET_FLAG(t, valid)) { + do { + if(GET_FLAG(t, valid)) + break; if(t->e->def) CHECK_BB(traverse_class_def(env, t->e->def)) - t = t->e->parent; - } + } while((t = t->e->parent)); return GW_OK; } diff --git a/src/main.c b/src/main.c index f21c0921..130ae98c 100644 --- a/src/main.c +++ b/src/main.c @@ -42,5 +42,8 @@ int main(int argc, char** argv) { if(ini > 0) gwion_run(&gwion); gwion_end(&gwion); - THREAD_RETURN(EXIT_SUCCESS); +#ifndef BUILD_ON_WINDOWS + pthread_exit(NULL); +#endif + return EXIT_SUCCESS; } diff --git a/src/vm/vm.c b/src/vm/vm.c index b967991a..cab5a91c 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -275,7 +275,8 @@ _Pragma(STRINGIFY(COMPILER diagnostic ignored UNINITIALIZED) #define VM_OUT shred->code = code; shred->reg = reg; shred->mem = mem; shred->pc = PC; -__attribute__ ((hot, optimize("-O2"))) +__attribute__ ((hot)) +CC_OPTIM(-O2) ANN void vm_run(const VM* vm) { // lgtm [cpp/use-of-goto] static const void* dispatch[] = { &®setimm, diff --git a/util b/util index 6a4d0ad7..01599165 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit 6a4d0ad780438022192c2b8e1c129c85e6b897e5 +Subproject commit 01599165dac235c3e2e048c3525054a5d8dd556e -- 2.43.0