Skip to content

Commit ff4b055

Browse files
Merge pull request #7237 from aschwaighofer/switch_to_swift_calling_conv
Switch to swift calling conv
2 parents 2869ddc + 6c35202 commit ff4b055

File tree

222 files changed

+3747
-1519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+3747
-1519
lines changed

include/swift/Runtime/Config.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#ifdef __s390x__
3737
#define SWIFT_USE_SWIFTCALL 1
3838
#else
39-
#define SWIFT_USE_SWIFTCALL 0
39+
#define SWIFT_USE_SWIFTCALL 1
4040
#endif
4141
#endif
4242

@@ -128,6 +128,11 @@
128128

129129
#define SWIFT_LLVM_CC_RegisterPreservingCC llvm::CallingConv::PreserveMost
130130

131+
#if SWIFT_USE_SWIFTCALL
132+
#define SWIFT_LLVM_CC_SwiftCC llvm::CallingConv::Swift
133+
#else
134+
#define SWIFT_LLVM_CC_SwiftCC llvm::CallingConv::C
135+
#endif
131136

132137
// If defined, it indicates that runtime function wrappers
133138
// should be used on all platforms, even they do not support

include/swift/Runtime/HeapObject.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ using BoxPair = TwoWordPair<HeapObject *, OpaqueValue *>;
155155
/// The heap object has an initial retain count of 1, and its metadata is set
156156
/// such that destroying the heap object destroys the contained value.
157157
SWIFT_RUNTIME_EXPORT
158-
BoxPair::Return swift_allocBox(Metadata const *type)
159-
SWIFT_CC(swift);
158+
BoxPair::Return swift_allocBox(Metadata const *type);
160159

161160
SWIFT_RUNTIME_EXPORT
162-
BoxPair::Return (*_swift_allocBox)(Metadata const *type)
163-
SWIFT_CC(swift);
161+
BoxPair::Return (*_swift_allocBox)(Metadata const *type);
164162

165163

166164
// Allocate plain old memory. This is the generalized entry point

include/swift/Runtime/Metadata.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ const FullOpaqueMetadata METADATA_SYM(BO); // Builtin.UnknownObject
13311331
struct HeapMetadataHeaderPrefix {
13321332
/// Destroy the object, returning the allocated size of the object
13331333
/// or 0 if the object shouldn't be deallocated.
1334-
void (*destroy)(HeapObject *);
1334+
SWIFT_CC(swift) void (*destroy)(SWIFT_CONTEXT HeapObject *);
13351335
};
13361336

13371337
/// The header present on all heap metadata.
@@ -1548,7 +1548,7 @@ struct TargetNominalTypeDescriptor {
15481548
};
15491549
using NominalTypeDescriptor = TargetNominalTypeDescriptor<InProcess>;
15501550

1551-
typedef void (*ClassIVarDestroyer)(HeapObject *);
1551+
typedef SWIFT_CC(swift) void (*ClassIVarDestroyer)(SWIFT_CONTEXT HeapObject *);
15521552

15531553
/// The structure of all class metadata. This structure is embedded
15541554
/// directly within the class's heap metadata structure and therefore
@@ -3488,6 +3488,7 @@ std::string nameForMetadata(const Metadata *type,
34883488

34893489
/// Return the superclass, if any. The result is nullptr for root
34903490
/// classes and class protocol types.
3491+
SWIFT_CC(swift)
34913492
SWIFT_RUNTIME_STDLIB_INTERFACE
34923493
const Metadata *_swift_class_getSuperclass(const Metadata *theClass);
34933494

include/swift/Runtime/Reflection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct MirrorReturn {
4646
///
4747
/// Produce a mirror for any value. The runtime produces a mirror that
4848
/// structurally reflects values of any type.
49+
SWIFT_CC(swift)
4950
SWIFT_RUNTIME_EXPORT
5051
MirrorReturn
5152
swift_reflectAny(OpaqueValue *value, const Metadata *T);

include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
5454
/// in source control, you should also update the comment to briefly
5555
/// describe what change you made. The content of this comment isn't important;
5656
/// it just ensures a conflict if two people change the module format.
57-
const uint16_t VERSION_MINOR = 315; // Last change: uniquely identify extensions
57+
const uint16_t VERSION_MINOR = 316; // Last change: Swift calling convention
5858

5959
using DeclID = PointerEmbeddedInt<unsigned, 31>;
6060
using DeclIDField = BCFixed<31>;

lib/IRGen/Explosion.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ class ExplosionSchema {
233233
return Elements[index];
234234
}
235235

236-
bool requiresIndirectParameter(IRGenModule &IGM) const;
237-
bool requiresIndirectResult(IRGenModule &IGM) const;
238-
239236
typedef SmallVectorImpl<Element>::iterator iterator;
240237
typedef SmallVectorImpl<Element>::const_iterator const_iterator;
241238

@@ -255,13 +252,6 @@ class ExplosionSchema {
255252
/// - the element type, if the schema contains exactly one element;
256253
/// - an anonymous struct type concatenating those types, otherwise.
257254
llvm::Type *getScalarResultType(IRGenModule &IGM) const;
258-
259-
/// Treating the types in this schema as potential arguments to a
260-
/// function call, add them to the end of the given vector of types.
261-
void addToArgTypes(IRGenModule &IGM,
262-
const TypeInfo &TI,
263-
llvm::AttributeSet &Attrs,
264-
SmallVectorImpl<llvm::Type*> &types) const;
265255
};
266256

267257
} // end namespace irgen

0 commit comments

Comments
 (0)