summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-07-27 10:05:47 +0900
committerYukihiro Matsumoto <[email protected]>2012-07-27 10:05:47 +0900
commit638a66fd7801624a47858d4e8e3927ca69a52f00 (patch)
tree70ae884cd866b72f016da397024a528ea317959f
parent92d37403f162c6876e60247114bc982d00d14aa2 (diff)
downloadmruby-638a66fd7801624a47858d4e8e3927ca69a52f00.tar.gz
mruby-638a66fd7801624a47858d4e8e3927ca69a52f00.zip
adjust ci->nregs for C implemented methods
-rw-r--r--src/gc.c2
-rw-r--r--src/vm.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gc.c b/src/gc.c
index c0d4e1599..1468dd994 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -545,6 +545,8 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
obj->tt = MRB_TT_FREE;
}
+#include <stdio.h>
+
static void
root_scan_phase(mrb_state *mrb)
{
diff --git a/src/vm.c b/src/vm.c
index 62ef5069d..9aa21eed4 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -121,7 +121,6 @@ uvset(mrb_state *mrb, int up, int idx, mrb_value v)
static mrb_callinfo*
cipush(mrb_state *mrb)
{
- size_t nregs = mrb->ci->nregs;
int eidx = mrb->ci->eidx;
int ridx = mrb->ci->ridx;
@@ -133,7 +132,7 @@ cipush(mrb_state *mrb)
mrb->ciend = mrb->cibase + size * 2;
}
mrb->ci++;
- mrb->ci->nregs = nregs;
+ mrb->ci->nregs = 0;
mrb->ci->eidx = eidx;
mrb->ci->ridx = ridx;
mrb->ci->env = 0;
@@ -719,6 +718,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
mrb->stack += a;
if (MRB_PROC_CFUNC_P(m)) {
+ ci->nregs = n + 1;
mrb->stack[0] = m->body.func(mrb, recv);
mrb->arena_idx = ai;
if (mrb->exc) goto L_RAISE;