| 57 | |
| 58 | #if mxAliasInstance |
| 59 | txSlot* fxAliasInstance(txMachine* the, txSlot* instance) |
| 60 | { |
| 61 | txSlot* alias; |
| 62 | txSlot* from; |
| 63 | txSlot* to; |
| 64 | the->aliasArray[instance->ID] = alias = fxNewSlot(the); |
| 65 | alias->flag = instance->flag & ~(XS_MARK_FLAG | XS_DONT_MARSHALL_FLAG); |
| 66 | alias->kind = XS_INSTANCE_KIND; |
| 67 | alias->value.instance.garbage = instance->value.instance.garbage; |
| 68 | alias->value.instance.prototype = instance->value.instance.prototype; |
| 69 | from = instance->next; |
| 70 | to = alias; |
| 71 | while (from) { |
| 72 | to = to->next = fxDuplicateSlot(the, from); |
| 73 | if (to->kind == XS_ARRAY_KIND) { |
| 74 | txSlot* address = to->value.array.address; |
| 75 | if (address) { |
| 76 | txSize size = (((txChunk*)(((txByte*)address) - sizeof(txChunk)))->size) / sizeof(txSlot); |
| 77 | txSlot* chunk = (txSlot*)fxNewChunk(the, size * sizeof(txSlot)); |
| 78 | c_memcpy(chunk, address, size * sizeof(txSlot)); |
| 79 | to->value.array.address = chunk; |
| 80 | while (size) { |
| 81 | chunk->flag &= ~XS_MARK_FLAG; |
| 82 | chunk++; |
| 83 | size--; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | else if (to->kind == XS_DATE_KIND) { |
| 88 | to->flag &= ~XS_DONT_SET_FLAG; |
| 89 | } |
| 90 | else if (to->kind == XS_PRIVATE_KIND) { |
| 91 | txSlot** address = &to->value.private.first; |
| 92 | txSlot* slot; |
| 93 | while ((slot = *address)) { |
| 94 | *address = slot = fxDuplicateSlot(the, slot); |
| 95 | address = &slot->next; |
| 96 | } |
| 97 | } |
| 98 | from = from->next; |
| 99 | } |
| 100 | return alias; |
| 101 | } |
| 102 | #endif |
| 103 | |
| 104 | txSlot* fxDuplicateInstance(txMachine* the, txSlot* instance) |
no test coverage detected