| 102 | #endif |
| 103 | |
| 104 | txSlot* fxDuplicateInstance(txMachine* the, txSlot* instance) |
| 105 | { |
| 106 | txSlot* result; |
| 107 | txSlot* from; |
| 108 | txSlot* to; |
| 109 | result = fxNewInstance(the); |
| 110 | result->flag = instance->flag & ~XS_MARK_FLAG; |
| 111 | result->value.instance.garbage = C_NULL; |
| 112 | result->value.instance.prototype = instance->value.instance.prototype; |
| 113 | from = instance->next; |
| 114 | to = result; |
| 115 | while (from) { |
| 116 | if (from->kind != XS_WEAK_ENTRY_KIND) { |
| 117 | to = to->next = fxDuplicateSlot(the, from); |
| 118 | if (from->kind == XS_ARRAY_KIND) { |
| 119 | txSlot* address = from->value.array.address; |
| 120 | to->value.array.address = C_NULL; |
| 121 | if (address) { |
| 122 | txSize size = (((txChunk*)(((txByte*)address) - sizeof(txChunk)))->size) / sizeof(txSlot); |
| 123 | txSlot* chunk = (txSlot*)fxNewChunk(the, size * sizeof(txSlot)); |
| 124 | address = from->value.array.address; |
| 125 | c_memcpy(chunk, address, size * sizeof(txSlot)); |
| 126 | to->value.array.address = chunk; |
| 127 | while (size) { |
| 128 | chunk->flag &= ~XS_MARK_FLAG; |
| 129 | chunk++; |
| 130 | size--; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | from = from->next; |
| 136 | } |
| 137 | return result; |
| 138 | } |
| 139 | |
| 140 | txSlot* fxGetInstance(txMachine* the, txSlot* theSlot) |
| 141 | { |
no test coverage detected