//===-- RuntimeFunctions.def - Runtime Functions Database -------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines x-macros used for metaprogramming with the set of // runtime functions. // //===----------------------------------------------------------------------===// /// FUNCTION(Id, Name, ReturnTys, ArgTys, CC, Attrs) /// Makes available as "Id" the following runtime function: /// ReturnTy Name(ArgsTys...); /// ReturnTys is a call to RETURNS, which takes a non-empty list /// of expressions meant to be looked up in IRGenModule. /// ArgTys is either NO_ARGS or a call to ARGS, which takes a non-empty /// list of expressions meant to be looked up in IRGenModule. /// Attrs is a parenthesized list of attributes. /// /// By default, passes Id to FUNCTION_ID. Therefore, the valid uses of /// this database define either: /// FUNCTION_ID /// or all of the following: /// FUNCTION /// RETURNS /// ARGS /// NO_ARGS /// ATTRS /// NO_ATTRS #ifndef FUNCTION #define FUNCTION(Id, Name, ReturnTys, ArgTys, CC, Attrs) FUNCTION_ID(Id) #endif // struct { RefCounted *box; void *value; } swift_allocBox(Metadata *type); FUNCTION(AllocBox, swift_allocBox, RuntimeCC, RETURNS(RefCountedPtrTy, OpaquePtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind)) FUNCTION(DeallocBox, swift_deallocBox, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind)) // RefCounted *swift_allocObject(Metadata *type, size_t size, size_t alignMask); FUNCTION(AllocObject, swift_allocObject, RuntimeCC, RETURNS(RefCountedPtrTy), ARGS(TypeMetadataPtrTy, SizeTy, SizeTy), ATTRS(NoUnwind)) // void swift_deallocObject(RefCounted *obj, size_t size, size_t alignMask); FUNCTION(DeallocObject, swift_deallocObject, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy, SizeTy, SizeTy), ATTRS(NoUnwind)) // void swift_deallocClassInstance(RefCounted *obj, size_t size, size_t alignMask); FUNCTION(DeallocClassInstance, swift_deallocClassInstance, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy, SizeTy, SizeTy), ATTRS(NoUnwind)) // void *swift_slowAlloc(size_t size, size_t alignMask); FUNCTION(SlowAlloc, swift_slowAlloc, RuntimeCC, RETURNS(Int8PtrTy), ARGS(SizeTy, SizeTy), ATTRS(NoUnwind)) // void swift_slowDealloc(void *ptr, size_t size, size_t alignMask); FUNCTION(SlowDealloc, swift_slowDealloc,RuntimeCC, RETURNS(VoidTy), ARGS(Int8PtrTy, SizeTy, SizeTy), ATTRS(NoUnwind)) // void swift_willThrow(error *ptr); FUNCTION(WillThrow, swift_willThrow, RuntimeCC, RETURNS(VoidTy), ARGS(ErrorPtrTy), ATTRS(NoUnwind)) // void swift_errorInMain(error *ptr); FUNCTION(ErrorInMain, swift_errorInMain, RuntimeCC, RETURNS(VoidTy), ARGS(ErrorPtrTy), ATTRS(NoUnwind)) // void swift_unexpectedError(error *ptr); FUNCTION(UnexpectedError, swift_unexpectedError, RuntimeCC, RETURNS(VoidTy), ARGS(ErrorPtrTy), ATTRS(NoUnwind, NoReturn)) // void *swift_copyPOD(void *dest, void *src, Metadata *self); FUNCTION(CopyPOD, swift_copyPOD, RuntimeCC, RETURNS(OpaquePtrTy), ARGS(OpaquePtrTy, OpaquePtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind)) // void swift_retain_noresult(void *ptr); FUNCTION(RetainNoResult, swift_retain_noresult,RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_release(void *ptr); FUNCTION(Release, swift_release, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void *swift_tryPin(void *ptr); FUNCTION(TryPin, swift_tryPin, RuntimeCC, RETURNS(RefCountedPtrTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unpin(void *ptr); FUNCTION(Unpin, swift_unpin, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_fixLifetime(void *ptr); FUNCTION(FixLifetime, swift_fixLifetime, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownRetain(void *ptr); FUNCTION(UnknownRetain, swift_unknownRetain, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownRelease(void *ptr); FUNCTION(UnknownRelease, swift_unknownRelease, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_retainUnowned(void *ptr); FUNCTION(RetainUnowned, swift_retainUnowned, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void *swift_bridgeObjectRetain(void *ptr); FUNCTION(BridgeObjectRetain, swift_bridgeObjectRetain, RuntimeCC, RETURNS(BridgeObjectPtrTy), ARGS(BridgeObjectPtrTy), ATTRS(NoUnwind)) // void swift_bridgeRelease(void *ptr); FUNCTION(BridgeObjectRelease, swift_bridgeObjectRelease, RuntimeCC, RETURNS(VoidTy), ARGS(BridgeObjectPtrTy), ATTRS(NoUnwind)) // error *swift_errorRetain(error *ptr); FUNCTION(ErrorRetain, swift_errorRetain, RuntimeCC, RETURNS(ErrorPtrTy), ARGS(ErrorPtrTy), ATTRS(NoUnwind)) // void swift_errorRelease(void *ptr); FUNCTION(ErrorRelease, swift_errorRelease, RuntimeCC, RETURNS(VoidTy), ARGS(ErrorPtrTy), ATTRS(NoUnwind)) // void swift_weakRetain(void *ptr); FUNCTION(UnownedRetain, swift_weakRetain, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_weakRelease(void *ptr); FUNCTION(UnownedRelease, swift_weakRelease,RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_weakDestroy(WeakReference *object); FUNCTION(WeakDestroy, swift_weakDestroy, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_weakInit(WeakReference *object, void *value); FUNCTION(WeakInit, swift_weakInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_weakAssign(WeakReference *object, void *value); FUNCTION(WeakAssign, swift_weakAssign, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, RefCountedPtrTy), ATTRS(NoUnwind)) // void *swift_weakLoadStrong(WeakReference *object); FUNCTION(WeakLoadStrong, swift_weakLoadStrong,RuntimeCC, RETURNS(RefCountedPtrTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void *swift_weakTakeStrong(WeakReference *object); FUNCTION(WeakTakeStrong, swift_weakTakeStrong,RuntimeCC, RETURNS(RefCountedPtrTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_weakCopyInit(WeakReference *dest, WeakReference *src); FUNCTION(WeakCopyInit, swift_weakCopyInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_weakTakeInit(WeakReference *dest, WeakReference *src); FUNCTION(WeakTakeInit, swift_weakTakeInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_weakCopyAssign(WeakReference *dest, WeakReference *src); FUNCTION(WeakCopyAssign, swift_weakCopyAssign,RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_weakTakeAssign(WeakReference *dest, WeakReference *src); FUNCTION(WeakTakeAssign, swift_weakTakeAssign,RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_unknownRetainUnowned(void *ptr); FUNCTION(UnknownRetainUnowned, swift_unknownRetainUnowned, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakRetain(void *value); FUNCTION(UnknownUnownedRetain, swift_unknownWeakRetain, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakRelease(void *value); FUNCTION(UnknownUnownedRelease, swift_unknownWeakRelease, RuntimeCC, RETURNS(VoidTy), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakDestroy(WeakReference *object); FUNCTION(UnknownWeakDestroy, swift_unknownWeakDestroy, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakInit(WeakReference *object, void *value); FUNCTION(UnknownWeakInit, swift_unknownWeakInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, UnknownRefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakAssign(WeakReference *object, void *value); FUNCTION(UnknownWeakAssign, swift_unknownWeakAssign, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, UnknownRefCountedPtrTy), ATTRS(NoUnwind)) // void *swift_unknownWeakLoad(WeakReference *object); FUNCTION(UnknownWeakLoadStrong, swift_unknownWeakLoadStrong,RuntimeCC, RETURNS(UnknownRefCountedPtrTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void *swift_unknownWeakTake(WeakReference *object); FUNCTION(UnknownWeakTakeStrong, swift_unknownWeakTakeStrong,RuntimeCC, RETURNS(UnknownRefCountedPtrTy), ARGS(WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakCopyInit(WeakReference *dest, WeakReference *src); FUNCTION(UnknownWeakCopyInit, swift_unknownWeakCopyInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakTakeInit(WeakReference *dest, WeakReference *src); FUNCTION(UnknownWeakTakeInit, swift_unknownWeakTakeInit, RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakCopyAssign(WeakReference *dest, WeakReference *src); FUNCTION(UnknownWeakCopyAssign, swift_unknownWeakCopyAssign,RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // bool _swift_isUniquelyReferencedNonObjC(const void *); FUNCTION(IsUniquelyReferencedNonObjC, _swift_isUniquelyReferencedNonObjC, RuntimeCC, RETURNS(Int1Ty), ARGS(UnknownRefCountedPtrTy), ATTRS(NoUnwind)) // bool _swift_isUniquelyReferencedNonObjC_nonNull(const void *); FUNCTION(IsUniquelyReferencedNonObjC_nonNull, _swift_isUniquelyReferencedNonObjC_nonNull, RuntimeCC, RETURNS(Int1Ty), ARGS(UnknownRefCountedPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferencedOrPinnedNonObjC_nonNull(const void *); FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull, _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull, RuntimeCC, RETURNS(Int1Ty), ARGS(UnknownRefCountedPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject( // __swift_uintptr_t bits); FUNCTION(IsUniquelyReferencedNonObjC_nonNull_bridgeObject, _swift_isUniquelyReferencedNonObjC_nonNull_bridgeObject, RuntimeCC, RETURNS(Int1Ty), ARGS(BridgeObjectPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject( // __swift_uintptr_t bits); FUNCTION(IsUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject, _swift_isUniquelyReferencedOrPinnedNonObjC_nonNull_bridgeObject, RuntimeCC, RETURNS(Int1Ty), ARGS(BridgeObjectPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferenced_native(const struct HeapObject *); FUNCTION(IsUniquelyReferenced_native, _swift_isUniquelyReferenced_native, RuntimeCC, RETURNS(Int1Ty), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferencedOrPinned_native(const struct HeapObject *); FUNCTION(IsUniquelyReferencedOrPinned_native, _swift_isUniquelyReferencedOrPinned_native, RuntimeCC, RETURNS(Int1Ty), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferenced_nonNull_native(const struct HeapObject *); FUNCTION(IsUniquelyReferenced_nonNull_native, _swift_isUniquelyReferenced_nonNull_native, RuntimeCC, RETURNS(Int1Ty), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // bool __swift_isUniquelyReferencedOrPinned_nonNull_native( // const struct HeapObject *); FUNCTION(IsUniquelyReferencedOrPinned_nonNull_native, _swift_isUniquelyReferencedOrPinned_nonNull_native, RuntimeCC, RETURNS(Int1Ty), ARGS(RefCountedPtrTy), ATTRS(NoUnwind)) // void swift_unknownWeakTakeAssign(WeakReference *dest, WeakReference *src); FUNCTION(UnknownWeakTakeAssign, swift_unknownWeakTakeAssign,RuntimeCC, RETURNS(VoidTy), ARGS(WeakReferencePtrTy, WeakReferencePtrTy), ATTRS(NoUnwind)) // Metadata *swift_getFunctionTypeMetadata(const void **args); FUNCTION(GetFunctionMetadata, swift_getFunctionTypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(Int8PtrTy->getPointerTo(0)), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getFunctionTypeMetadata1(unsigned long flags, const void *arg0, const Metadata *resultMetadata); FUNCTION(GetFunctionMetadata1, swift_getFunctionTypeMetadata1, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(SizeTy, Int8PtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getFunctionTypeMetadata2(unsigned long flags, const void *arg0, const void *arg1, const Metadata *resultMetadata); FUNCTION(GetFunctionMetadata2, swift_getFunctionTypeMetadata2, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(SizeTy, Int8PtrTy, Int8PtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getFunctionTypeMetadata3(unsigned long flags, const void *arg0, const void *arg1, const void *arg2, const Metadata *resultMetadata); FUNCTION(GetFunctionMetadata3, swift_getFunctionTypeMetadata3, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(SizeTy, Int8PtrTy, Int8PtrTy, Int8PtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getForeignTypeMetadata(Metadata *nonUnique); FUNCTION(GetForeignTypeMetadata, swift_getForeignTypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // only writes to runtime-private fields // Metadata *swift_getGenericMetadata(GenericMetadata *pattern, // const void *arguments); FUNCTION(GetGenericMetadata, swift_getGenericMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_allocateGenericClassMetadata(GenericMetadata *pattern, // const void * const *arguments, // objc_class *superclass); FUNCTION(AllocateGenericClassMetadata, swift_allocateGenericClassMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrPtrTy, ObjCClassPtrTy), ATTRS(NoUnwind)) // Metadata *swift_allocateGenericValueMetadata(GenericMetadata *pattern, // const void * const *arguments); FUNCTION(AllocateGenericValueMetadata, swift_allocateGenericValueMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrPtrTy), ATTRS(NoUnwind)) // Metadata *swift_getGenericMetadata1(GenericMetadata *pattern, // const void *arg0); FUNCTION(GetGenericMetadata1, swift_getGenericMetadata1, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getGenericMetadata2(GenericMetadata *pattern, // const void *arg0, const void *arg1); FUNCTION(GetGenericMetadata2, swift_getGenericMetadata2, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getGenericMetadata3(GenericMetadata *pattern, // const void *arg0, const void *arg1, // const void *arg2); FUNCTION(GetGenericMetadata3, swift_getGenericMetadata3, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getGenericMetadata4(GenericMetadata *pattern, // const void *arg0, const void *arg1, // const void *arg2, const void *arg3); FUNCTION(GetGenericMetadata4, swift_getGenericMetadata4, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPatternPtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getMetatypeMetadata(Metadata *instanceTy); FUNCTION(GetMetatypeMetadata, swift_getMetatypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getExistentialMetatypeMetadata(Metadata *instanceTy); FUNCTION(GetExistentialMetatypeMetadata, swift_getExistentialMetatypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getObjCClassMetadata(objc_class *theClass); FUNCTION(GetObjCClassMetadata, swift_getObjCClassMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(ObjCClassPtrTy), ATTRS(NoUnwind, ReadNone)) // _Bool swift_objcRespondsToSelector(id, void*); FUNCTION(ObjCRespondsToSelector, swift_objcRespondsToSelector, C_CC, RETURNS(Int1Ty), ARGS(ObjCPtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_getTupleTypeMetadata(size_t numElements, // Metadata * const *elts, // const char *labels, // value_witness_table_t *proposed); FUNCTION(GetTupleMetadata, swift_getTupleTypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(SizeTy, TypeMetadataPtrTy->getPointerTo(0), Int8PtrTy, WitnessTablePtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_getTupleTypeMetadata2(Metadata *elt0, Metadata *elt1, // const char *labels, // value_witness_table_t *proposed); FUNCTION(GetTupleMetadata2, swift_getTupleTypeMetadata2, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, TypeMetadataPtrTy, Int8PtrTy, WitnessTablePtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_getTupleTypeMetadata3(Metadata *elt0, Metadata *elt1, // Metadata *elt2, const char *labels, // value_witness_table_t *proposed); FUNCTION(GetTupleMetadata3, swift_getTupleTypeMetadata3, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, TypeMetadataPtrTy, TypeMetadataPtrTy, Int8PtrTy, WitnessTablePtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_getExistentialTypeMetadata(size_t numProtocols, // const protocol_descriptor_t * const *protocols); FUNCTION(GetExistentialMetadata, swift_getExistentialTypeMetadata, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(SizeTy, ProtocolDescriptorPtrTy->getPointerTo()), ATTRS(NoUnwind, ReadOnly)) // const char *swift_getGenericClassObjCName(Metadata *self, // const char *basename); FUNCTION(GetGenericClassObjCName, swift_getGenericClassObjCName, RuntimeCC, RETURNS(Int8PtrTy), ARGS(TypeMetadataPtrTy, Int8PtrTy), ATTRS(NoUnwind)) // struct FieldInfo { size_t Size; size_t AlignMask; }; // void swift_initClassMetadata_UniversalStrategy(Metadata *self, // Metadata *super, // size_t numFields, // const FieldInfo *fields, // size_t *fieldOffsets); FUNCTION(InitClassMetadataUniversal, swift_initClassMetadata_UniversalStrategy, RuntimeCC, RETURNS(VoidTy), ARGS(TypeMetadataPtrTy, TypeMetadataPtrTy, SizeTy, SizeTy->getPointerTo(), SizeTy->getPointerTo()), ATTRS(NoUnwind)) // void swift_initStructMetadata_UniversalStrategy(size_t numFields, // Metadata * const *fieldTypes, // size_t *fieldOffsets, // value_witness_table_t *vwtable); FUNCTION(InitStructMetadataUniversal, swift_initStructMetadata_UniversalStrategy, RuntimeCC, RETURNS(VoidTy), ARGS(SizeTy, TypeMetadataPtrTy->getPointerTo(), SizeTy->getPointerTo(), WitnessTablePtrTy), ATTRS(NoUnwind)) // void swift_initEnumValueWitnessTableSinglePayload(value_witness_table_t *vwt, // Metadata *payload, // unsigned num_empty_cases); FUNCTION(InitEnumValueWitnessTableSinglePayload, swift_initEnumValueWitnessTableSinglePayload, RuntimeCC, RETURNS(VoidTy), ARGS(WitnessTablePtrTy, TypeMetadataPtrTy, Int32Ty), ATTRS(NoUnwind)) // void swift_initEnumMetadataMultiPayload(value_witness_table_t *vwt, // Metadata *enumType, // size_t numPayloads, // Metadata * const *payloadTypes); FUNCTION(InitEnumMetadataMultiPayload, swift_initEnumMetadataMultiPayload, RuntimeCC, RETURNS(VoidTy), ARGS(WitnessTablePtrTy, TypeMetadataPtrTy, SizeTy, TypeMetadataPtrTy->getPointerTo(0)), ATTRS(NoUnwind)) // int swift_getEnumCaseSinglePayload(opaque_t *obj, Metadata *payload, // unsigned num_empty_cases); FUNCTION(GetEnumCaseSinglePayload, swift_getEnumCaseSinglePayload, RuntimeCC, RETURNS(Int32Ty), ARGS(OpaquePtrTy, TypeMetadataPtrTy, Int32Ty), ATTRS(NoUnwind, ReadOnly)) // int swift_getEnumCaseMultiPayload(opaque_t *obj, Metadata *enumTy); FUNCTION(GetEnumCaseMultiPayload, swift_getEnumCaseMultiPayload, RuntimeCC, RETURNS(Int32Ty), ARGS(OpaquePtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadOnly)) // void swift_storeEnumTagSinglePayload(opaque_t *obj, Metadata *payload, // int case_index, // unsigned num_empty_cases); FUNCTION(StoreEnumTagSinglePayload, swift_storeEnumTagSinglePayload, RuntimeCC, RETURNS(VoidTy), ARGS(OpaquePtrTy, TypeMetadataPtrTy, Int32Ty, Int32Ty), ATTRS(NoUnwind)) // void swift_storeEnumTagMultiPayload(opaque_t *obj, Metadata *enumTy, // int case_index); FUNCTION(StoreEnumTagMultiPayload, swift_storeEnumTagMultiPayload, RuntimeCC, RETURNS(VoidTy), ARGS(OpaquePtrTy, TypeMetadataPtrTy, Int32Ty), ATTRS(NoUnwind)) // Class object_getClass(id object); // // This is readonly instead of readnone because isa-rewriting can have // a noticeable effect. FUNCTION(GetObjectClass, object_getClass, C_CC, RETURNS(ObjCClassPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind, ReadOnly)) // Metadata *swift_getObjectType(id object); // // Since this is intended to look through dynamic subclasses, it's // invariant across reasonable isa-rewriting schemes and therefore can // be readnone. FUNCTION(GetObjectType, swift_getObjectType, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind, ReadNone)) // Metadata *swift_getDynamicType(opaque_t *obj, Metadata *self); FUNCTION(GetDynamicType, swift_getDynamicType, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(OpaquePtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastClass(void*, void*); FUNCTION(DynamicCastClass, swift_dynamicCastClass, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastClassUnconditional(void*, void*); FUNCTION(DynamicCastClassUnconditional, swift_dynamicCastClassUnconditional, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastObjCClass(void*, void*); FUNCTION(DynamicCastObjCClass, swift_dynamicCastObjCClass, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastObjCClassUnconditional(void*, void*); FUNCTION(DynamicCastObjCClassUnconditional, swift_dynamicCastObjCClassUnconditional, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastUnknownClass(void*, void*); FUNCTION(DynamicCastUnknownClass, swift_dynamicCastUnknownClass, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // void *swift_dynamicCastUnknownClassUnconditional(void*, void*); FUNCTION(DynamicCastUnknownClassUnconditional, swift_dynamicCastUnknownClassUnconditional, RuntimeCC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind, ReadOnly)) // type *swift_dynamicCastMetatype(type*, type*); FUNCTION(DynamicCastMetatype, swift_dynamicCastMetatype, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadOnly)) // type *swift_dynamicCastMetatypeUnconditional(type*, type*); FUNCTION(DynamicCastMetatypeUnconditional, swift_dynamicCastMetatypeUnconditional, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind, ReadOnly)) // objc_class *swift_dynamicCastObjCClassMetatype(objc_class*, objc_class*); FUNCTION(DynamicCastObjCClassMetatype, swift_dynamicCastObjCClassMetatype, RuntimeCC, RETURNS(ObjCClassPtrTy), ARGS(ObjCClassPtrTy, ObjCClassPtrTy), ATTRS(NoUnwind, ReadOnly)) // objc_class *swift_dynamicCastObjCClassMetatypeUnconditional(objc_class*, objc_class*); FUNCTION(DynamicCastObjCClassMetatypeUnconditional, swift_dynamicCastObjCClassMetatypeUnconditional, RuntimeCC, RETURNS(ObjCClassPtrTy), ARGS(ObjCClassPtrTy, ObjCClassPtrTy), ATTRS(NoUnwind, ReadOnly)) // bool swift_dynamicCast(opaque*, opaque*, type*, type*, size_t); FUNCTION(DynamicCast, swift_dynamicCast, RuntimeCC, RETURNS(Int1Ty), ARGS(OpaquePtrTy, OpaquePtrTy, TypeMetadataPtrTy, TypeMetadataPtrTy, SizeTy), ATTRS(NoUnwind, ReadOnly)) // type* swift_dynamicCastTypeToObjCProtocolUnconditional(type* object, // size_t numProtocols, // Protocol * const *protocols); FUNCTION(DynamicCastTypeToObjCProtocolUnconditional, swift_dynamicCastTypeToObjCProtocolUnconditional, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy), ATTRS(NoUnwind)) // type* swift_dynamicCastTypeToObjCProtocolConditional(type* object, // size_t numProtocols, // Protocol * const *protocols); FUNCTION(DynamicCastTypeToObjCProtocolConditional, swift_dynamicCastTypeToObjCProtocolConditional, RuntimeCC, RETURNS(TypeMetadataPtrTy), ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy), ATTRS(NoUnwind)) // id swift_dynamicCastObjCProtocolUnconditional(id object, // size_t numProtocols, // Protocol * const *protocols); FUNCTION(DynamicCastObjCProtocolUnconditional, swift_dynamicCastObjCProtocolUnconditional, RuntimeCC, RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy, SizeTy, Int8PtrPtrTy), ATTRS(NoUnwind)) // id swift_dynamicCastObjCProtocolConditional(id object, // size_t numProtocols, // Protocol * const *protocols); FUNCTION(DynamicCastObjCProtocolConditional, swift_dynamicCastObjCProtocolConditional, RuntimeCC, RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy, SizeTy, Int8PtrPtrTy), ATTRS(NoUnwind)) // id swift_dynamicCastMetatypeToObjectUnconditional(type *type); FUNCTION(DynamicCastMetatypeToObjectUnconditional, swift_dynamicCastMetatypeToObjectUnconditional, RuntimeCC, RETURNS(ObjCPtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // id swift_dynamicCastMetatypeToObjectConditional(type *type); FUNCTION(DynamicCastMetatypeToObjectConditional, swift_dynamicCastMetatypeToObjectConditional, RuntimeCC, RETURNS(ObjCPtrTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind, ReadNone)) // witness_table* swift_conformsToProtocol(type*, protocol*); FUNCTION(ConformsToProtocol, swift_conformsToProtocol, RuntimeCC, RETURNS(WitnessTablePtrTy), ARGS(TypeMetadataPtrTy, ProtocolDescriptorPtrTy), ATTRS(NoUnwind, ReadNone)) // void swift_once(swift_once_t *predicate, // void (*function_code)(RefCounted*)); FUNCTION(Once, swift_once, RuntimeCC, RETURNS(VoidTy), ARGS(OnceTy->getPointerTo(), Int8PtrTy), ATTRS()) // void swift_registerProtocolConformances(const ProtocolConformanceRecord *begin, // const ProtocolConformanceRecord *end) FUNCTION(RegisterProtocolConformances, swift_registerProtocolConformances, RuntimeCC, RETURNS(VoidTy), ARGS(ProtocolConformanceRecordPtrTy, ProtocolConformanceRecordPtrTy), ATTRS(NoUnwind)) FUNCTION(InstantiateObjCClass, swift_instantiateObjCClass, RuntimeCC, RETURNS(VoidTy), ARGS(TypeMetadataPtrTy), ATTRS(NoUnwind)) FUNCTION(GetInitializedObjCClass, swift_getInitializedObjCClass, RuntimeCC, RETURNS(ObjCClassPtrTy), ARGS(ObjCClassPtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCRetain, objc_retain, C_CC, RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCRelease, objc_release, C_CC, RETURNS(VoidTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCAutorelease, objc_autorelease, C_CC, RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCRetainAutoreleasedReturnValue, objc_retainAutoreleasedReturnValue, C_CC, RETURNS(Int8PtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCAutoreleaseReturnValue, objc_autoreleaseReturnValue, C_CC, RETURNS(ObjCPtrTy), ARGS(ObjCPtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCMsgSend, objc_msgSend, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCMsgSendStret, objc_msgSend_stret, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCMsgSendSuper, objc_msgSendSuper, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCMsgSendSuperStret, objc_msgSendSuper_stret, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCMsgSendSuper2, objc_msgSendSuper2, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCMsgSendSuperStret2, objc_msgSendSuper2_stret, C_CC, RETURNS(VoidTy), NO_ARGS, NO_ATTRS) FUNCTION(ObjCSelRegisterName, sel_registerName, C_CC, RETURNS(ObjCSELTy), ARGS(Int8PtrTy), ATTRS(NoUnwind, ReadNone)) FUNCTION(ClassReplaceMethod, class_replaceMethod, C_CC, RETURNS(Int8PtrTy), ARGS(ObjCClassPtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(ClassAddProtocol, class_addProtocol, C_CC, RETURNS(VoidTy), ARGS(ObjCClassPtrTy, Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCGetClass, objc_getClass, C_CC, RETURNS(ObjCClassPtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCGetMetaClass, objc_getMetaClass, C_CC, RETURNS(ObjCClassPtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(ObjCClassGetName, class_getName, C_CC, RETURNS(Int8PtrTy), ARGS(ObjCClassPtrTy), ATTRS(NoUnwind)) FUNCTION(GetObjCProtocol, objc_getProtocol, C_CC, RETURNS(ProtocolDescriptorPtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(AllocateObjCProtocol, objc_allocateProtocol, C_CC, RETURNS(ProtocolDescriptorPtrTy), ARGS(Int8PtrTy), ATTRS(NoUnwind)) FUNCTION(RegisterObjCProtocol, objc_registerProtocol, C_CC, RETURNS(VoidTy), ARGS(ProtocolDescriptorPtrTy), ATTRS(NoUnwind)) FUNCTION(ProtocolAddMethodDescription, protocol_addMethodDescription, C_CC, RETURNS(VoidTy), ARGS(ProtocolDescriptorPtrTy, Int8PtrTy, Int8PtrTy, ObjCBoolTy, ObjCBoolTy), ATTRS(NoUnwind)) FUNCTION(ProtocolAddProtocol, protocol_addProtocol, C_CC, RETURNS(VoidTy), ARGS(ProtocolDescriptorPtrTy, ProtocolDescriptorPtrTy), ATTRS(NoUnwind)) // void *_Block_copy(void *block); FUNCTION(BlockCopy, _Block_copy, C_CC, RETURNS(ObjCBlockPtrTy), ARGS(ObjCBlockPtrTy), NO_ATTRS) // void _Block_release(void *block); FUNCTION(BlockRelease, _Block_release, C_CC, RETURNS(VoidTy), ARGS(ObjCBlockPtrTy), ATTRS(NoUnwind)) // void swift_reportMissingMethod(); FUNCTION(DeadMethodError, swift_reportMissingMethod, C_CC, RETURNS(VoidTy), ARGS(), ATTRS(NoUnwind)) FUNCTION(AllocError, swift_allocError, C_CC, RETURNS(ErrorPtrTy, OpaquePtrTy), ARGS(TypeMetadataPtrTy, WitnessTablePtrTy), ATTRS(NoUnwind)) FUNCTION(DeallocError, swift_deallocError, C_CC, RETURNS(VoidTy), ARGS(ErrorPtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind)) FUNCTION(GetErrorValue, swift_getErrorValue, C_CC, RETURNS(VoidTy), ARGS(ErrorPtrTy, Int8PtrPtrTy, OpenedErrorTriplePtrTy), ATTRS(NoUnwind)) #undef RETURNS #undef ARGS #undef ATTRS #undef NO_ARGS #undef NO_ATTRS #undef FUNCTION #undef FUNCTION_NAME