MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxCreateMachine

Function fxCreateMachine

xs/sources/xsAPI.c:1397–1564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1395const txByte gxNoCode[3] ICACHE_FLASH_ATTR = { XS_CODE_BEGIN_STRICT, 0, XS_CODE_END };
1396
1397txMachine* fxCreateMachine(txCreation* theCreation, txString theName, void* theContext, txID profileID)
1398{
1399 txMachine* the = (txMachine* )c_calloc(1, sizeof(txMachine));
1400 if (the) {
1401 txJump aJump;
1402
1403 aJump.nextJump = C_NULL;
1404 aJump.stack = C_NULL;
1405 aJump.scope = C_NULL;
1406 aJump.frame = C_NULL;
1407 aJump.code = C_NULL;
1408 aJump.flag = 0;
1409 the->firstJump = &aJump;
1410 if (c_setjmp(aJump.buffer) == 0) {
1411 txInteger id;
1412 txSlot* slot;
1413
1414 if (gxDefaults.initializeSharedCluster)
1415 gxDefaults.initializeSharedCluster(the);
1416
1417 the->context = theContext;
1418 fxCreateMachinePlatform(the);
1419
1420 #ifdef mxDebug
1421 the->name = theName;
1422 #endif
1423 the->profileID = (profileID != XS_NO_ID) ? profileID : mxBaseProfileID;
1424 fxAllocate(the, theCreation);
1425
1426 c_memset(the->nameTable, 0, the->nameModulo * sizeof(txSlot *));
1427 c_memset(the->symbolTable, 0, the->symbolModulo * sizeof(txSlot *));
1428
1429 /* mxGlobal */
1430 mxPushUndefined();
1431 /* mxException */
1432 mxPushUndefined();
1433 /* mxProgram */
1434 mxPushNull();
1435 fxNewProgramInstance(the);
1436 /* mxHosts */
1437 mxPushUndefined();
1438 /* mxModuleQueue */
1439 fxNewInstance(the);
1440 /* mxUnhandledPromises */
1441 fxNewInstance(the);
1442 /* mxDuringJobs */
1443 fxNewInstance(the);
1444 /* mxFinalizationRegistries */
1445 fxNewInstance(the);
1446 /* mxPendingJobs */
1447 fxNewInstance(the);
1448 /* mxRunningJobs */
1449 fxNewInstance(the);
1450 /* mxBreakpoints */
1451 mxPushList();
1452 /* mxHostInspectors */
1453 mxPushList();
1454 /* mxInstanceInspectors */

Callers 1

mainFunction · 0.85

Calls 15

fxAllocateFunction · 0.85
fxNewProgramInstanceFunction · 0.85
fxNewInstanceFunction · 0.85
fxBuildGlobalFunction · 0.85
fxBuildObjectFunction · 0.85
fxBuildFunctionFunction · 0.85
fxBuildGeneratorFunction · 0.85
fxBuildArgumentsFunction · 0.85
fxBuildArrayFunction · 0.85
fxBuildStringFunction · 0.85
fxBuildBooleanFunction · 0.85
fxBuildNumberFunction · 0.85

Tested by

no test coverage detected