Skip to content

Commit 490ffe2

Browse files
committed
[embedded] Fix build of the stdlib, avoid changing non-embedded codepaths in BridgeStorage.swift
1 parent d3849fe commit 490ffe2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

stdlib/public/core/BridgeStorage.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ internal struct _BridgeStorage<NativeClass: AnyObject> {
7474
@inlinable
7575
@inline(__always)
7676
internal init(taggedPayload: UInt) {
77+
#if !$Embedded
78+
rawValue = _bridgeObject(taggingPayload: taggedPayload)
79+
#else
7780
rawValue = Builtin.reinterpretCast(taggedPayload)
81+
#endif
7882
}
7983
#endif
8084

@@ -134,7 +138,11 @@ internal struct _BridgeStorage<NativeClass: AnyObject> {
134138
internal var nativeInstance: Native {
135139
@inline(__always) get {
136140
_internalInvariant(isNative)
141+
#if !$Embedded
142+
return Builtin.castReferenceFromBridgeObject(rawValue)
143+
#else
137144
return rawValue
145+
#endif
138146
}
139147
}
140148

@@ -145,7 +153,11 @@ internal struct _BridgeStorage<NativeClass: AnyObject> {
145153
#if !$Embedded
146154
_internalInvariant(_nonPointerBits(rawValue) == 0)
147155
#endif
156+
#if !$Embedded
157+
return Builtin.reinterpretCast(rawValue)
158+
#else
148159
return rawValue
160+
#endif
149161
}
150162
}
151163

stdlib/public/core/DictionaryStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ extension _DictionaryStorage {
473473
truncatingIfNeeded: ObjectIdentifier(storage).hashValue)
474474
}
475475

476-
storage._seed = seed ?? _HashTable.hashSeed(for: storage, scale: scale)
476+
storage._seed = seed ?? _HashTable.hashSeed(for: Builtin.castToNativeObject(storage), scale: scale)
477477
storage._rawKeys = UnsafeMutableRawPointer(keysAddr)
478478
storage._rawValues = UnsafeMutableRawPointer(valuesAddr)
479479

0 commit comments

Comments
 (0)