instr->m_val2 = strlen(c);
return GW_OK;
}
+if(vector_size(&emit->code->instr)) {
const Instr instr = (Instr)vector_back(&emit->code->instr);
instr->opcode = eRegPushImm;
instr->m_val = (m_uint)f->code;
+}
return GW_OK;
}
} else if((f->value_ref->owner_class && is_special(f->value_ref->owner_class) > 0) ||
!f->value_ref->owner_class || GET_FLAG(f, template))
push_func_code(emit, f);
- else {
+ 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)
back->m_val = f->vt_index;
ANN2(1,2) static void emit_exp_spork_finish(const Emitter emit, const VM_Code code,
const m_uint depth) {
- const m_uint member = GET_FLAG(code, member) ? SZ_INT : 0;
const Instr pop = emit_add_instr(emit, RegPop);
- pop->m_val = depth + member;// + emit->code->stack_depth;
- if(depth) {
- const Instr spork = emit_add_instr(emit, SporkFunc);
- spork->m_val = depth;
- }
- if(member) {
- const Instr m = emit_add_instr(emit, SporkThis);
- m->m_val = depth;
- }
+ pop->m_val = depth;
+ const Instr spork = emit_add_instr(emit, SporkFunc);
+ spork->m_val = depth + SZ_INT;
}
static inline void stack_alloc(const Emitter emit) {
ANN static m_bool spork_func(const Emitter emit, const Exp_Call* exp) { GWDEBUG_EXE
if(GET_FLAG(exp->m_func, member))
SET_FLAG(emit->code, member);
- return emit_exp_call(emit, exp);
+ return emit_exp_call1(emit, exp->m_func);
}
ANN m_bool emit_exp_spork(const Emitter emit, const Exp_Unary* unary) {
spork->m_val = emit->code->stack_depth;
} else {
const Func f = unary->exp->d.exp_call.m_func;
- const m_uint size = f->def->stack_depth - (GET_FLAG(f, member) ? SZ_INT : 0);
+ const m_uint size = f->def->stack_depth - (GET_FLAG(f, member) && !GET_FLAG(code, member) ? SZ_INT : 0);
emit_exp_spork_finish(emit, code, size);
const Instr end = emit_add_instr(emit, is_spork ? SporkEnd : ForkEnd);
- end->m_val2 = unary->exp->d.exp_call.m_func->def->base->ret_type->size;
+ end->m_val2 = f->def->base->ret_type->size;
}
return GW_OK;
}
&&timeadv,
&&setcode, &&funcptr, &&funcmember,
&&funcusr, &®pop, &®push, &®tomem, &&overflow, &&next, &&funcusrend, &&funcmemberend,
- &&sporkini, &&sporkini, &&sporkfunc, &&sporkthis, &&sporkexp, &&forkend, &&sporkend,
+ &&sporkini, &&sporkini, &&sporkfunc, &&sporkexp, &&forkend, &&sporkend,
&&brancheqint, &&branchneint, &&brancheqfloat, &&branchnefloat,
&&arrayappend, &&autoloop, &&autoloopptr, &&autoloopcount, &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&arrayvalid,
&&newobj, &&addref, &&assign, &&remref,
*(m_uint*)(a.child->reg + i) = *(m_uint*)(reg + i - SZ_INT);
a.child->reg += instr->m_val;
DISPATCH()
-sporkthis:
- *(M_Object*)a.child->reg = *(M_Object*)(reg -SZ_INT + instr->m_val);
- a.child->reg += SZ_INT;
- DISPATCH()
sporkexp:
// LOOP_OPTIM
for(m_uint i = 0; i < instr->m_val; i+= SZ_INT)