1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Update debug code for fibers.

This commit is contained in:
Calvin Rose 2018-03-11 18:06:47 -04:00
parent 807f9818a5
commit 1ba93c5112

View File

@ -612,7 +612,9 @@ static void *op_lookup[255] = {
nextfiber = dst_unwrap_fiber(fiberval); nextfiber = dst_unwrap_fiber(fiberval);
switch (nextfiber->status) { switch (nextfiber->status) {
default: default:
vm_throw("expected pending or new fiber"); vm_throw("expected pending, new, or debug fiber");
case DST_FIBER_DEBUG:
break;
case DST_FIBER_NEW: case DST_FIBER_NEW:
{ {
dst_fiber_push(nextfiber, val); dst_fiber_push(nextfiber, val);
@ -632,16 +634,16 @@ static void *op_lookup[255] = {
retreg = dst_run(nextfiber); retreg = dst_run(nextfiber);
switch (nextfiber->status) { switch (nextfiber->status) {
case DST_FIBER_DEBUG: case DST_FIBER_DEBUG:
if (fiber->flags & DST_FIBER_MASK_DEBUG) goto vm_debug; if (nextfiber->flags & DST_FIBER_MASK_DEBUG) goto vm_debug;
fiber->child = NULL; fiber->child = NULL;
break; break;
case DST_FIBER_ERROR: case DST_FIBER_ERROR:
if (fiber->flags & DST_FIBER_MASK_ERROR) goto vm_error; if (nextfiber->flags & DST_FIBER_MASK_ERROR) goto vm_error;
fiber->child = NULL; fiber->child = NULL;
break; break;
default: default:
fiber->child = NULL; fiber->child = NULL;
if (fiber->flags & DST_FIBER_MASK_RETURN) goto vm_return_root; if (nextfiber->flags & DST_FIBER_MASK_RETURN) goto vm_return_root;
break; break;
} }
stack[oparg(1, 0xFF)] = retreg; stack[oparg(1, 0xFF)] = retreg;
@ -774,7 +776,9 @@ static void *op_lookup[255] = {
Dst dst_resume(DstFiber *fiber, int32_t argn, const Dst *argv) { Dst dst_resume(DstFiber *fiber, int32_t argn, const Dst *argv) {
switch (fiber->status) { switch (fiber->status) {
default: default:
dst_exit("expected new or pending or fiber"); dst_exit("expected new, pending or debug fiber");
case DST_FIBER_DEBUG:
break;
case DST_FIBER_NEW: case DST_FIBER_NEW:
{ {
int32_t i; int32_t i;