1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 15:43:01 +00:00

Proper re-entry into debug state nested fibers.

This commit is contained in:
Calvin Rose
2018-05-16 09:24:34 -04:00
parent 6ac59251e9
commit 0fd9224e4a
3 changed files with 38 additions and 9 deletions

View File

@@ -41,7 +41,7 @@ Dst dst_run(DstFiber *fiber) {
/* Save old fiber to reset */
DstFiber *old_vm_fiber = dst_vm_fiber;
/* VM state */
/* interpreter state */
register Dst *stack;
register uint32_t *pc;
register DstFunction *func;
@@ -731,8 +731,6 @@ static void *op_lookup[255] = {
switch (nextfiber->status) {
default:
vm_throw("expected pending, new, or debug fiber");
case DST_FIBER_DEBUG:
break;
case DST_FIBER_NEW:
{
dst_fiber_push(nextfiber, val);
@@ -740,11 +738,21 @@ static void *op_lookup[255] = {
nextfiber->flags &= ~DST_FIBER_FLAG_NEW;
break;
}
case DST_FIBER_DEBUG:
{
if (!nextfiber->child) {
DstStackFrame *nextframe = dst_fiber_frame(nextfiber);
nextframe->pc++;
}
break;
}
case DST_FIBER_PENDING:
{
DstStackFrame *nextframe = dst_fiber_frame(nextfiber);
nextfiber->data[nextfiber->frame + ((*nextframe->pc >> 8) & 0xFF)] = val;
nextframe->pc++;
if (!nextfiber->child) {
DstStackFrame *nextframe = dst_fiber_frame(nextfiber);
nextfiber->data[nextfiber->frame + ((*nextframe->pc >> 8) & 0xFF)] = val;
nextframe->pc++;
}
break;
}
}