instr->m_val = i;
}
+ANN static inline void emit_pushfunc(const Emitter emit, const Func f) {
+ if(f->code) {
+ const Instr instr = emit_add_instr(emit, RegPushImm);
+ instr->m_val = (m_uint)f->code;
+ } else {
+ const Instr instr = emit_add_instr(emit, SetFunc);
+ instr->m_val = (m_uint)f;
+ }
+}
#endif
const Func f = exp_self(member)->type->info->func;
if(!strcmp(s_name(f->def->base->xid), "new")) {
- if(f != emit->env->func) {
- const Instr instr = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
- instr->m_val = (m_uint)f->code ?: (m_uint)f;
- }
+ if(f != emit->env->func) emit_pushfunc(emit, f);
return;
}
if (f->def->base->tmpl) {
}
} else if (is_static_call(emit->gwion, exp_self(member))) {
if (member->is_call && f == emit->env->func && strcmp(s_name(f->def->base->xid), "new")) return;
- const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
- func_i->m_val = (m_uint)f->code ?: (m_uint)f;
- return;
+ return emit_pushfunc(emit, f);
} else {
- if (tflag(member->base->type, tflag_struct)) {
- const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
- func_i->m_val = (m_uint)f->code ?: (m_uint)f;
- return;
- }
+ if (tflag(member->base->type, tflag_struct))
+ return emit_pushfunc(emit, f);
const Instr instr = emit_add_instr(emit, DotFunc);
instr->m_val = f->def->vt_index;
if (!vflag(f->value_ref, vflag_member))
ANN static m_bool handle_instr(const Emitter emit, const M_Operator *mo) {
if (mo->func) {
- const Instr push =
- emit_add_instr(emit, mo->func->code ? RegPushImm : SetFunc);
- push->m_val = ((m_uint)mo->func->code ?: (m_uint)mo->func);
+ emit_pushfunc(emit, mo->func);
CHECK_BB(emit_exp_call1(emit, mo->func, true));
if (mo->func->def->base->xid ==
insert_symbol(emit->gwion->st, "@conditional"))