Merge branch 'issue-201'
This commit is contained in:
commit
b96d6fb0d4
|
@ -113,9 +113,12 @@ native_stack_length(pic_state *pic, char **pos)
|
||||||
static void
|
static void
|
||||||
save_cont(pic_state *pic, struct pic_cont **c)
|
save_cont(pic_state *pic, struct pic_cont **c)
|
||||||
{
|
{
|
||||||
|
void pic_vm_tear_off(pic_state *);
|
||||||
struct pic_cont *cont;
|
struct pic_cont *cont;
|
||||||
char *pos;
|
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 = *c = (struct pic_cont *)pic_obj_alloc(pic, sizeof(struct pic_cont), PIC_TT_CONT);
|
||||||
|
|
||||||
cont->blk = pic->blk;
|
cont->blk = pic->blk;
|
||||||
|
@ -163,13 +166,10 @@ native_stack_extend(pic_state *pic, struct pic_cont *cont)
|
||||||
noreturn static void
|
noreturn static void
|
||||||
restore_cont(pic_state *pic, struct pic_cont *cont)
|
restore_cont(pic_state *pic, struct pic_cont *cont)
|
||||||
{
|
{
|
||||||
void pic_vm_tear_off(pic_state *);
|
|
||||||
char v;
|
char v;
|
||||||
struct pic_cont *tmp = cont;
|
struct pic_cont *tmp = cont;
|
||||||
struct pic_block *blk;
|
struct pic_block *blk;
|
||||||
|
|
||||||
pic_vm_tear_off(pic); /* tear off */
|
|
||||||
|
|
||||||
if (&v < pic->native_stack_start) {
|
if (&v < pic->native_stack_start) {
|
||||||
if (&v > cont->stk_pos) native_stack_extend(pic, cont);
|
if (&v > cont->stk_pos) native_stack_extend(pic, cont);
|
||||||
}
|
}
|
||||||
|
|
12
src/vm.c
12
src/vm.c
|
@ -668,10 +668,22 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
CASE(OP_LREF) {
|
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]);
|
PUSH(pic->ci->fp[c.u.i]);
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
CASE(OP_LSET) {
|
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();
|
pic->ci->fp[c.u.i] = POP();
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue