1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020-2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import Swift
/// Get the parameter count from a mangled method name.
///
/// - Returns: May return a negative number to signal a decoding error.
@available(SwiftStdlib 5.7, *)
public // SPI Distributed
func _getParameterCount(mangledMethodName name: String) -> Int32 {
let nameUTF8 = Array(name.utf8)
return nameUTF8.withUnsafeBufferPointer { nameUTF8 in
return __getParameterCount(
nameUTF8.baseAddress!, UInt(nameUTF8.endIndex))
}
}
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_func_getParameterCount")
public // SPI Distributed
func __getParameterCount(
_ typeNameStart: UnsafePointer<UInt8>,
_ typeNameLength: UInt
) -> Int32
/// Write the Metadata of all the mangled methods name's
/// parameters into the provided buffer.
///
/// - Returns: the actual number of types written,
/// or negative value to signify an error
@available(SwiftStdlib 5.7, *)
public // SPI Distributed
func _getParameterTypeInfo(
mangledMethodName name: String,
genericEnv: UnsafeRawPointer?, // GenericEnvironmentDescriptor *
genericArguments: UnsafeRawPointer?,
into typesBuffer: Builtin.RawPointer, length typesLength: Int
) -> Int32 {
let nameUTF8 = Array(name.utf8)
return nameUTF8.withUnsafeBufferPointer { nameUTF8 in
return __getParameterTypeInfo(
nameUTF8.baseAddress!, UInt(nameUTF8.endIndex),
genericEnv, genericArguments, typesBuffer, typesLength)
}
}
/// - Returns: the actual number of types written,
/// or a negative value to signal decoding error.
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_func_getParameterTypeInfo")
public // SPI Distributed
func __getParameterTypeInfo(
_ typeNameStart: UnsafePointer<UInt8>, _ typeNameLength: UInt,
_ genericEnv: UnsafeRawPointer?, // GenericEnvironmentDescriptor *
_ genericArguments: UnsafeRawPointer?,
_ types: Builtin.RawPointer, _ typesLength: Int
) -> Int32
@available(SwiftStdlib 5.7, *)
@available(*, deprecated, message: "Use `__getReturnTypeInfo(_:_:_:_:)` directly")
public // SPI Distributed
func _getReturnTypeInfo(
mangledMethodName name: String,
genericEnv: UnsafeRawPointer?, // GenericEnvironmentDescriptor *
genericArguments: UnsafeRawPointer?
) -> Any.Type? {
let nameUTF8 = Array(name.utf8)
return nameUTF8.withUnsafeBufferPointer { nameUTF8 in
return __getReturnTypeInfo(nameUTF8.baseAddress!, UInt(nameUTF8.endIndex),
genericEnv, genericArguments)
}
}
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_func_getReturnTypeInfo")
public // SPI Distributed
func __getReturnTypeInfo(
_ typeNameStart: UnsafePointer<UInt8>,
_ typeNameLength: UInt,
_ genericEnv: UnsafeRawPointer?, // GenericEnvironmentDescriptor *
_ genericArguments: UnsafeRawPointer?
) -> Any.Type?
/// Typealias for Swift `TypeNamePair` and similar ones which Swift runtime
/// uses to return String data/length pairs.
typealias _SwiftNamePair = (UnsafePointer<UInt8>, Int)
/// Deprecated SPI: Instead use the entry point with the actor parameter passed.
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_distributed_getGenericEnvironment")
public // SPI Distributed
func _getGenericEnvironmentOfDistributedTarget(
_ targetNameStart: UnsafePointer<UInt8>,
_ targetNameLength: UInt
) -> UnsafeRawPointer?
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_distributed_getWitnessTables")
public // SPI Distributed
func _getWitnessTablesFor(
environment: UnsafeRawPointer,
genericArguments: UnsafeRawPointer
) -> (UnsafeRawPointer, Int)
@available(SwiftStdlib 5.7, *)
@_silgen_name("swift_distributed_makeDistributedTargetAccessorNotFoundError")
internal // SPI Distributed
func _makeDistributedTargetAccessorNotFoundError() -> Error {
/// We don't include the name of the target in case the input was compromised.
return ExecuteDistributedTargetError(
message: "Failed to locate distributed function accessor",
errorCode: .targetAccessorNotFound)
}
|