mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Save&restore execution point (pc) in c->cibase->pc; fix #5261
`mrb_fiber_resume()` can be called from C; ref #3056
This commit is contained in:
@@ -231,7 +231,7 @@ fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mr
|
||||
|
||||
if (vmexec) {
|
||||
c->vmexec = TRUE;
|
||||
value = mrb_vm_exec(mrb, c->ci->proc, c->ci->pc);
|
||||
value = mrb_vm_exec(mrb, c->ci->proc, c->cibase->pc);
|
||||
mrb->c = old_c;
|
||||
}
|
||||
else {
|
||||
@@ -357,6 +357,7 @@ mrb_fiber_yield(mrb_state *mrb, mrb_int len, const mrb_value *a)
|
||||
if (c->vmexec) {
|
||||
c->vmexec = FALSE;
|
||||
mrb->c->ci->acc = CI_ACC_RESUMED;
|
||||
c->cibase->pc = c->ci->pc;
|
||||
c->ci--; /* pop callinfo for yield */
|
||||
}
|
||||
MARK_CONTEXT_MODIFY(mrb->c);
|
||||
|
||||
Reference in New Issue
Block a user