From: fennecdjay Date: Sat, 3 Sep 2022 10:30:34 +0000 (+0200) Subject: :art: update _flow X-Git-Tag: nightly~264^2~6 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=06eb3692dc34c37c5f57bb82c8b85a37b5858443;p=gwion.git :art: update _flow --- diff --git a/include/emit.h b/include/emit.h index 819506f8..46c3dfbf 100644 --- a/include/emit.h +++ b/include/emit.h @@ -95,11 +95,12 @@ ANN static inline Instr emit_compound_addref(const Emitter emit, const Type t, : emit_struct_addref(emit, t, size, emit_var); } -ANN static inline bool is_static_call(const Exp e) { +ANN static inline bool is_static_call(const Emitter emit, const Exp e) { if (e->exp_type != ae_exp_dot) return true; const Exp_Dot *member = &e->d.exp_dot; return GET_FLAG(e->type, final) || GET_FLAG(member->base->type, final) || + is_class(emit->gwion, member->base->type) || // GET_FLAG(e->type->info->func, static) || member->base->exp_type == ae_exp_cast; } diff --git a/src/emit/emit.c b/src/emit/emit.c index 774e479a..be54af17 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1317,7 +1317,7 @@ ANN static m_bool _emit_exp_call(const Emitter emit, const Exp_Call *exp_call) { CHECK_BB(emit_func_args(emit, exp_call)); if (is_func(emit->gwion, t)) // is_callable needs type CHECK_BB(emit_exp_call1(emit, t->info->func, - is_static_call(exp_call->func))); + is_static_call(emit, exp_call->func))); else { struct Op_Import opi = {.op = insert_symbol("@ctor"), .rhs = t, @@ -1487,8 +1487,7 @@ ANN static void tmpl_prelude(const Emitter emit, const Func f) { ANN static Instr get_prelude(const Emitter emit, const Func f, const bool is_static) { - if (f != emit->env->func || (!is_static && strcmp(s_name(f->def->base->xid), "new")) /* || -// strstr(emit->code->name, "ork~")*/) { + if (f != emit->env->func || (!is_static && strcmp(s_name(f->def->base->xid), "new"))) { const Instr instr = emit_add_instr(emit, SetCode); instr->udata.one = 1; return instr; @@ -1816,19 +1815,18 @@ ANN static m_bool emit_implicit_cast(const Emitter emit, return op_emit(emit, &opi); } -ANN2(1,2) static Instr _flow(const Emitter emit, const Exp e, Instr *const instr, const bool b) { -// CHECK_BO(emit_exp_pop_next(emit, e)); +ANN2(1,2) static Instr _flow(const Emitter emit, const Exp e, Instr *const instr, /*const */bool b) { CHECK_BO(emit_exp(emit, e)); { const Instr ex = (Instr)vector_back(&emit->code->instr); - if(ex->execute == fast_except) { + if(ex->opcode == eOP_MAX && ex->execute == fast_except) { vector_rem(&emit->code->instr, vector_size(&emit->code->instr) - 1); free_instr(emit->gwion, ex); } } + if(instr) *instr = emit_add_instr(emit, NoOp); -// emit_exp_addref1(emit, e, -exp_size(e)); // ???? struct Op_Import opi = { .op = insert_symbol(b ? "@conditional" : "@unconditional"), .rhs = e->type, diff --git a/src/lib/object_op.c b/src/lib/object_op.c index 542abd6f..3f61a2db 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -147,7 +147,7 @@ ANN static void emit_member_func(const Emitter emit, const Exp_Dot *member) { instr->m_val = (m_uint)f; return; } - } else if (is_static_call(exp_self(member))) { + } else if (is_static_call(emit, exp_self(member))) { if (member->is_call && f == emit->env->func) return; const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc); func_i->m_val = (m_uint)f->code ?: (m_uint)f;