| 1075 | } |
| 1076 | |
| 1077 | void fxIndexSlots(txMachine* the, txSnapshot* snapshot) |
| 1078 | { |
| 1079 | txSlot* heap; |
| 1080 | txSlot* limit; |
| 1081 | txProjection** projectionAddress = &(snapshot->firstProjection); |
| 1082 | txProjection* projection; |
| 1083 | txSlot* slot; |
| 1084 | txSlot** slotAddress; |
| 1085 | txID id; |
| 1086 | size_t* indexAddress; |
| 1087 | |
| 1088 | heap = the->firstHeap; |
| 1089 | while (heap) { |
| 1090 | limit = heap->value.reference; |
| 1091 | projection = c_calloc(sizeof(txProjection) + (limit - heap - 1) * sizeof(size_t), 1); |
| 1092 | if (!projection) { snapshot->error = C_ENOMEM; fxJump(the); } |
| 1093 | projection->heap = heap; |
| 1094 | projection->limit = limit; |
| 1095 | *projectionAddress = projection; |
| 1096 | projectionAddress = &projection->nextProjection; |
| 1097 | heap = heap->next; |
| 1098 | } |
| 1099 | |
| 1100 | snapshot->slotSize = 1; |
| 1101 | slotAddress = the->keyArray; |
| 1102 | id = the->keyIndex; |
| 1103 | while (id) { |
| 1104 | if ((slot = *slotAddress)) { |
| 1105 | fxIndexSlot(the, snapshot, slot); |
| 1106 | fxIndexReference(the, snapshot, slot); |
| 1107 | } |
| 1108 | slotAddress++; |
| 1109 | id--; |
| 1110 | } |
| 1111 | slot = the->stackTop; |
| 1112 | while (slot > the->stack) { |
| 1113 | slot--; |
| 1114 | fxIndexReference(the, snapshot, slot); |
| 1115 | } |
| 1116 | |
| 1117 | snapshot->slots = c_calloc(sizeof(txSlot*) * snapshot->slotSize, 1); |
| 1118 | if (!snapshot->slots) { snapshot->error = C_ENOMEM; fxJump(the); } |
| 1119 | projection = snapshot->firstProjection; |
| 1120 | while (projection) { |
| 1121 | heap = projection->heap; |
| 1122 | limit = projection->limit; |
| 1123 | slot = heap + 1; |
| 1124 | indexAddress = &projection->indexes[1]; |
| 1125 | while (slot < limit) { |
| 1126 | if (slot->flag & XS_MARK_FLAG) { |
| 1127 | slot->flag &= ~XS_MARK_FLAG; |
| 1128 | snapshot->slots[*indexAddress] = slot; |
| 1129 | } |
| 1130 | slot++; |
| 1131 | indexAddress++; |
| 1132 | } |
| 1133 | projection = projection->nextProjection; |
| 1134 | } |
no test coverage detected