size_t scope = emit_push(emit, v->owner_class, v->owner);
CHECK_BB(emit_func_def(emit, f->def)) // orig
emit_pop(emit, scope);
-if(!v->owner_class) {
-/* no need for dynamicity */
-//assert(instr->opcode != MemSetImm);
-//assert(instr->opcode == RegPushBase);
-} // else push_tmpl_func
return push_func_code(emit, f);
}
if(!f->code || (GET_FLAG(f, ref) && !GET_FLAG(f, builtin))) {
if(GET_FLAG(f, template) && emit->env->func != f)
CHECK_BB(emit_template_code(emit, f))
- }
-else if(
-(f->value_ref->owner_class && is_special(f->value_ref->owner_class) > 0) ||
-
-!f->value_ref->owner_class || GET_FLAG(f, template)
-|| (f->value_ref->owner_class && GET_FLAG(f->def, op))
-)
+ } else if((f->value_ref->owner_class && is_special(f->value_ref->owner_class) > 0) ||
+ !f->value_ref->owner_class || GET_FLAG(f, template))
push_func_code(emit, f);
const Instr offset = emit_add_instr(emit, RegPushImm);
offset->m_val = emit_code_offset(emit);
ANN static m_bool spork_code(const Emitter emit, const Stmt stmt) { GWDEBUG_EXE
emit_add_instr(emit, RegPushImm);
push_spork_code(emit, SPORK_CODE_PREFIX, stmt->pos);
-// if(emit->env->class_def && !SAFE_FLAG(emit->env->func, static))
if(!SAFE_FLAG(emit->env->func, member))
stack_alloc_this(emit);
CHECK_BB(scoped_stmt(emit, stmt, 0))
ANN static Instr emit_flow(const Emitter emit, const Type type,
const f_instr f1, const f_instr f2) { GWDEBUG_EXE
if(isa(type, t_float) > 0) {
-// emit_add_instr(emit, RegPushImm2);
return emit_add_instr(emit, f2);
}
-// emit_add_instr(emit, RegPushImm);
return emit_add_instr(emit, f1);
}
const Instr deref = emit_add_instr(emit, DotStatic);
deref->m_val = (m_uint)counter;
deref->m_val2 = SZ_INT;
-// emit_add_instr(emit, RegPushImm);
const Instr op = emit_add_instr(emit, BranchEqInt);
const Instr dec = emit_add_instr(emit, DecIntAddr);
dec->m_val = (m_uint)counter;
CHECK_BB(emit_exp(emit, stmt->val, 0))
const Instr instr = emit_add_instr(emit, BranchSwitch);
instr->m_val2 = (m_uint)switch_map(emit->env);
-// CHECK_BB(scoped_stmt(emit, stmt->stmt, 1))
CHECK_BB(emit_stmt(emit, stmt->stmt, 1))
instr->m_val = switch_idx(emit->env) ?: emit_code_size(emit);
if(push) {
exp->d.exp_decl.type = stmt->value->type;
var_decl->value = stmt->value;
CHECK_BB(emit_exp_decl(emit, &exp->d.exp_decl))
-// if(!emit->env->class_def)
-// ADD_REF(stmt->value->type);
free_exp(exp);
if(global) {
const M_Object o = new_object(NULL, stmt->value->type);
ANN static inline void emit_func_def_global(const Emitter emit, const Value value) { GWDEBUG_EXE
const Instr set_mem = emit_add_instr(emit, MemSetImm);
- set_mem->m_val = value->offset = emit_local(emit, value->type->size, 0); // size -> SZ_INT ?
+ set_mem->m_val = value->offset = emit_local(emit, SZ_INT, 0);
set_mem->m_val2 = (m_uint)value->d.func_ref->code;
}
reg += SZ_FLOAT;
DISPATCH();
regpushother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val2; i+= SZ_INT)
*(m_bit**)(reg+i) = (m_bit*)(instr->m_val + i);
reg += instr->m_val2;
reg += SZ_FLOAT;
DISPATCH();
regpushmemother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val2; i+= SZ_INT)
*(m_uint*)(reg+i) = *(m_uint*)((mem + instr->m_val) + i);
reg += instr->m_val2;
reg += SZ_FLOAT;
DISPATCH();
baseother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val2; i+= SZ_INT)
*(m_uint*)(reg+i) = *(m_uint*)((shred->base + instr->m_val) + i);
reg += instr->m_val2;
reg += SZ_FLOAT;
DISPATCH()
allocother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val; i += SZ_INT)
*(m_uint*)(reg+i) = (*(m_uint*)(mem+instr->m_val+i) = 0);
reg += instr->m_val2;
stack_depth -= SZ_INT;
}
reg-=code->stack_depth;
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i < stack_depth; i+= SZ_INT)
*(m_uint*)(mem+i+f) = *(m_uint*)(reg+i);
}
register const m_uint depth = stack_depth -SZ_INT;
reg -= stack_depth;
*(m_uint*)m = *(m_uint*)(reg + depth);
-// for(m_uint i = 0; i < stack_depth; i+= SZ_INT)
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i < depth; i+= SZ_INT)
*(m_uint*)(m+i+SZ_INT) = *(m_uint*)(reg+i);
if(overflow_(m, shred))
register const m_uint stack_depth = a.code->stack_depth;
if(stack_depth) {
reg -= stack_depth;
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i < stack_depth; i+= SZ_INT)
*(m_uint*)(m+i) = *(m_uint*)(reg+i);
}
a.child = init_spork_shred(shred, (VM_Code)instr->m_val);
DISPATCH()
sporkfunc:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i < instr->m_val; i+= SZ_INT)
*(m_uint*)(a.child->reg + i) = *(m_uint*)(reg + i - SZ_INT);
a.child->reg += instr->m_val;
a.child->reg += SZ_INT;
DISPATCH()
sporkexp:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i < instr->m_val; i+= SZ_INT)
*(m_uint*)(a.child->mem + i) = *(m_uint*)(mem+i);
DISPATCH()
reg += SZ_FLOAT - SZ_INT;
DISPATCH()
dotother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val2; i += SZ_INT)
*(m_uint*)(reg+i-SZ_INT) = *(m_uint*)((a.obj->data + instr->m_val) + i);
reg += instr->m_val2 - SZ_INT;
reg += SZ_FLOAT;
DISPATCH()
staticother:
- LOOP_OPTIM
+// LOOP_OPTIM
for(m_uint i = 0; i <= instr->m_val2; i += SZ_INT)
*(m_uint*)(reg+i) = *(m_uint*)(instr->m_val + i);
reg += instr->m_val2;