From aa3ad2ae2997e91741511d0561c6c79665a1a29e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 3 Jun 2021 18:35:13 +0200 Subject: [PATCH] :art: Update --- ast | 2 +- include/opcode.h | 2 -- opcode.txt | 1 - src/env/type.c | 4 +++- src/lib/array.c | 4 ++-- src/parse/check.c | 3 ++- src/vm/vm.c | 7 +------ 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ast b/ast index b1fe9221..269c5307 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit b1fe9221196f766a5b3d11f6021340d747cab95c +Subproject commit 269c530719fc73ae9427a01b379b184f2596911e diff --git a/include/opcode.h b/include/opcode.h index f7343533..7eec1cff 100644 --- a/include/opcode.h +++ b/include/opcode.h @@ -152,7 +152,6 @@ enum { eArrayAccess, eArrayGet, eArrayAddr, - eArrayValid, eObjectInstantiate, eRegAddRef, eRegAddRefAddr, @@ -352,7 +351,6 @@ enum { #define ArrayAccess (f_instr)eArrayAccess #define ArrayGet (f_instr)eArrayGet #define ArrayAddr (f_instr)eArrayAddr -#define ArrayValid (f_instr)eArrayValid #define ObjectInstantiate (f_instr)eObjectInstantiate #define RegAddRef (f_instr)eRegAddRef #define RegAddRefAddr (f_instr)eRegAddRefAddr diff --git a/opcode.txt b/opcode.txt index efce167a..cbb5d5d7 100644 --- a/opcode.txt +++ b/opcode.txt @@ -149,7 +149,6 @@ ArrayTop ArrayAccess ArrayGet ArrayAddr -ArrayValid ObjectInstantiate RegAddRef RegAddRefAddr diff --git a/src/env/type.c b/src/env/type.c index 547f2fef..24b8a7a9 100644 --- a/src/env/type.c +++ b/src/env/type.c @@ -16,9 +16,11 @@ ANN void free_type(const Type a, struct Gwion_ *const gwion) { if(freeable(a)) { if(tflag(a, tflag_udef)) free_union_def(gwion->mp, a->info->udef); - if(tflag(a, tflag_cdef)) + else if(tflag(a, tflag_cdef)) class_def_cleaner(gwion, a->info->cdef); } + if(a->effects.ptr) + vector_release(&a->effects); if(a->nspc) nspc_remref(a->nspc, gwion); if(a->info->tuple) diff --git a/src/lib/array.c b/src/lib/array.c index 8a6697de..1d273753 100644 --- a/src/lib/array.c +++ b/src/lib/array.c @@ -326,13 +326,13 @@ ANN static void array_finish(const Emitter emit, const m_uint depth, const m_uint size, const m_bool is_var) { const Instr get = emit_add_instr(emit, is_var ? ArrayAddr : ArrayGet); get->m_val = depth * SZ_INT; - emit_add_instr(emit, ArrayValid); +// emit_add_instr(emit, ArrayValid); const Instr push = emit_add_instr(emit, RegMove); push->m_val = is_var ? SZ_INT : size; } ANN static inline m_bool array_do(const Emitter emit, const Array_Sub array, const m_bool is_var) { - emit_gc(emit, -SZ_INT); +// emit_gc(emit, -SZ_INT); CHECK_BB(emit_exp(emit, array->exp)); array_loop(emit, array->depth); array_finish(emit, array->depth, array->type->size, is_var); diff --git a/src/parse/check.c b/src/parse/check.c index 5a2ff50e..63d9b558 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1709,7 +1709,8 @@ ANN static m_bool _check_class_def(const Env env, const Class_Def cdef) { env_err(env, v->from->loc, _("recursive type")); env->context->error = false; env_err(env, value->from->loc, _("recursive type")); - env->context->error = true; + env->context->error = true; +type_remref(t, env->gwion); return GW_ERROR; } } diff --git a/src/vm/vm.c b/src/vm/vm.c index ba830d1f..deaff7b4 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -406,7 +406,7 @@ ANN void vm_run(const VM* vm) { // lgtm [cpp/use-of-goto] &®move, &®tomem, &®tomemother, &&overflow, &&funcusrend, &&funcmemberend, &&sporkini, &&forkini, &&sporkfunc, &&sporkmemberfptr, &&sporkexp, &&sporkend, &&brancheqint, &&branchneint, &&brancheqfloat, &&branchnefloat, &&unroll, - &&arrayappend, &&autounrollinit, &&autoloop, &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&arrayvalid, + &&arrayappend, &&autounrollinit, &&autoloop, &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&newobj, &&addref, &&addrefaddr, &&structaddref, &&structaddrefaddr, &&objassign, &&assign, &&remref, &&except, &&allocmemberaddr, &&dotmember, &&dotfloat, &&dotother, &&dotaddr, &&unioncheck, &&unionint, &&unionfloat, &&unionother, &&unionaddr, @@ -855,11 +855,6 @@ PRAGMA_PUSH() *(m_bit**)(reg + (m_int)VAL2) = m_vector_addr(ARRAY(a.obj), *(m_int*)(reg + VAL)); PRAGMA_POP() DISPATCH() -arrayvalid: -// are we sure it is the array ? -// rather increase ref - vector_pop(&shred->gc); - DISPATCH() newobj: *(M_Object*)reg = new_object(vm->gwion->mp, NULL, (Type)VAL2); reg += SZ_INT; -- 2.43.0