mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[runtime] Reinstate TwoWordPair hack for swiftcall returns. (#14079)
clang is miscompiling some swiftcall functions on armv7s.
Stop using swiftcall in some places until it is fixed.
Reverts c5bf2ec (#13299).
rdar://35973477
This commit is contained in:
@@ -113,8 +113,9 @@ std::string swift::nameForMetadata(const Metadata *type,
|
||||
return result;
|
||||
}
|
||||
|
||||
TypeNamePair
|
||||
TwoWordPair<const char *, uintptr_t>::Return
|
||||
swift::swift_getTypeName(const Metadata *type, bool qualified) {
|
||||
using Pair = TwoWordPair<const char *, uintptr_t>;
|
||||
using Key = llvm::PointerIntPair<const Metadata *, 1, bool>;
|
||||
|
||||
static StaticReadWriteLock TypeNameCacheLock;
|
||||
@@ -131,7 +132,7 @@ swift::swift_getTypeName(const Metadata *type, bool qualified) {
|
||||
auto found = cache.find(key);
|
||||
if (found != cache.end()) {
|
||||
auto result = found->second;
|
||||
return TypeNamePair{result.first, result.second};
|
||||
return Pair{result.first, result.second};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ swift::swift_getTypeName(const Metadata *type, bool qualified) {
|
||||
auto found = cache.find(key);
|
||||
if (found != cache.end()) {
|
||||
auto result = found->second;
|
||||
return TypeNamePair{result.first, result.second};
|
||||
return Pair{result.first, result.second};
|
||||
}
|
||||
|
||||
// Build the metadata name.
|
||||
@@ -156,7 +157,7 @@ swift::swift_getTypeName(const Metadata *type, bool qualified) {
|
||||
result[size] = 0;
|
||||
|
||||
cache.insert({key, {result, size}});
|
||||
return TypeNamePair{result, size};
|
||||
return Pair{result, size};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -954,7 +955,7 @@ static bool _dynamicCastToExistential(OpaqueValue *dest,
|
||||
(canConsumeDynamicValue && (flags & DynamicCastFlags::TakeOnSuccess));
|
||||
BoxPair destBox = swift_allocError(srcDynamicType, errorWitness,
|
||||
srcDynamicValue, isTake);
|
||||
*destBoxAddr = reinterpret_cast<SwiftError*>(destBox.object);
|
||||
*destBoxAddr = reinterpret_cast<SwiftError*>(destBox.first);
|
||||
maybeDeallocateSource(true);
|
||||
return true;
|
||||
}
|
||||
@@ -1976,7 +1977,7 @@ static id dynamicCastValueToNSError(OpaqueValue *src,
|
||||
|
||||
BoxPair errorBox = swift_allocError(srcType, srcErrorWitness, src,
|
||||
/*isTake*/ flags & DynamicCastFlags::TakeOnSuccess);
|
||||
return _swift_stdlib_bridgeErrorToNSError((SwiftError*)errorBox.object);
|
||||
return _swift_stdlib_bridgeErrorToNSError((SwiftError*)errorBox.first);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user