Fixed a lazySlot bug where lazy slots in different objects end up pointing to the...
[io/quag.git] / libs / iovm / source / IoState_debug.c
blob5b0b9dfe9d80c09d0f7cc598fe23b2a62b3cd774
1 #include "IoState.h"
2 #include "IoObject.h"
4 void IoState_show(IoState *self)
6 printf("--- state ----------------------------------\n");
7 printf("State:\n");
8 /*
9 printf("black:\n");
10 IoObjectGroup_show(self->blackGroup);
11 printf("\n");
13 printf("gray:\n");
14 IoObjectGroup_show(self->grayGroup);
15 printf("\n");
17 printf("white:\n");
18 IoObjectGroup_show(self->whiteGroup);
19 printf("\n");
21 printf("stacks:\n");
22 printf("\n");
25 IoObject *IoState_replacePerformFunc_with_(IoState *self,
26 IoTagPerformFunc *oldFunc,
27 IoTagPerformFunc *newFunc)
29 PHASH_FOREACH(self->primitives, k, v,
31 IoObject *proto = v;
32 if (IoObject_tag(proto)->performFunc == oldFunc)
34 IoObject_tag(proto)->performFunc = newFunc;
39 return NULL;
42 void IoState_debuggingOn(IoState *self)
44 IoState_replacePerformFunc_with_(self,
45 (IoTagPerformFunc *)IoObject_perform,
46 (IoTagPerformFunc *)IoObject_performWithDebugger);
49 void IoState_debuggingOff(IoState *self)
51 IoState_replacePerformFunc_with_(self,
52 (IoTagPerformFunc *)IoObject_performWithDebugger,
53 (IoTagPerformFunc *)IoObject_perform);
56 int IoState_hasDebuggingCoroutine(IoState *self)
58 return 1; // hack awaiting decision on how to change this
61 void IoState_updateDebuggingMode(IoState *self)
63 if (IoState_hasDebuggingCoroutine(self))
65 IoState_debuggingOn(self);
67 else
69 IoState_debuggingOff(self);