Remove TwoWordPair and use SwiftCC instead.

This commit is contained in:
troughton
2018-02-03 09:43:00 +13:00
parent e43ff7164c
commit cf28ff448c
19 changed files with 99 additions and 147 deletions

View File

@@ -210,7 +210,7 @@ public:
static SimpleGlobalCache<BoxCacheEntry> Boxes;
BoxPair::Return swift::swift_makeBoxUnique(OpaqueValue *buffer, const Metadata *type,
BoxPair swift::swift_makeBoxUnique(OpaqueValue *buffer, const Metadata *type,
size_t alignMask) {
auto *inlineBuffer = reinterpret_cast<ValueBuffer*>(buffer);
HeapObject *box = reinterpret_cast<HeapObject *>(inlineBuffer->PrivateData[0]);
@@ -222,8 +222,8 @@ BoxPair::Return swift::swift_makeBoxUnique(OpaqueValue *buffer, const Metadata *
auto *oldObjectAddr = reinterpret_cast<OpaqueValue *>(
reinterpret_cast<char *>(box) + headerOffset);
// Copy the data.
type->vw_initializeWithCopy(refAndObjectAddr.second, oldObjectAddr);
inlineBuffer->PrivateData[0] = refAndObjectAddr.first;
type->vw_initializeWithCopy(refAndObjectAddr.buffer, oldObjectAddr);
inlineBuffer->PrivateData[0] = refAndObjectAddr.object;
// Release ownership of the old box.
swift_release(box);
return refAndObjectAddr;
@@ -235,11 +235,12 @@ BoxPair::Return swift::swift_makeBoxUnique(OpaqueValue *buffer, const Metadata *
}
}
BoxPair::Return swift::swift_allocBox(const Metadata *type) {
BoxPair swift::swift_allocBox(const Metadata *type) {
return _swift_allocBox(type);
}
static BoxPair::Return _swift_allocBox_(const Metadata *type) {
SWIFT_CC(swift)
static BoxPair _swift_allocBox_(const Metadata *type) {
// Get the heap metadata for the box.
auto metadata = &Boxes.getOrInsert(type).first->Data;