regset->m_val2 = SZ_INT *2;
const Instr push = emit_add_instr(emit, RegPush);
push->m_val = SZ_INT *2;
- const Instr prelude = emit_add_instr(emit, !GET_FLAG(code, builtin) ? FuncUsr : FuncMember);
+ const Instr prelude = emit_add_instr(emit, SetCode);
prelude->m_val2 = 2;
prelude->m_val = SZ_INT;
emit_add_instr(emit, Reg2Mem);
}
ANN static Instr get_prelude(const Emitter emit, const Func f) {
- Instr instr;
const Type t = actual_type(emit->gwion, f->value_ref->type);
- if(!is_fptr(emit->gwion, t))
- instr = emit_add_instr(emit, !GET_FLAG(f, builtin) ? FuncUsr : SetCode);
- else {
+ if(is_fptr(emit->gwion, t)) {
emit_except(emit, t);
if(f->def->base->tmpl)
tmpl_prelude(emit, f);
- instr = emit_add_instr(emit, FuncPtr);
+
}
+ const Instr instr = emit_add_instr(emit, SetCode);
instr->m_val2 = 1;
return instr;
}
ANN Type_List tlnext(const Gwi gwi, const m_str s, size_t split) {
char curr[split+1];
- strncpy(curr, s, split);
+ memcpy(curr, s, split);
curr[split] = '\0';
const Type_List tl = _str2tl(gwi, curr);
tl->next = str2tl(gwi, s + split + 1);
const m_str base = ck->name;
char str[strlen(base) + 1];
const m_str c = strchr(ck->name, '<');
- strncpy(str, base, strlen(base) - (c ? strlen(c) : 0));
+ memcpy(str, base, strlen(base) - (c ? strlen(c) : 0));
str[strlen(base) - (c ? strlen(c) : 0)] = '\0';
ck->name = str;
CHECK_OB((ck->sym = str2sym(gwi, str)))
a.code = *(VM_Code*)(reg-SZ_INT);
funcptr:
PRAGMA_PUSH()
+ reg -= SZ_INT;
+ a.code = *(VM_Code*)reg;
if(!GET_FLAG((VM_Code)a.code, builtin))
goto funcusr;
PRAGMA_POP()
funcmember:
- reg -= SZ_INT;
- a.code = *(VM_Code*)reg;
mem += *(m_uint*)(reg + SZ_INT);
next = eFuncMemberEnd;
goto regpop;
funcusr:
{
- reg -= SZ_INT;
- a.code = *(VM_Code*)reg;
register const m_uint push = *(m_uint*)(reg + SZ_INT) + *(m_uint*)(mem-SZ_INT);
mem += push;
*(m_uint*) mem = push;mem += SZ_INT;