Skip to content

Commit 3253400

Browse files
authored
Reflection: drop compatibility with old runtime layouts
This removes the compatibility code (which seems suspect) for the runtime datastructures. Identified through Windows, this path will potentially misread the field and treat a pair of `uint32_t` as a pointer, which may succeed any way.
1 parent dde3291 commit 3253400

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,28 +1190,7 @@ class ReflectionContext
11901190
if (!ConformancesAddr)
11911191
return "unable to read value of " + ConformancesPointerName;
11921192

1193-
auto Root = getReader().readPointer(ConformancesAddr->getResolvedAddress(),
1194-
sizeof(StoredPointer));
1195-
auto ReaderCount = Root->getResolvedAddress().getAddressData();
1196-
1197-
// ReaderCount will be the root pointer if the conformance cache is a
1198-
// ConcurrentMap. It's very unlikely that there would ever be more readers
1199-
// than the least valid pointer value, so compare with that to distinguish.
1200-
// TODO: once the old conformance cache is gone for good, remove that code.
1201-
uint64_t LeastValidPointerValue;
1202-
if (!getReader().queryDataLayout(
1203-
DataLayoutQueryType::DLQ_GetLeastValidPointerValue, nullptr,
1204-
&LeastValidPointerValue)) {
1205-
return std::string("unable to query least valid pointer value");
1206-
}
1207-
1208-
if (ReaderCount < LeastValidPointerValue)
1209-
IterateConformanceTable(ConformancesAddr->getResolvedAddress(), Call);
1210-
else {
1211-
// The old code has the root address at this location.
1212-
auto RootAddr = ReaderCount;
1213-
iterateConformanceTree(RootAddr, Call);
1214-
}
1193+
IterateConformanceTable(ConformancesAddr->getResolvedAddress(), Call);
12151194
return llvm::None;
12161195
}
12171196

0 commit comments

Comments
 (0)