mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fill in two missing functions for Embedded Swift
`swift_coroFrameAlloc` is needed by `_read`/`_modify` accessors `swift_deallocUninitializedObject` which I believe is needed for failable class initializers Resolves rdar://157028375 Resolves rdar://157276375
This commit is contained in:
@@ -149,6 +149,13 @@ func alignedAlloc(size: Int, alignment: Int) -> UnsafeMutableRawPointer? {
|
||||
return unsafe r
|
||||
}
|
||||
|
||||
@_cdecl("swift_coroFrameAlloc")
|
||||
public func swift_coroFrameAlloc(_ size: Int, _ type: UInt) -> UnsafeMutableRawPointer? {
|
||||
return unsafe alignedAlloc(
|
||||
size: size,
|
||||
alignment: _swift_MinAllocationAlignment)
|
||||
}
|
||||
|
||||
@_cdecl("swift_slowAlloc")
|
||||
public func swift_slowAlloc(_ size: Int, _ alignMask: Int) -> UnsafeMutableRawPointer? {
|
||||
let alignment: Int
|
||||
@@ -178,6 +185,14 @@ func swift_allocObject(metadata: UnsafeMutablePointer<ClassMetadata>, requiredSi
|
||||
return unsafe object
|
||||
}
|
||||
|
||||
@_cdecl("swift_deallocUninitializedObject")
|
||||
public func swift_deallocUninitializedObject(object: Builtin.RawPointer, allocatedSize: Int, allocatedAlignMask: Int) {
|
||||
unsafe swift_deallocObject(
|
||||
object: UnsafeMutablePointer<HeapObject>(object),
|
||||
allocatedSize: allocatedSize,
|
||||
allocatedAlignMask: allocatedAlignMask)
|
||||
}
|
||||
|
||||
@_cdecl("swift_deallocObject")
|
||||
public func swift_deallocObject(object: Builtin.RawPointer, allocatedSize: Int, allocatedAlignMask: Int) {
|
||||
unsafe swift_deallocObject(object: UnsafeMutablePointer<HeapObject>(object), allocatedSize: allocatedSize, allocatedAlignMask: allocatedAlignMask)
|
||||
|
||||
Reference in New Issue
Block a user