Commit 04f8ec75 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #118 from k-tsj/move-stack-values

Move stack values to heap whenever ci is popped
parents e7b4ea94 632556bc
......@@ -126,6 +126,16 @@ cipush(mrb_state *mrb)
static void
cipop(mrb_state *mrb)
{
if (mrb->ci->env) {
struct REnv *e = mrb->ci->env;
int len = (int)e->flags;
mrb_value *p = mrb_malloc(mrb, sizeof(mrb_value)*len);
e->cioff = -1;
memcpy(p, e->stack, sizeof(mrb_value)*len);
e->stack = p;
}
mrb->ci--;
}
......@@ -965,16 +975,6 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
CASE(OP_RETURN) {
/* A return R(A) */
L_RETURN:
if (mrb->ci->env) {
struct REnv *e = mrb->ci->env;
int len = (int)e->flags;
mrb_value *p = mrb_malloc(mrb, sizeof(mrb_value)*len);
e->cioff = -1;
memcpy(p, e->stack, sizeof(mrb_value)*len);
e->stack = p;
}
if (mrb->exc) {
mrb_callinfo *ci;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment