eObjectInstantiate,
eRegAddRef,
eObjectAssign,
+ eAssign,
eObjectRelease,
eGWOP_EXCEPT,
eAllocMember4,
#define ObjectInstantiate (f_instr)eObjectInstantiate
#define RegAddRef (f_instr)eRegAddRef
#define ObjectAssign (f_instr)eObjectAssign
+#define Assign (f_instr)eAssign
#define ObjectRelease (f_instr)eObjectRelease
#define GWOP_EXCEPT (f_instr)eGWOP_EXCEPT
#define AllocMember4 (f_instr)eAllocMember4
emit->code = (Code*)vector_back(&emit->stack);
CHECK_BB(emit_instantiate_object(emit, v->type, var_decl->array, is_ref))
CHECK_BB(emit_dot_static_data(emit, v, 1))
- emit_add_instr(emit, ObjectAssign);
+ emit_add_instr(emit, Assign);
emit->code = code;
return GW_OK;
}
instr->m_val = v->offset;
instr->m_val2 = v->type->size;
if(is_obj && (is_array || !is_ref)) {
- const Instr assign = emit_add_instr(emit, ObjectAssign);
+ const Instr assign = emit_add_instr(emit, Assign);
assign->m_val = emit_var;
const size_t missing_depth = type->array_depth - (array ? array->depth : 0);
if((is_array || missing_depth) && !emit->env->scope->depth)
instr->m_val = (m_uint)v->d.ptr;
instr->m_val2 = v->type->size;
if(is_obj && (is_array || !is_ref)) {
- const Instr assign = emit_add_instr(emit, ObjectAssign);
+ const Instr assign = emit_add_instr(emit, Assign);
assign->m_val = emit_var;
if(is_array && !emit->env->scope->depth)
ADD_REF(type)
&&sporkini, &&sporkini, &&sporkfunc, &&sporkexp, &&forkend, &&sporkend,
&&brancheqint, &&branchneint, &&brancheqfloat, &&branchnefloat,
&&arrayappend, &&autoloop, &&autoloopptr, &&autoloopcount, &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&arrayvalid,
- &&newobj, &&addref, &&assign, &&remref,
+ &&newobj, &&addref, &&objassign, &&assign, &&remref,
&&except, &&allocmemberaddr, &&dotmember, &&dotfloat, &&dotother, &&dotaddr,
&&staticint, &&staticfloat, &&staticother,
&&dotfunc, &&dotstaticfunc, &&staticcode, &&pushstr,
reg += instr->m_val2;
DISPATCH()
allocaddr:
- *(m_uint*)(mem+instr->m_val) = 0; // just set object to null in
*(m_bit**)reg = mem + instr->m_val;
reg += SZ_INT;
DISPATCH()
*(M_Object*)(reg-SZ_INT)))
++a.obj->ref;
DISPATCH()
-assign:
- reg -= SZ_INT;
- a.obj = *(M_Object*)(reg-SZ_INT);
- const M_Object tgt = **(M_Object**)reg;
+objassign:
+{
+ const M_Object tgt = **(M_Object**)(reg -SZ_INT);
if(tgt) {
--tgt->ref;
_release(tgt, shred);
- }
+}
+assign:
+ reg -= SZ_INT;
+ a.obj = *(M_Object*)(reg-SZ_INT);
**(M_Object**)reg = a.obj;
DISPATCH()
+}
remref:
release(*(M_Object*)(mem + instr->m_val), shred);
DISPATCH()