| 163 | } |
| 164 | |
| 165 | void fxAllocate(txMachine* the, txCreation* theCreation) |
| 166 | { |
| 167 | #ifdef mxNever |
| 168 | startTime(&gxLifeTime); |
| 169 | #endif |
| 170 | #if mxStress |
| 171 | gxStress = 0; |
| 172 | #endif |
| 173 | |
| 174 | the->currentChunksSize = 0; |
| 175 | the->peakChunksSize = 0; |
| 176 | the->maximumChunksSize = 0; |
| 177 | the->minimumChunksSize = theCreation->incrementalChunkSize; |
| 178 | |
| 179 | the->currentHeapCount = 0; |
| 180 | the->peakHeapCount = 0; |
| 181 | the->maximumHeapCount = 0; |
| 182 | the->minimumHeapCount = theCreation->incrementalHeapCount; |
| 183 | |
| 184 | the->firstBlock = C_NULL; |
| 185 | the->firstHeap = C_NULL; |
| 186 | |
| 187 | #if mxNoChunks |
| 188 | the->maximumChunksSize = theCreation->initialChunkSize; |
| 189 | #else |
| 190 | fxGrowChunks(the, theCreation->initialChunkSize); |
| 191 | #endif |
| 192 | |
| 193 | the->stackBottom = fxAllocateSlots(the, theCreation->stackCount); |
| 194 | the->stackTop = the->stackBottom + theCreation->stackCount; |
| 195 | the->stackIntrinsics = the->stackTop; |
| 196 | the->stackPrototypes = the->stackTop - XS_INTRINSICS_COUNT; |
| 197 | the->stack = the->stackTop; |
| 198 | #ifdef mxInstrument |
| 199 | the->stackPeak = the->stackTop; |
| 200 | #endif |
| 201 | |
| 202 | fxGrowSlots(the, theCreation->initialHeapCount); |
| 203 | |
| 204 | the->keyCount = (txID)theCreation->initialKeyCount; |
| 205 | the->keyDelta = (txID)theCreation->incrementalKeyCount; |
| 206 | the->keyIndex = 0; |
| 207 | the->keyArray = (txSlot **)c_malloc_uint32(theCreation->initialKeyCount * sizeof(txSlot*)); |
| 208 | if (!the->keyArray) |
| 209 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 210 | |
| 211 | the->nameModulo = theCreation->nameModulo; |
| 212 | the->nameTable = (txSlot **)c_malloc_uint32(theCreation->nameModulo * sizeof(txSlot*)); |
| 213 | if (!the->nameTable) |
| 214 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 215 | |
| 216 | the->symbolModulo = theCreation->symbolModulo; |
| 217 | the->symbolTable = (txSlot **)c_malloc_uint32(theCreation->symbolModulo * sizeof(txSlot*)); |
| 218 | if (!the->symbolTable) |
| 219 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 220 | |
| 221 | fxAllocateStringInfoCache(the); |
| 222 |
no test coverage detected