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

Function fxCloneMachine

xs/sources/xsAPI.c:1615–1738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1613
1614#if mxAliasInstance
1615txMachine* fxCloneMachine(txCreation* theCreation, txMachine* theMachine, txString theName, void* theContext)
1616{
1617 txMachine* the = (txMachine *)c_calloc(1, sizeof(txMachine));
1618 if (the) {
1619 txJump aJump;
1620
1621 aJump.nextJump = C_NULL;
1622 aJump.stack = C_NULL;
1623 aJump.scope = C_NULL;
1624 aJump.frame = C_NULL;
1625 aJump.code = C_NULL;
1626 aJump.flag = 0;
1627 the->firstJump = &aJump;
1628 if (c_setjmp(aJump.buffer) == 0) {
1629 txSlot* sharedSlot;
1630 txSlot* slot;
1631
1632 if (gxDefaults.initializeSharedCluster)
1633 gxDefaults.initializeSharedCluster(the);
1634
1635 the->preparation = theMachine->preparation;
1636 the->context = theContext;
1637 the->sharedMachine = theMachine;
1638 fxCreateMachinePlatform(the);
1639
1640 #ifdef mxDebug
1641 the->name = theName;
1642 #endif
1643 the->profileID = theMachine->profileID;
1644 fxAllocate(the, theCreation);
1645
1646 c_memcpy(the->nameTable, theMachine->nameTable, the->nameModulo * sizeof(txSlot *));
1647 c_memcpy(the->symbolTable, theMachine->symbolTable, the->symbolModulo * sizeof(txSlot *));
1648 the->colors = theMachine->colors;
1649 the->keyCount = theMachine->keyIndex + (txID)theCreation->initialKeyCount;
1650 the->keyIndex = theMachine->keyIndex;
1651 the->keyOffset = the->keyIndex;
1652 the->keyArrayHost = theMachine->keyArray;
1653
1654 the->aliasCount = theMachine->aliasCount;
1655 if (the->aliasCount) {
1656 the->aliasArray = (txSlot **)c_malloc_uint32(the->aliasCount * sizeof(txSlot*));
1657 if (!the->aliasArray)
1658 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
1659 c_memset(the->aliasArray, 0, the->aliasCount * sizeof(txSlot*));
1660 }
1661
1662 /* mxGlobal */
1663 mxPushUndefined();
1664 /* mxException */
1665 mxPushUndefined();
1666 /* mxProgram */
1667 mxPushNull();
1668 fxNewProgramInstance(the);
1669 /* mxHosts */
1670 mxPushUndefined();
1671 /* mxModuleQueue */
1672 fxNewInstance(the);

Callers 5

_262_agent_start_auxFunction · 0.85
ServiceThreadInitializeFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
fxPrepareMachineFunction · 0.85

Calls 14

fxAllocateFunction · 0.85
fxNewProgramInstanceFunction · 0.85
fxNewInstanceFunction · 0.85
fxLastPropertyFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxNextSlotPropertyFunction · 0.85
fxNewHostInstanceFunction · 0.85
fxNewEnvironmentInstanceFunction · 0.85
fxDuplicateSlotFunction · 0.85
fxNewRealmInstanceFunction · 0.85
fxLoginFunction · 0.85
fxFreeFunction · 0.85

Tested by

no test coverage detected