-Subproject commit 2b7ad3f0e5b241640e7be0576332e3fec0296662
+Subproject commit 2814d30169430cb2b1bff740b1a806736b11238a
struct M_Object_ {
m_bit* data;
Type type_ref;
- Vector vtable;
+ struct Vector_ vtable;
volatile size_t ref;
};
eUpvalueOther,
eUpvalueAddr,
eDotFunc,
- eDotStaticFunc,
eGcIni,
eGcAdd,
eGcEnd,
#define UpvalueOther (f_instr)eUpvalueOther
#define UpvalueAddr (f_instr)eUpvalueAddr
#define DotFunc (f_instr)eDotFunc
-#define DotStaticFunc (f_instr)eDotStaticFunc
#define GcIni (f_instr)eGcIni
#define GcAdd (f_instr)eGcAdd
#define GcEnd (f_instr)eGcEnd
UpvalueOther
UpvalueAddr
DotFunc
-DotStaticFunc
GcIni
GcAdd
GcEnd
push_func_code(emit, f);
else if(vector_size(&emit->code->instr)) {
const Instr back = (Instr)vector_back(&emit->code->instr);
- if((f_instr)(m_uint)back->opcode == DotFunc || (f_instr)(m_uint)back->opcode == DotStaticFunc)
+ if((f_instr)(m_uint)back->opcode == DotFunc)
back->m_val = f->vt_index;
}
if(vector_size(&emit->code->instr) && vflag(f->value_ref, vflag_member) &&
return CASE_PASS;
}
}
- } else if(isa(actual_type(emit->gwion, base->type), emit->gwion->type[et_union]) > 0 && e->exp_type == ae_exp_call) {
+ } else if(isa(base->type, emit->gwion->type[et_union]) > 0 && e->exp_type == ae_exp_call) {
const Exp func = e->d.exp_call.func;
if(func->d.prim.prim_type == ae_prim_id) {
- const Map map = &actual_type(emit->gwion, base->type)->nspc->info->value->map;
+ const Map map = &base->type->nspc->info->value->map;
for(m_uint i = 0; i < map_size(map); ++i) {
if(VKEY(map, i) == (m_uint)func->d.prim.d.var) {
const Value v = (Value)VVAL(map, i);
a->ref = 1;
a->type_ref = t;
if(t->nspc) {
- a->vtable = &t->nspc->info->vtable;
+ a->vtable.ptr = t->nspc->info->vtable.ptr;
if(t->nspc->info->offset)
a->data = (m_bit*)_mp_calloc(p, t->nspc->info->offset);
}
func_i->m_val = (m_uint)f->code ?: (m_uint)f;
return;
}
- const Instr instr = emit_add_instr(emit, vflag(f->value_ref, vflag_member) ? DotFunc : DotStaticFunc);
+ const Instr instr = emit_add_instr(emit, DotFunc);
instr->m_val = f->vt_index;
+ if(!vflag(f->value_ref, vflag_member))
+ instr->m_val2 = -SZ_INT;
+ else {
+ const Instr instr = emit_add_instr(emit, RegMove);
+ instr->m_val = SZ_INT;
+ }
}
return;
}
return NULL;
}
}
- } else if(isa(actual_type(env->gwion, base), env->gwion->type[et_union]) > 0 && e->exp_type == ae_exp_call) {
+ } else if(isa(base, env->gwion->type[et_union]) > 0 && e->exp_type == ae_exp_call) {
const Exp func = e->d.exp_call.func;
if(func->d.prim.prim_type == ae_prim_id) {
- const Value v= find_value(actual_type(env->gwion, base), func->d.prim.d.var);
+ const Value v= find_value(base, func->d.prim.d.var);
if(v) {
e->type = v->type;
case_op(env, v->type, e->d.exp_call.args);
&&unioncheck, &&unionint, &&unionfloat, &&unionother, &&unionaddr,
&&staticint, &&staticfloat, &&staticother,
&&upvalueint, &&upvaluefloat, &&upvalueother, &&upvalueaddr,
- &&dotfunc, &&dotstaticfunc,
+ &&dotfunc,
&&gcini, &&gcadd, &&gcend,
&&gacktype, &&gackend, &&gack, &&noop, &&eoc, &&other, &®pushimm
};
reg += SZ_INT;
DISPATCH()
dotfunc:
-PRAGMA_PUSH()
- *(VM_Code*)(reg) = ((Func)vector_at((*(M_Object*)(reg-SZ_INT))->vtable, VAL))->code;
- reg += SZ_INT;
-PRAGMA_POP()
- DISPATCH()
-dotstaticfunc:
-PRAGMA_PUSH()
- *(VM_Code*)(reg-SZ_INT) = ((Func)vector_at((*(M_Object*)(reg-SZ_INT))->vtable, VAL))->code;
-PRAGMA_POP()
+ *(VM_Code*)(reg+(m_uint)VAL2) = ((Func)(*(M_Object*)(reg-SZ_INT))->vtable.ptr[OFFSET + VAL])->code;
DISPATCH()
gcini:
vector_add(&shred->gc, 0);