Skip to content

Commit d030ae4

Browse files
hughbeGreg Parker
authored andcommitted
Cleanup uses of SWIFT_RT_ENTRY_VISIBILITY (#7103)
1 parent 59ddb5b commit d030ae4

File tree

6 files changed

+26
-72
lines changed

6 files changed

+26
-72
lines changed

stdlib/public/runtime/Casting.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,8 @@ _dynamicCastClassMetatype(const ClassMetadata *sourceType,
263263
}
264264

265265
/// Dynamically cast a class instance to a Swift class type.
266-
SWIFT_RT_ENTRY_VISIBILITY
267-
const void *
268-
swift::swift_dynamicCastClass(const void *object,
269-
const ClassMetadata *targetType)
266+
const void *swift::swift_dynamicCastClass(const void *object,
267+
const ClassMetadata *targetType)
270268
SWIFT_CC(RegisterPreservingCC_IMPL) {
271269
#if SWIFT_OBJC_INTEROP
272270
assert(!targetType->isPureObjC());
@@ -2421,9 +2419,8 @@ static bool _dynamicCastTupleToTuple(OpaqueValue *destination,
24212419
/******************************************************************************/
24222420

24232421
/// Perform a dynamic cast to an arbitrary type.
2424-
SWIFT_RT_ENTRY_VISIBILITY
2425-
bool swift::swift_dynamicCast(OpaqueValue *dest,
2426-
OpaqueValue *src,
2422+
2423+
bool swift::swift_dynamicCast(OpaqueValue *dest, OpaqueValue *src,
24272424
const Metadata *srcType,
24282425
const Metadata *targetType,
24292426
DynamicCastFlags flags)

stdlib/public/runtime/Enum.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,9 @@ swift::swift_initEnumValueWitnessTableSinglePayload(ValueWitnessTable *vwtable,
140140
}
141141
}
142142

143-
SWIFT_RT_ENTRY_VISIBILITY
144-
int
145-
swift::swift_getEnumCaseSinglePayload(const OpaqueValue *value,
146-
const Metadata *payload,
147-
unsigned emptyCases)
143+
int swift::swift_getEnumCaseSinglePayload(const OpaqueValue *value,
144+
const Metadata *payload,
145+
unsigned emptyCases)
148146
SWIFT_CC(RegisterPreservingCC_IMPL) {
149147
auto *payloadWitnesses = payload->getValueWitnesses();
150148
auto payloadSize = payloadWitnesses->getSize();
@@ -200,12 +198,9 @@ swift::swift_getEnumCaseSinglePayload(const OpaqueValue *value,
200198
return -1;
201199
}
202200

203-
SWIFT_RT_ENTRY_VISIBILITY
204-
void
205-
swift::swift_storeEnumTagSinglePayload(OpaqueValue *value,
206-
const Metadata *payload,
207-
int whichCase,
208-
unsigned emptyCases)
201+
void swift::swift_storeEnumTagSinglePayload(OpaqueValue *value,
202+
const Metadata *payload,
203+
int whichCase, unsigned emptyCases)
209204
SWIFT_CC(RegisterPreservingCC_IMPL) {
210205
auto *payloadWitnesses = payload->getValueWitnesses();
211206
auto payloadSize = payloadWitnesses->getSize();

stdlib/public/runtime/Heap.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
using namespace swift;
2424

25-
SWIFT_RT_ENTRY_VISIBILITY
2625
void *swift::swift_slowAlloc(size_t size, size_t alignMask)
2726
SWIFT_CC(RegisterPreservingCC_IMPL) {
2827
// FIXME: use posix_memalign if alignMask is larger than the system guarantee.
@@ -31,7 +30,6 @@ void *swift::swift_slowAlloc(size_t size, size_t alignMask)
3130
return p;
3231
}
3332

34-
SWIFT_RT_ENTRY_VISIBILITY
3533
void swift::swift_slowDealloc(void *ptr, size_t bytes, size_t alignMask)
3634
SWIFT_CC(RegisterPreservingCC_IMPL) {
3735
free(ptr);

stdlib/public/runtime/HeapObject.cpp

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141

4242
using namespace swift;
4343

44-
SWIFT_RT_ENTRY_VISIBILITY
45-
HeapObject *
46-
swift::swift_allocObject(HeapMetadata const *metadata,
47-
size_t requiredSize,
48-
size_t requiredAlignmentMask)
44+
HeapObject *swift::swift_allocObject(HeapMetadata const *metadata,
45+
size_t requiredSize,
46+
size_t requiredAlignmentMask)
4947
SWIFT_CC(RegisterPreservingCC_IMPL) {
5048
return SWIFT_RT_ENTRY_REF(swift_allocObject)(metadata, requiredSize,
5149
requiredAlignmentMask);
@@ -194,13 +192,11 @@ extern "C" LLVM_LIBRARY_VISIBILITY void
194192
_swift_release_dealloc(HeapObject *object) SWIFT_CC(RegisterPreservingCC_IMPL)
195193
__attribute__((__noinline__, __used__));
196194

197-
SWIFT_RT_ENTRY_VISIBILITY
198195
void swift::swift_retain(HeapObject *object)
199196
SWIFT_CC(RegisterPreservingCC_IMPL) {
200197
SWIFT_RT_ENTRY_REF(swift_retain)(object);
201198
}
202199

203-
SWIFT_RT_ENTRY_VISIBILITY
204200
void swift::swift_nonatomic_retain(HeapObject *object) {
205201
SWIFT_RT_ENTRY_REF(swift_nonatomic_retain)(object);
206202
}
@@ -211,7 +207,6 @@ void SWIFT_RT_ENTRY_IMPL(swift_nonatomic_retain)(HeapObject *object) {
211207
_swift_nonatomic_retain_inlined(object);
212208
}
213209

214-
SWIFT_RT_ENTRY_VISIBILITY
215210
void swift::swift_nonatomic_release(HeapObject *object) {
216211
return SWIFT_RT_ENTRY_REF(swift_nonatomic_release)(object);
217212
}
@@ -232,7 +227,6 @@ void SWIFT_RT_ENTRY_IMPL(swift_retain)(HeapObject *object)
232227
_swift_retain_inlined(object);
233228
}
234229

235-
SWIFT_RT_ENTRY_VISIBILITY
236230
void swift::swift_retain_n(HeapObject *object, uint32_t n)
237231
SWIFT_CC(RegisterPreservingCC_IMPL) {
238232
SWIFT_RT_ENTRY_REF(swift_retain_n)(object, n);
@@ -247,7 +241,6 @@ void SWIFT_RT_ENTRY_IMPL(swift_retain_n)(HeapObject *object, uint32_t n)
247241
}
248242
}
249243

250-
SWIFT_RT_ENTRY_VISIBILITY
251244
void swift::swift_nonatomic_retain_n(HeapObject *object, uint32_t n)
252245
SWIFT_CC(RegisterPreservingCC_IMPL) {
253246
SWIFT_RT_ENTRY_REF(swift_nonatomic_retain_n)(object, n);
@@ -262,7 +255,6 @@ void SWIFT_RT_ENTRY_IMPL(swift_nonatomic_retain_n)(HeapObject *object, uint32_t
262255
}
263256
}
264257

265-
SWIFT_RT_ENTRY_VISIBILITY
266258
void swift::swift_release(HeapObject *object)
267259
SWIFT_CC(RegisterPreservingCC_IMPL) {
268260
SWIFT_RT_ENTRY_REF(swift_release)(object);
@@ -277,7 +269,6 @@ void SWIFT_RT_ENTRY_IMPL(swift_release)(HeapObject *object)
277269
}
278270
}
279271

280-
SWIFT_RT_ENTRY_VISIBILITY
281272
void swift::swift_release_n(HeapObject *object, uint32_t n)
282273
SWIFT_CC(RegisterPreservingCC_IMPL) {
283274
return SWIFT_RT_ENTRY_REF(swift_release_n)(object, n);
@@ -296,7 +287,6 @@ void swift::swift_setDeallocating(HeapObject *object) {
296287
object->refCount.decrementFromOneAndDeallocateNonAtomic();
297288
}
298289

299-
SWIFT_RT_ENTRY_VISIBILITY
300290
void swift::swift_nonatomic_release_n(HeapObject *object, uint32_t n)
301291
SWIFT_CC(RegisterPreservingCC_IMPL) {
302292
return SWIFT_RT_ENTRY_REF(swift_nonatomic_release_n)(object, n);
@@ -319,7 +309,6 @@ size_t swift::swift_unownedRetainCount(HeapObject *object) {
319309
return object->weakRefCount.getCount();
320310
}
321311

322-
SWIFT_RT_ENTRY_VISIBILITY
323312
void swift::swift_unownedRetain(HeapObject *object)
324313
SWIFT_CC(RegisterPreservingCC_IMPL) {
325314
if (!object)
@@ -328,7 +317,6 @@ void swift::swift_unownedRetain(HeapObject *object)
328317
object->weakRefCount.increment();
329318
}
330319

331-
SWIFT_RT_ENTRY_VISIBILITY
332320
void swift::swift_unownedRelease(HeapObject *object)
333321
SWIFT_CC(RegisterPreservingCC_IMPL) {
334322
if (!object)
@@ -346,7 +334,6 @@ void swift::swift_unownedRelease(HeapObject *object)
346334
}
347335
}
348336

349-
SWIFT_RT_ENTRY_VISIBILITY
350337
void swift::swift_unownedRetain_n(HeapObject *object, int n)
351338
SWIFT_CC(RegisterPreservingCC_IMPL) {
352339
if (!object)
@@ -355,7 +342,6 @@ void swift::swift_unownedRetain_n(HeapObject *object, int n)
355342
object->weakRefCount.increment(n);
356343
}
357344

358-
SWIFT_RT_ENTRY_VISIBILITY
359345
void swift::swift_unownedRelease_n(HeapObject *object, int n)
360346
SWIFT_CC(RegisterPreservingCC_IMPL) {
361347
if (!object)
@@ -373,7 +359,6 @@ void swift::swift_unownedRelease_n(HeapObject *object, int n)
373359
}
374360
}
375361

376-
SWIFT_RT_ENTRY_VISIBILITY
377362
HeapObject *swift::swift_tryPin(HeapObject *object)
378363
SWIFT_CC(RegisterPreservingCC_IMPL) {
379364
assert(object);
@@ -389,21 +374,18 @@ HeapObject *swift::swift_tryPin(HeapObject *object)
389374
return nullptr;
390375
}
391376

392-
SWIFT_RT_ENTRY_VISIBILITY
393377
void swift::swift_unpin(HeapObject *object)
394378
SWIFT_CC(RegisterPreservingCC_IMPL) {
395379
if (object && object->refCount.decrementAndUnpinShouldDeallocate()) {
396380
_swift_release_dealloc(object);
397381
}
398382
}
399383

400-
SWIFT_RT_ENTRY_VISIBILITY
401384
HeapObject *swift::swift_tryRetain(HeapObject *object)
402385
SWIFT_CC(RegisterPreservingCC_IMPL) {
403386
return SWIFT_RT_ENTRY_REF(swift_tryRetain)(object);
404387
}
405388

406-
SWIFT_RT_ENTRY_VISIBILITY
407389
HeapObject *swift::swift_nonatomic_tryPin(HeapObject *object)
408390
SWIFT_CC(RegisterPreservingCC_IMPL) {
409391
assert(object);
@@ -419,7 +401,6 @@ HeapObject *swift::swift_nonatomic_tryPin(HeapObject *object)
419401
return nullptr;
420402
}
421403

422-
SWIFT_RT_ENTRY_VISIBILITY
423404
void swift::swift_nonatomic_unpin(HeapObject *object)
424405
SWIFT_CC(RegisterPreservingCC_IMPL) {
425406
if (object && object->refCount.decrementAndUnpinShouldDeallocateNonAtomic()) {
@@ -450,7 +431,6 @@ bool SWIFT_RT_ENTRY_IMPL(swift_isDeallocating)(HeapObject *object) {
450431
return object->refCount.isDeallocating();
451432
}
452433

453-
SWIFT_RT_ENTRY_VISIBILITY
454434
void swift::swift_unownedRetainStrong(HeapObject *object)
455435
SWIFT_CC(RegisterPreservingCC_IMPL) {
456436
if (!object)
@@ -462,9 +442,7 @@ void swift::swift_unownedRetainStrong(HeapObject *object)
462442
_swift_abortRetainUnowned(object);
463443
}
464444

465-
SWIFT_RT_ENTRY_VISIBILITY
466-
void
467-
swift::swift_unownedRetainStrongAndRelease(HeapObject *object)
445+
void swift::swift_unownedRetainStrongAndRelease(HeapObject *object)
468446
SWIFT_CC(RegisterPreservingCC_IMPL) {
469447
if (!object)
470448
return;
@@ -591,9 +569,7 @@ static inline void memset_pattern8(void *b, const void *pattern8, size_t len) {
591569
}
592570
#endif
593571

594-
SWIFT_RT_ENTRY_VISIBILITY
595-
void swift::swift_deallocObject(HeapObject *object,
596-
size_t allocatedSize,
572+
void swift::swift_deallocObject(HeapObject *object, size_t allocatedSize,
597573
size_t allocatedAlignMask)
598574
SWIFT_CC(RegisterPreservingCC_IMPL) {
599575
assert(isAlignmentMask(allocatedAlignMask));

stdlib/public/runtime/Metadata.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,8 @@ swift::swift_allocateGenericValueMetadata(GenericMetadata *pattern,
225225
}
226226

227227
/// The primary entrypoint.
228-
SWIFT_RT_ENTRY_VISIBILITY
229-
const Metadata *
230-
swift::swift_getGenericMetadata(GenericMetadata *pattern,
231-
const void *arguments)
228+
const Metadata *swift::swift_getGenericMetadata(GenericMetadata *pattern,
229+
const void *arguments)
232230
SWIFT_CC(RegisterPreservingCC_IMPL) {
233231
auto genericArgs = (const void * const *) arguments;
234232
size_t numGenericArgs = pattern->NumKeyArguments;
@@ -2364,7 +2362,6 @@ ExistentialTypeMetadata::getWitnessTable(const OpaqueValue *container,
23642362

23652363
/// \brief Fetch a uniqued metadata for an existential type. The array
23662364
/// referenced by \c protocols will be sorted in-place.
2367-
SWIFT_RT_ENTRY_VISIBILITY
23682365
const ExistentialTypeMetadata *
23692366
swift::swift_getExistentialTypeMetadata(size_t numProtocols,
23702367
const ProtocolDescriptor **protocols)
@@ -2772,12 +2769,9 @@ allocateWitnessTable(GenericWitnessTable *genericTable,
27722769
return entry;
27732770
}
27742771

2775-
SWIFT_RT_ENTRY_VISIBILITY
2776-
const WitnessTable *
2777-
swift::swift_getGenericWitnessTable(GenericWitnessTable *genericTable,
2778-
const Metadata *type,
2779-
void * const *instantiationArgs)
2780-
SWIFT_CC(RegisterPreservingCC_IMPL) {
2772+
const WitnessTable *swift::swift_getGenericWitnessTable(
2773+
GenericWitnessTable *genericTable, const Metadata *type,
2774+
void *const *instantiationArgs) SWIFT_CC(RegisterPreservingCC_IMPL) {
27812775
if (doesNotRequireInstantiation(genericTable)) {
27822776
return genericTable->Pattern;
27832777
}

stdlib/public/runtime/SwiftObject.mm

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,10 +1340,8 @@ static bool usesNativeSwiftReferenceCounting_nonNull(
13401340
}
13411341
#endif
13421342

1343-
SWIFT_RT_ENTRY_VISIBILITY
1344-
bool swift::swift_isUniquelyReferenced_nonNull_native(
1345-
const HeapObject* object
1346-
) SWIFT_CC(RegisterPreservingCC_IMPL) {
1343+
bool swift::swift_isUniquelyReferenced_nonNull_native(const HeapObject *object)
1344+
SWIFT_CC(RegisterPreservingCC_IMPL) {
13471345
assert(object != nullptr);
13481346
assert(!object->refCount.isDeallocating());
13491347
return object->refCount.isUniquelyReferenced();
@@ -1439,21 +1437,17 @@ static bool usesNativeSwiftReferenceCounting_nonNull(
14391437
// Given a non-@objc object reference, return true iff the
14401438
// object is non-nil and either has a strong reference count of 1
14411439
// or is pinned.
1442-
SWIFT_RT_ENTRY_VISIBILITY
1443-
bool swift::swift_isUniquelyReferencedOrPinned_native(
1444-
const HeapObject* object)
1440+
bool swift::swift_isUniquelyReferencedOrPinned_native(const HeapObject *object)
14451441
SWIFT_CC(RegisterPreservingCC_IMPL) {
1446-
return object != nullptr
1447-
&& swift_isUniquelyReferencedOrPinned_nonNull_native(object);
1442+
return object != nullptr &&
1443+
swift_isUniquelyReferencedOrPinned_nonNull_native(object);
14481444
}
14491445

14501446
/// Given a non-nil native swift object reference, return true if
14511447
/// either the object has a strong reference count of 1 or its
14521448
/// pinned flag is set.
1453-
SWIFT_RT_ENTRY_VISIBILITY
14541449
bool swift::swift_isUniquelyReferencedOrPinned_nonNull_native(
1455-
const HeapObject* object)
1456-
SWIFT_CC(RegisterPreservingCC_IMPL) {
1450+
const HeapObject *object) SWIFT_CC(RegisterPreservingCC_IMPL) {
14571451
assert(object != nullptr);
14581452
assert(!object->refCount.isDeallocating());
14591453
return object->refCount.isUniquelyReferencedOrPinned();

0 commit comments

Comments
 (0)