const Exp rhs = bin->rhs;
CHECK_BB(emit_exp_pop_next(emit, lhs))
CHECK_BB(emit_exp_pop_next(emit, rhs))
- const m_int size = exp_size(rhs);
- emit_exp_addref1(emit, lhs, -exp_size(lhs) - size);
- emit_exp_addref1(emit, rhs, -size);
+// const m_int size = exp_size(rhs);
+// emit_exp_addref1(emit, lhs, -exp_size(lhs) - size);
+// emit_exp_addref1(emit, rhs, -size);
struct Op_Import opi = { .op=bin->op, .lhs=lhs->type, .rhs=rhs->type,
.pos=exp_self(bin)->pos, .data=(uintptr_t)bin, .op_type=op_binary };
return op_emit(emit, &opi);
struct Op_Import opi = { .op=post->op, .lhs=post->exp->type,
.data=(uintptr_t)post, .op_type=op_postfix };
CHECK_BB(emit_exp(emit, post->exp))
- emit_exp_addref(emit, post->exp, -exp_totalsize(post->exp));
return op_emit(emit, &opi);
}
struct Op_Import opi = { .op=unary->op, .data=(uintptr_t)unary, .op_type=op_unary };
if(unary->unary_type == unary_exp && unary->op != insert_symbol("spork") && unary->op != insert_symbol("fork")) {
CHECK_BB(emit_exp_pop_next(emit, unary->exp))
- emit_exp_addref1(emit, unary->exp, -exp_size(unary->exp));
opi.rhs = unary->exp->type;
}
return op_emit(emit, &opi);
CHECK_BB(emit_exp_func[exp->exp_type](emit, &exp->d))
if(exp->cast_to)
CHECK_BB(emit_implicit_cast(emit, exp, exp->cast_to))
+ if(isa(e->type, emit->gwion->type[et_object]) > 0 &&
+ (e->cast_to ? isa(e->cast_to, emit->gwion->type[et_object]) > 0 : 1) &&
+ e->exp_type == ae_exp_decl && GET_FLAG(e->d.exp_decl.td, late) && !exp_getvar(e)) {
+ const Instr instr = emit_add_instr(emit, GWOP_EXCEPT);
+ instr->m_val = -SZ_INT;
+ }
+
} while((exp = exp->next));
return GW_OK;
}
}
m_bit *data = more->ptr + ARRAY_OFFSET;
memmove(ARRAY_PTR(base) + (len - 1) * sz, data, sz);
- release(obase, shred);
- release(omore, shred);
}
static INSTR(ArrayConcatRight) {
}
memmove(ARRAY_PTR(base) + (ARRAY_LEN(more) + len - 1) * sz, ARRAY_PTR(base), len * sz);
memmove(ARRAY_PTR(base), ARRAY_PTR(more), ARRAY_LEN(more) * sz);
- release(obase, shred);
- release(omore, shred);
}
static OP_EMIT(opem_array_sr) {
return emit_array_shift(emit, ArrayConcatRight);
const Instr pop = emit_add_instr(emit, RegMove);
pop->m_val = -SZ_INT;
- emit_gc(emit, 0);
+ if(isa(bin->rhs->type, emit->gwion->type[et_object]) > 0)
+ emit_add_instr(emit, RegAddRef);
(void)emit_add_instr(emit, ArrayAppendFront);
return GW_OK;
}
return emit_array_shift(emit, ArrayConcatLeft);
const Instr pop = emit_add_instr(emit, RegMove);
pop->m_val = -bin->rhs->type->size;
- emit_gc(emit, -SZ_INT);
+ if(isa(bin->rhs->type, emit->gwion->type[et_object]) > 0){
+ const Instr ref = emit_add_instr(emit, RegAddRef);
+ ref->m_val = -SZ_INT;
+ }
emit_add_instr(emit, ArrayAppend);
return GW_OK;
}
const Vector v = EV_SHREDS(event);
vector_add(v, (vtype)shred);
*(m_int*)REG(-SZ_INT) = 1;
- _release(event, shred);
}
static MFUN(event_signal) {
free_vm_shred(uu->shred);
UGEN(o)->module.gen.tick = usrugen_tick;
const VM_Code code = *(VM_Code*)(shred->reg-offset);
- release(o, shred);
if(!code)
Except(shred, "[NullTickException]");
uu->shred = new_vm_shred(shred->info->vm->gwion->mp, *(VM_Code*)(shred->reg-offset));
const M_Object lhs = *(M_Object*)REG(-SZ_INT); \
const M_Object rhs = *(M_Object*)REG(0); \
*(m_uint*)REG(-SZ_INT) = (lhs op rhs); \
- release(lhs, shred); \
- release(rhs, shred); \
}
describe_logical(Eq, ==)
static OP_EMIT(opem_not_object) {
const Vector v = &emit->code->instr;
- const Instr last = (Instr)vector_pop(v);
- mp_free(emit->gwion->mp, Instr, last);
const Instr back = (Instr)vector_back(v);
if(back->opcode == eGWOP_EXCEPT) {
vector_pop(v);
static INSTR(instr_ptr_assign_obj) {
m_bit **o = *(m_bit***)REG(0);
- release(*(M_Object*)o, shred);
+ //release(*(M_Object*)o, shred);
+ // addref to object?
*o = *(m_bit**)REG(-SZ_INT);
}
const M_Object lhs = *(M_Object*)REG(-SZ_INT); \
const M_Object rhs = *(M_Object*)REG(0); \
*(m_int*)REG(-SZ_INT) = action; \
- release(lhs, shred); \
- release(rhs, shred); \
}
describe_string_logical(eq, (lhs && rhs && STRING(lhs) == STRING(rhs)) || (!lhs && !rhs))
describe_string_logical(neq, !(lhs && rhs && STRING(lhs) == STRING(rhs)) || (!lhs && !rhs))
describe_connect(Disc,vector_rem2)
ANN static void release_connect(const VM_Shred shred) {
- _release(*(M_Object*)REG(0), shred);
- _release(*(M_Object*)REG(SZ_INT), shred);
*(M_Object*)REG(0) = *(M_Object*)REG(SZ_INT);
PUSH_REG(shred, SZ_INT);
}
{
const M_Object o = **(M_Object**)(reg -SZ_INT);
if(o) {
- --o->ref;
_release(o, shred);
}
+ ++(*(M_Object*)(reg -SZ_INT*2))->ref;
}
assign:
reg -= SZ_INT;