Skip to content

Commit 4a26626

Browse files
authored
Disable a debugging assertion in the remote mirror MPE evaluation code (#41531)
There are two sources of truth for the MPE spare bit mask in this code: * The MPE reflection record which has a bit mask computed by the compiler. This should always be correct. * A local computation within the RemoteMirror library. This is known to be incomplete, but is _supposed_ to fail cleanly when it hits a case it can't handle. We need both of the above: The first should always be accurate so we obviously prefer it. But old binaries don't have that data, so we need the fallback computation. When both of the above are available, they should agree, but apparently the local computation still doesn't understand what it doesn't understand. Resolves rdar://89360996
1 parent 899a005 commit 4a26626

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

stdlib/public/Reflection/TypeLowering.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,18 +2032,19 @@ class EnumTypeInfoBuilder {
20322032

20332033
if (!spareBitsMask.isZero()) {
20342034

2035-
#if !defined(NDEBUG)
2036-
// DEBUG ASSERTION: compare the locally-computed spare bit mask to the
2037-
// one we got from the compiler. If they're different, then
2038-
// either the compiler is emitting the wrong thing or the
2039-
// local runtime computation isn't quite right.
2035+
#if 0 // TODO: This should be !defined(NDEBUG)
2036+
// DEBUG verification that compiler mask and locally-computed
2037+
// mask are the same (whenever both are available).
20402038
BitMask locallyComputedSpareBitsMask(PayloadSize);
20412039
auto mpePointerSpareBits = TC.getBuilder().getMultiPayloadEnumPointerMask();
20422040
auto locallyComputedSpareBitsMaskIsValid
20432041
= populateSpareBitsMask(Cases, locallyComputedSpareBitsMask, mpePointerSpareBits);
2044-
// assert(locallyComputedSpareBitsMaskIsValid); // Until we expect local computation to always succeed
2042+
// If the local computation were always correct, we could:
2043+
// assert(locallyComputedSpareBitsMaskIsValid);
20452044
if (locallyComputedSpareBitsMaskIsValid) {
2046-
// If we can compute a mask locally, it should match the compiler one
2045+
// Whenever the compiler and local computation both produce
2046+
// data, they should agree.
2047+
// TODO: Make this true, then change `#if 0` above
20472048
assert(locallyComputedSpareBitsMask == spareBitsMask);
20482049
}
20492050
#endif
@@ -2071,6 +2072,9 @@ class EnumTypeInfoBuilder {
20712072
BitMask spareBitsMask(PayloadSize);
20722073
auto mpePointerSpareBits = TC.getBuilder().getMultiPayloadEnumPointerMask();
20732074
auto validSpareBitsMask = populateSpareBitsMask(Cases, spareBitsMask, mpePointerSpareBits);
2075+
// For DEBUGGING, disable fallback to local computation to
2076+
// make missing compiler data more obvious:
2077+
// validSpareBitsMask = false;
20742078
if (!validSpareBitsMask) {
20752079
// If we couldn't correctly determine the spare bits mask,
20762080
// return a TI that will always fail when asked for XIs or value.

0 commit comments

Comments
 (0)