From: Jérémie Astor Date: Wed, 16 Jun 2021 17:28:18 +0000 (+0200) Subject: :art: Fix global class checking X-Git-Tag: nightly~584 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=288d36bcb77169dd6d59685ae2db8dea56bfa296;p=gwion.git :art: Fix global class checking --- diff --git a/include/vm.h b/include/vm.h index ab824db1..1735c550 100644 --- a/include/vm.h +++ b/include/vm.h @@ -117,7 +117,7 @@ ANEW ANN VM_Shred new_shred_base(const VM_Shred, const VM_Code code) __attribute__((hot)); __attribute__((hot)) ANN static inline void vm_shred_exit(const VM_Shred shred) { - shreduler_remove(shred->info->vm->shreduler, shred, true); + shreduler_remove(shred->tick->shreduler, shred, true); } void free_vm_shred(const VM_Shred shred) __attribute__((hot, nonnull)); diff --git a/src/emit/emit.c b/src/emit/emit.c index 42d650ca..480c4081 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2732,17 +2732,18 @@ ANN static m_bool cdef_parent(const Emitter emit, const Class_Def cdef) { ANN static m_bool emit_class_def(const Emitter emit, const Class_Def cdef) { if (tmpl_base(cdef->base.tmpl)) return GW_OK; const Type t = cdef->base.type; + const Class_Def c = t->info->cdef; if (tflag(t, tflag_emit)) return GW_OK; set_tflag(t, tflag_emit); const Type owner = t->info->value->from->owner_class; if (owner) CHECK_BB(ensure_emit(emit, owner)); - if (cdef->base.ext && t->info->parent->info->cdef && + if (c->base.ext && t->info->parent->info->cdef && !tflag(t->info->parent, tflag_emit)) // ????? - CHECK_BB(cdef_parent(emit, cdef)); + CHECK_BB(cdef_parent(emit, c)); nspc_allocdata(emit->gwion->mp, t->nspc); - if (cdef->body) { + if (c->body) { emit_class_code(emit, t->name); - if (scanx_body(emit->env, cdef, (_exp_func)emit_section, emit) > 0) + if (scanx_body(emit->env, c, (_exp_func)emit_section, emit) > 0) t->nspc->pre_ctor = finalyze(emit, FuncReturn); else { free_code(emit->gwion->mp, emit->code); diff --git a/src/parse/check.c b/src/parse/check.c index 39aa16a5..e13cca4f 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1789,16 +1789,17 @@ ANN static m_bool _check_class_def(const Env env, const Class_Def cdef) { ANN m_bool check_class_def(const Env env, const Class_Def cdef) { if (tmpl_base(cdef->base.tmpl)) return GW_OK; const Type t = cdef->base.type; + const Class_Def c = t->info->cdef; struct Op_Import opi = {.op = insert_symbol("@class_check"), .lhs = t, - .data = (uintptr_t)cdef, - .pos = cdef->pos}; + .data = (uintptr_t)c, + .pos = c->pos}; CHECK_OB(op_check(env, &opi)); if (t->info->value->from->owner_class) CHECK_BB(ensure_check(env, t->info->value->from->owner_class)); if (tflag(t, tflag_check)) return GW_OK; set_tflag(t, tflag_check); - return _check_class_def(env, cdef); + return _check_class_def(env, c); } ANN static inline void check_unhandled(const Env env) { diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 63fd2aab..4ee0a60a 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -686,12 +686,13 @@ ANN static m_bool cdef_parent(const Env env, const Class_Def cdef) { ANN m_bool scan1_class_def(const Env env, const Class_Def cdef) { if (tmpl_base(cdef->base.tmpl)) return GW_OK; const Type t = cdef->base.type; + const Class_Def c = t->info->cdef; if (tflag(t, tflag_scan1)) return GW_OK; set_tflag(t, tflag_scan1); if (t->info->value->from->owner_class) CHECK_BB(ensure_scan1(env, t->info->value->from->owner_class)); - if (cdef->base.ext) CHECK_BB(cdef_parent(env, cdef)); - if (cdef->body) CHECK_BB(env_body(env, cdef, scan1_section)); + if (c->base.ext) CHECK_BB(cdef_parent(env, c)); + if (c->body) CHECK_BB(env_body(env, c, scan1_section)); return GW_OK; } diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 38f99a9b..932329a8 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -580,12 +580,13 @@ ANN static m_bool cdef_parent(const Env env, const Class_Def cdef) { ANN m_bool scan2_class_def(const Env env, const Class_Def cdef) { if (tmpl_base(cdef->base.tmpl)) return GW_OK; const Type t = cdef->base.type; + const Class_Def c = t->info->cdef; if (tflag(t, tflag_scan2)) return GW_OK; if (t->info->value->from->owner_class) CHECK_BB(ensure_scan2(env, t->info->value->from->owner_class)); set_tflag(t, tflag_scan2); - if (cdef->base.ext) CHECK_BB(cdef_parent(env, cdef)); - if (cdef->body) CHECK_BB(env_body(env, cdef, scan2_section)); + if (c->base.ext) CHECK_BB(cdef_parent(env, c)); + if (c->body) CHECK_BB(env_body(env, c, scan2_section)); return GW_OK; }