INSTR(DtorReturn);
/* array */
-INSTR(ArrayTop);
INSTR(ArrayBottom);
INSTR(ArrayPost);
INSTR(ArrayInit);
#ifndef __LANG_PRIVATE
#define __LANG_PRIVATE
-ANN m_bool import_int(const Gwi gwi);
-ANN m_bool import_float(const Gwi gwi);
+ANN m_bool import_prim(const Gwi gwi);
ANN m_bool import_complex(const Gwi gwi);
ANN m_bool import_vec3(const Gwi gwi);
ANN m_bool import_vec4(const Gwi gwi);
eBranchNeqFloat,
eDecIntAddr,
eInitLoopCounter,
+ eArrayTop,
eObjectInstantiate,
eRegAddRef,
eObjectAssign,
#define BranchNeqFloat (f_instr)eBranchNeqFloat
#define DecIntAddr (f_instr)eDecIntAddr
#define InitLoopCounter (f_instr)eInitLoopCounter
+#define ArrayTop (f_instr)eArrayTop
#define ObjectInstantiate (f_instr)eObjectInstantiate
#define RegAddRef (f_instr)eRegAddRef
#define ObjectAssign (f_instr)eObjectAssign
BranchNeqFloat
DecIntAddr
InitLoopCounter
+ArrayTop
ObjectInstantiate
RegAddRef
ObjectAssign
info->is_ref = !!is_ref;
} else if(!is_ref) {
const Instr instr = emit_add_instr(emit, ObjectInstantiate);
- instr->m_val = (m_uint)type;
+ instr->m_val2 = (m_uint)type;
emit_pre_ctor(emit, type);
}
return GW_OK;
}
ANN m_bool traverse_dot_tmpl(const Emitter emit, const struct dottmpl_ *dt) {
- const m_uint scope = env_push_type(emit->env, dt->owner);
+ const m_uint scope = emit_push_type(emit, dt->owner);
m_bool ret = GW_ERROR;
if(traverse_func_template(emit->env, dt->def, dt->tl) > 0) {
ret = emit_func_def(emit, dt->def);
nspc_pop_type(emit->env->curr);
}
- env_pop(emit->env, scope);
+ emit_pop(emit, scope);
return ret;
}
return GW_OK;
}
-INSTR(ArrayTop) { GWDEBUG_EXE
- if(*(m_uint*)REG(-SZ_INT * 2) < *(m_uint*)REG(-SZ_INT))
- instantiate_object(shred, (Type)instr->m_val2);
- else
- shred->pc = instr->m_val;
-}
-
INSTR(ArrayBottom) { GWDEBUG_EXE
POP_REG(shred, SZ_INT);
const M_Object obj = *(M_Object*)REG(0);
}
ANN void instantiate_object(const VM_Shred shred, const Type type) {
- const M_Object object = new_object(NULL, type);
+// const M_Object object = new_object(NULL, type);
+ const M_Object object = new_object(shred, type);
*(M_Object*)REG(0) = object;
PUSH_REG(shred, SZ_INT);
}
&&sporkini, &&sporkfunc, &&sporkthis, &&sporkexp, &&sporkend,
&&brancheqint, &&branchneint, &&brancheqfloat, &&branchnefloat,
&&decintaddr, &&initloop,
- &&newobj,
+ &&arraytop, &&newobj,
&&addref, &&assign, &&remref,
&&except, &&allocmemberaddr, &&dotmember, &&dotfloat, &&dotother, &&dotaddr,
&&staticint, &&staticfloat, &&staticother,
reg -= SZ_INT;
(*(m_uint*)instr->m_val) = labs(*(m_int*)reg);
DISPATCH()
+arraytop:
+ if(*(m_uint*)(reg - SZ_INT * 2) < *(m_uint*)(reg-SZ_INT))
+ goto newobj;
+ else
+ goto _goto;
newobj:
- *(M_Object*)reg = new_object(shred, (Type)instr->m_val);
+ *(M_Object*)reg = new_object(shred, (Type)instr->m_val2);
reg += SZ_INT;
DISPATCH()
addref: