const Func f = exp_self(member)->type->e->d.func;
if(is_class(emit->gwion, member->t_base) || GET_FLAG(member->base->type, force)) {
const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : PushStaticCode);
- if(f->code)
- func_i->m_val = (m_uint)(f->code ?: (VM_Code)f);
+ func_i->m_val = (m_uint)f->code;
return GW_OK;
}
if(f->def->base->tmpl)
void vm_remove(const VM* vm, const m_uint index) {
const Vector v = (Vector)&vm->shreduler->shreds;
LOOP_OPTIM
- for(m_uint i = vector_size(v) + 1; i--;) {
+ for(m_uint i = vector_size(v) + 1; --i;) {
const VM_Shred sh = (VM_Shred)vector_at(v, i - 1);
- if(sh->tick->xid == index)
+ if(sh && sh->tick->xid == index)
Except(sh, "MsgRemove");
}
}
m_bit *ptr = _mp_malloc(p, sz * BYTECODE_SZ);
for(m_uint i= 0; i < sz; ++i) {
const Instr instr = (Instr)vector_at(v, i);
- if(instr->opcode == ePushStaticCode) {
- if(!instr->m_val) {
- instr->opcode = eRegPushImm;
- instr->m_val = (m_uint)code;
- } else {
- const Func f = (Func)instr->m_val;
- if(f->code) {
- instr->opcode = eRegSetImm;
- instr->m_val = (m_uint)((Func)instr->m_val)->code;
- instr->m_val2 = -SZ_INT;
- }
- }
+ if(instr->opcode == ePushStaticCode && !instr->m_val) {
+ instr->opcode = eRegPushImm;
+ instr->m_val = (m_uint)code;
}
if(instr->opcode < eGack)
memcpy(ptr + i*BYTECODE_SZ, instr, BYTECODE_SZ);