ANN static void emit_func_arg_vararg(const Emitter emit, const Exp_Call* exp_call) {
const Instr instr = emit_add_instr(emit, VarargIni);
const Vector kinds = new_vector(emit->gwion->mp);
- if((instr->m_val = round2szint(vararg_size(exp_call, kinds))))
+ if((instr->m_val = vararg_size(exp_call, kinds)))
instr->m_val2 = (m_uint)kinds;
else {
instr->opcode = eRegPushImm;
INSTR(VarargMember) {
const struct Vararg_* arg = *(struct Vararg_**)MEM(instr->m_val);
+ if(instr->m_val2 != arg->k[arg->i]) { // TODO: differnciate object and primitives
+ free_vararg(shred->info->mp, arg);
+ Except(shred, "InvalidVariadicAccess");
+ }
for(m_uint i = 0; i < instr->m_val2; i += SZ_INT)
*(m_uint*)REG(i) = *(m_uint*)(arg->d + arg->o + i);
PUSH_REG(shred, instr->m_val2);