instr->m_val = (m_uint)f;
}
}
+
+ANN static inline void emit_pushimm(const Emitter emit, const m_uint value) {
+ const Instr instr = emit_add_instr(emit, RegPushImm);
+ instr->m_val = value;
+}
#endif
ANN static m_bool spork_prepare_code(const Emitter emit,
const struct Sporker *sp) {
- emit_add_instr(emit, RegPushImm);
+ emit_pushimm(emit, 0);
push_spork_code(emit, sp->is_spork ? SPORK_CODE_PREFIX : FORK_CODE_PREFIX,
sp->pos);
if (emit->env->class_def) stack_alloc(emit);
struct Implicit *impl = (struct Implicit *)data;
if(!impl->e->type->info->func->code)
emit_ensure_func(emit, impl->e->type->info->func);
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = (m_uint)impl->e->type->info->func->code;
+ emit_pushimm(emit, (m_uint)impl->e->type->info->func->code);
return emit_fptr_assign(emit, impl->e->type, impl->t);
}
ANN static m_bool emit_dict_iter(const Emitter emit, const HMapInfo *hinfo,
const struct Op_Import *opi, const Exp call, const Exp exp) {
- const Instr room_for_tombstone = emit_add_instr(emit, RegPushImm);
- room_for_tombstone->m_val = -1;
+ emit_pushimm(emit, -1); // room for tombstone
CHECK_BB(emit_exp(emit, call));
const m_uint pc = emit_code_size(emit);
const Instr iter = emit_add_instr(emit, hmap_iter);
static OP_EMIT(opem_implicit_class) {
struct Implicit *imp = (struct Implicit*)data;
const Type t = actual_type(emit->gwion, imp->e->type);
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = map_size(&t->nspc->info->value->map);
+ emit_pushimm(emit, map_size(&t->nspc->info->value->map));
return GW_OK; emit_exp(emit, imp->e);
}
else {
if(vflag(f->value_ref, vflag_member))
emit_regmove(emit, -SZ_INT);
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = (m_uint)f;
+ emit_pushimm(emit, (m_uint)f);
return;
}
} else if (is_static_call(emit->gwion, exp_self(member))) {
ensure_emit(emit, t_base);
}
if (is_class(emit->gwion, value->type)) {
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = (m_uint)value->type;
+ emit_pushimm(emit, (m_uint)value->type);
return GW_OK;
}
if (tflag(t_base, tflag_struct) && !GET_FLAG(value, static)) {
emit_struct_data(emit, value, exp_getvar(exp_self(member)));
} else if (GET_FLAG(value, static))
emit_dot_static_import_data(emit, value, exp_getvar(exp_self(member)));
- else { // member type
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = (m_uint)value->type;
- }
+ else emit_pushimm(emit, (m_uint)value->type);
if(isa(value->type, emit->gwion->type[et_object]) > 0 &&
!exp_getvar(exp_self(member)) &&
(GET_FLAG(value, static) || GET_FLAG(value, late)))
const Map map = &member->base->type->nspc->info->value->map;
CHECK_BB(emit_exp(emit, member->base));
if (is_func(emit->gwion, exp_self(member)->type)) { // is_callable? can only be a func
- const Instr instr = emit_add_instr(emit, RegPushImm);
- instr->m_val = (m_uint)exp_self(member)->type->info->func->code;
+ emit_pushimm(emit, (m_uint)exp_self(member)->type->info->func->code);
return GW_OK;
}
if (!strcmp(s_name(member->xid), "index")) {