Skip to content

Commit 0c907e2

Browse files
author
Patrick Soquet
committed
XS: fuzzilli 107
1 parent 4edfa3f commit 0c907e2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

xs/sources/xsModule.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ enum {
139139
static void fxReportModuleQueue(txMachine* the, txSlot* queue, txString label)
140140
{
141141
txSlot* module = queue->next;
142-
fprintf(stderr, "%s", label);
142+
fprintf(stderr, "%s %p", label, queue);
143143
while (module) {
144-
fprintf(stderr, " %s %d", fxGetKeyName(the, module->ID), mxModuleStatus(module));
144+
fprintf(stderr, " '%s' %p %d", fxGetKeyName(the, module->ID), module->value.reference, mxModuleStatus(module));
145145
module = module->next;
146146
}
147147
fprintf(stderr, "\n");
@@ -2190,6 +2190,7 @@ void fxRunImportNow(txMachine* the, txSlot* realm, txID moduleID)
21902190
txSlot* result = stack;
21912191
txSlot* queue = fxNewInstance(the);
21922192
mxTry(the) {
2193+
txBoolean done = 1;
21932194
result->kind = module->kind;
21942195
result->value = module->value;
21952196

@@ -2220,6 +2221,7 @@ void fxRunImportNow(txMachine* the, txSlot* realm, txID moduleID)
22202221
txSlot* internal = mxModuleInternal(module);
22212222
moduleID = internal->value.module.id;
22222223
realm = internal->value.module.realm;
2224+
done = 0;
22232225
mxModuleStatus(module) = XS_MODULE_STATUS_LOADING;
22242226
mxPushUndefined();
22252227
mxPushSlot(loadNowHook);
@@ -2231,18 +2233,23 @@ void fxRunImportNow(txMachine* the, txSlot* realm, txID moduleID)
22312233
mxPop(); // descriptor
22322234
}
22332235
}
2234-
mxReportModuleQueue("LOAD");
2235-
module = queue->next;
2236+
module = queue;
2237+
done = 1;
2238+
mxReportModuleQueue("LOAD");
2239+
}
2240+
else if (mxModuleStatus(module) == XS_MODULE_STATUS_LOADING) {
2241+
done = 0;
22362242
}
22372243
else if (mxModuleStatus(module) == XS_MODULE_STATUS_LOADED) {
22382244
fxLoadModulesFrom(the, queue, module->value.reference, 1);
22392245
mxModuleStatus(module) = XS_MODULE_STATUS_LINKING;
2240-
mxReportModuleQueue("LOAD");
2241-
module = queue->next;
2246+
module = queue;
2247+
done = 1;
22422248
}
2243-
else
2244-
module = module->next;
2249+
module = module->next;
22452250
}
2251+
if (!done)
2252+
mxTypeError("async queue");
22462253
fxLinkModules(the, queue);
22472254
mxReportModuleQueue("INIT");
22482255
module = queue->next;

0 commit comments

Comments
 (0)