Skip to content

Commit ecec208

Browse files
committed
Add additional debug output
1 parent 7295960 commit ecec208

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

stdlib/public/runtime/BytecodeLayouts.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,14 @@ extern "C" swift::OpaqueValue *
10021002
swift_generic_initWithCopy(swift::OpaqueValue *dest, swift::OpaqueValue *src,
10031003
const Metadata *metadata) {
10041004
const uint8_t *layoutStr = metadata->getLayoutString();
1005+
1006+
size_t refCountBytes = (*(const size_t*)(layoutStr + sizeof(uint64_t))) + sizeof(uint64_t);
1007+
fprintf(stderr, "==== RefCount: ");
1008+
for (size_t i = 0; i < refCountBytes; i+=8) {
1009+
fprintf(stderr, "%016llx ", *(const uint64_t*)(layoutStr + sizeof(uint64_t) + sizeof(size_t) + i));
1010+
}
1011+
fprintf(stderr, "\n");
1012+
10051013
LayoutStringReader1 reader{layoutStr + layoutStringHeaderSize};
10061014
uintptr_t addrOffset = 0;
10071015
handleRefCountsInitWithCopy(metadata, reader, addrOffset, (uint8_t *)dest, (uint8_t *)src);
@@ -1414,8 +1422,9 @@ static void singlePayloadEnumSimpleAssignWithCopy(const Metadata *metadata,
14141422
return;
14151423
} else if (destTagBytes >= xiTagValues) {
14161424
const uint8_t *end = (reader.layoutStr + refCountBytes);
1425+
auto nestedAddrOffset = addrOffset;
14171426
while (reader.layoutStr < end) {
1418-
handleSingleRefCountDestroy(metadata, reader, addrOffset, dest);
1427+
handleSingleRefCountDestroy(metadata, reader, nestedAddrOffset, dest);
14191428
}
14201429
} else {
14211430
reader.skip(refCountBytes);
@@ -1450,8 +1459,9 @@ static void singlePayloadEnumFNAssignWithCopy(const Metadata *metadata,
14501459
return;
14511460
} else if (destTag == 0) {
14521461
const uint8_t *end = (reader.layoutStr + refCountBytes);
1462+
auto nestedAddrOffset = addrOffset;
14531463
while (reader.layoutStr < end) {
1454-
handleSingleRefCountDestroy(metadata, reader, addrOffset, dest);
1464+
handleSingleRefCountDestroy(metadata, reader, nestedAddrOffset, dest);
14551465
}
14561466
} else {
14571467
reader.skip(refCountBytes);
@@ -1486,8 +1496,9 @@ static void singlePayloadEnumFNResolvedAssignWithCopy(const Metadata *metadata,
14861496
return;
14871497
} else if (destTag == 0) {
14881498
const uint8_t *end = (reader.layoutStr + refCountBytes);
1499+
auto nestedAddrOffset = addrOffset;
14891500
while (reader.layoutStr < end) {
1490-
handleSingleRefCountDestroy(metadata, reader, addrOffset, dest);
1501+
handleSingleRefCountDestroy(metadata, reader, nestedAddrOffset, dest);
14911502
}
14921503
} else {
14931504
reader.skip(refCountBytes);
@@ -1547,8 +1558,9 @@ static void singlePayloadEnumGenericAssignWithCopy(const Metadata *metadata,
15471558
return;
15481559
} else if (destTag == 0) {
15491560
const uint8_t *end = (reader.layoutStr + refCountBytes);
1561+
auto nestedAddrOffset = addrOffset;
15501562
while (reader.layoutStr < end) {
1551-
handleSingleRefCountDestroy(metadata, reader, addrOffset, dest);
1563+
handleSingleRefCountDestroy(metadata, reader, nestedAddrOffset, dest);
15521564
}
15531565
} else {
15541566
reader.skip(refCountBytes);

0 commit comments

Comments
 (0)