typedef struct Local_ {
Type type;
m_uint offset;
+ uint skip;
} Local;
static inline void emit_pop(const Emitter emit, const m_uint scope) { env_pop(emit->env, scope); }
return local;
}
-ANN static m_uint frame_local(MemPool p, Frame* frame, const Type t) {
+ANN static m_uint frame_local(MemPool p, Frame* frame, const Type t, const uint skip) {
Local* local = new_local(p, t);
local->offset = frame->curr_offset;
+ local->skip = skip;
frame->curr_offset += t->size;
vector_add(&frame->stack, (vtype)local);
return local->offset;
Frame *frame = emit->code->frame;
DECL_OB(const Local*, l, = (Local*)vector_pop(&frame->stack))
frame->curr_offset -= l->type->size;
+ if(l->skip)
+ return frame_pop(emit);
if(tflag(l->type, tflag_struct)) {
struct_pop(emit, l->type, l->offset);
return frame_pop(emit);
}
ANN m_uint emit_local(const Emitter emit, const Type t) {
- return frame_local(emit->gwion->mp, emit->code->frame, t);
+ return frame_local(emit->gwion->mp, emit->code->frame, t, 0);
+}
+
+ANN m_uint emit_localn(const Emitter emit, const Type t) {
+ return frame_local(emit->gwion->mp, emit->code->frame, t, 1);
}
ANN void emit_ext_ctor(const Emitter emit, const Type t);
ANN static m_bool emit_func_args(const Emitter emit, const Exp_Call* exp_call) {
if(exp_call->args) {
CHECK_BB(emit_exp(emit, exp_call->args))
- emit_exp_addref(emit, exp_call->args, -exp_totalsize(exp_call->args));
+// emit_exp_addref(emit, exp_call->args, -exp_totalsize(exp_call->args));
}
const Type t = actual_type(emit->gwion, exp_call->func->type);
if(isa(t, emit->gwion->type[et_function]) > 0 &&
do {
const Type type = a->var_decl->value->type;
emit->code->stack_depth += type->size;
- a->var_decl->value->from->offset = emit_local(emit, type);
+ a->var_decl->value->from->offset = emit_localn(emit, type);
} while((a = a->next));
}
for(i = index; i < (m_int)len; i++)
c[i + len_insert] = str[i];
c[len + len_insert] = '\0';
- release(arg, shred);
*(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
}
const m_uint len = strlen(str);
len_insert = strlen(insert);
if(index >= (m_int)len || index < 0 || (index + len_insert + 1) <= 0) {
- release(arg, shred);
*(M_Object*)RETURN = NULL;
return;
}
for(i = 0; i < len_insert; i++)
c[i + index] = insert[i];
c[index + len_insert] = '\0';
- release(arg, shred);
*(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
}
for(i = index + _len; i < (m_int)len; i++)
c[i] = str[i];
c[len + _len - 1] = '\0';
- release(arg, shred);
*(M_Object*)RETURN = new_string(shred->info->vm->gwion->mp, shred, c);;
}
*(m_uint*)RETURN = str ? str - base : -1;
} else
*(m_uint*)RETURN = -1;
- release(obj, shred);
}
static MFUN(string_findStrStart) {
*(m_uint*)RETURN = str ? str - pos- base : -1;
} else
*(m_uint*)RETURN = -1;
- release(obj, shred);
}
static MFUN(string_rfind) {
*(m_uint*)RETURN = str ? str - base : -1;
} else
*(m_uint*)RETURN = -1;
- release(obj, shred);
}
static MFUN(string_rfindStrStart) {
*(m_uint*)RETURN = str ? str - pos - base : -1;
} else
*(m_uint*)RETURN = -1;
- release(obj, shred);
}
static MFUN(string_erase) {