eReg2Mem,
eReg2Mem4,
e_staticmemcpy_,
+ e_staticmemset_,
eOverflow,
eFuncUsrEnd,
eFuncUsrEnd2,
#define Reg2Mem (f_instr)eReg2Mem
#define Reg2Mem4 (f_instr)eReg2Mem4
#define _staticmemcpy_ (f_instr)e_staticmemcpy_
+#define _staticmemset_ (f_instr)e_staticmemset_
#define Overflow (f_instr)eOverflow
#define FuncUsrEnd (f_instr)eFuncUsrEnd
#define FuncUsrEnd2 (f_instr)eFuncUsrEnd2
gw_out("{Y}┃{0}{-}% 4lu{0}: _staticmemcpy_", j);
gw_out("\n");
break;
+ case e_staticmemset_:
+ gw_out("{Y}┃{0}{-}% 4lu{0}: _staticmemset_", j);
+ gw_out("\n");
+ break;
case eOverflow:
gw_out("{Y}┃{0}{-}% 4lu{0}: Overflow ", j);
gw_out("\n");
vector_add(&frame->defer, (vtype)NULL);
}
-static const f_instr allocmember[] = {RegPushImm, RegPushImm2, RegPushImm3,
+static const f_instr allocmember[4] = {RegPushImm, RegPushImm2, _staticmemset_,
DotMemberMem4};
-static const f_instr allocword[] = {AllocWord, AllocWord2, AllocWord3,
+static const f_instr allocword[4] = {AllocWord, AllocWord2, AllocWord3,
RegPushMem4};
ANN static m_bool emit_class_def(const Emitter, const Class_Def);
if (GET_FLAG(v, late)) // ref or emit_var ?
emit_memsetimm(emit, v->from->offset, 0);
}
- if(!(safe_tflag(emit->env->class_def, tflag_struct) && !emit->env->scope->depth))
- emit_kind(emit, v->from->offset, v->type->size, !struct_ctor(v) ? emit_addr : true,
+ if(!(safe_tflag(emit->env->class_def, tflag_struct) && !emit->env->scope->depth)) {
+ const Instr instr = emit_kind(emit, v->from->offset, v->type->size, !struct_ctor(v) ? emit_addr : true,
exec);
+ // we want to push a zero
+ if(vflag(v, vflag_member) && !emit_addr)
+ instr->m_val = 0;
+ }
else emit_struct_decl(emit, v, !struct_ctor(v) ? emit_addr : 1);
if (is_obj && !is_ref && !exp_self(decl)->ref) {
if (!emit_var)
#define IVAL (*(m_int *)(byte + SZ_INT))
#define FVAL (*(m_float *)(byte + SZ_INT))
#define VAL2 (*(m_uint *)(byte + SZ_INT + SZ_INT))
-#define IVAL2 (*(m_int *)(byte + SZ_INT + SZ_INT))
+#define IVAL2 (*(m_int *)(byte + SZ_INT + SZ_INT))
#define SVAL (*(uint16_t *)(byte + SZ_INT + SZ_INT))
#define SVAL2 (*(uint16_t *)(byte + SZ_INT + SZ_INT + sizeof(uint16_t)))
&&fimul, &&fidiv, &&fiand, &&fior, &&fieq, &&fine, &&figt, &&fige, &&filt,
&&file, &&firassign, &&firadd, &&firsub, &&firmul, &&firdiv, &&itof,
&&ftoi, &&timeadv, &&recurs, &&setcode, &®move,
- &®tomem, &®tomemother, &&staticmemcpy,
+ &®tomem, &®tomemother, &&staticmemcpy, &&staticmemset,
&&overflow,
&&funcusrend, &&funcusrend2, &&funcmemberend,
&&sporkini, &&forkini, &&sporkfunc, &&sporkexp, &&sporkcode,
staticmemcpy:
memcpy((void*)VAL, reg, VAL2);
DISPATCH()
+ staticmemset:
+ memset(reg, VAL2, VAL);
+ reg += VAL;
+ DISPATCH()
overflow:
if (overflow_(mem + VAL2, shred)) {
handle(shred, "StackOverflow");
reg += SZ_INT;
DISPATCH()
dotmembermem2:
- *(m_float *)(reg + SZ_INT) =
+ *(m_float *)reg =
*(m_float *)((*(M_Object *)(mem + VAL2))->data + VAL);
- reg += SZ_INT - SZ_FLOAT;
+ reg += SZ_FLOAT;
DISPATCH()
// dotmembermem3:
dotmembermem4:
&&_fimul, &&_fidiv, &&_fiand, &&_fior, &&_fieq, &&_fine, &&_figt, &&_fige, &&_filt,
&&_file, &&_firassign, &&_firadd, &&_firsub, &&_firmul, &&_firdiv, &&_itof,
&&_ftoi, &&_timeadv, &&_recurs, &&_setcode, &&_regmove,
- &&_regtomem, &&_regtomemother, &&_staticmemcpy,
+ &&_regtomem, &&_regtomemother, &&_staticmemcpy, &&_staticmemset,
&&_overflow,
&&_funcusrend, &&_funcusrend2, &&_funcmemberend,
&&_sporkini, &&_forkini, &&_sporkfunc, &&_sporkexp, &&_sporkcode, &&_forkend,
PREPARE(regtomem);
PREPARE(regtomemother);
PREPARE(staticmemcpy);
+ PREPARE(staticmemset);
PREPARE(overflow);
PREPARE(funcusrend);
PREPARE(funcusrend2);