Merge branch 'issue-201'

This commit is contained in:
Yuichi Nishiwaki 2014-09-01 08:52:18 +09:00
commit b96d6fb0d4
2 changed files with 15 additions and 3 deletions

View File

@ -113,9 +113,12 @@ native_stack_length(pic_state *pic, char **pos)
static void
save_cont(pic_state *pic, struct pic_cont **c)
{
void pic_vm_tear_off(pic_state *);
struct pic_cont *cont;
char *pos;
pic_vm_tear_off(pic); /* tear off */
cont = *c = (struct pic_cont *)pic_obj_alloc(pic, sizeof(struct pic_cont), PIC_TT_CONT);
cont->blk = pic->blk;
@ -163,13 +166,10 @@ native_stack_extend(pic_state *pic, struct pic_cont *cont)
noreturn static void
restore_cont(pic_state *pic, struct pic_cont *cont)
{
void pic_vm_tear_off(pic_state *);
char v;
struct pic_cont *tmp = cont;
struct pic_block *blk;
pic_vm_tear_off(pic); /* tear off */
if (&v < pic->native_stack_start) {
if (&v > cont->stk_pos) native_stack_extend(pic, cont);
}

View File

@ -668,10 +668,22 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
NEXT;
}
CASE(OP_LREF) {
pic_callinfo *ci = pic->ci;
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
PUSH(ci->env->regs[c.u.i - (ci->regs - ci->fp)]);
NEXT;
}
PUSH(pic->ci->fp[c.u.i]);
NEXT;
}
CASE(OP_LSET) {
pic_callinfo *ci = pic->ci;
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
ci->env->regs[c.u.i - (ci->regs - ci->fp)] = POP();
NEXT;
}
pic->ci->fp[c.u.i] = POP();
NEXT;
}