@@ -373,21 +373,17 @@ class RefCountBitsT {
373
373
// to improve performance of debug builds.
374
374
375
375
private:
376
- LLVM_ATTRIBUTE_ALWAYS_INLINE
377
- bool getUseSlowRC() const {
378
- return bool (getField (UseSlowRC));
379
- }
376
+ SWIFT_ALWAYS_INLINE
377
+ bool getUseSlowRC() const { return bool (getField (UseSlowRC)); }
380
378
381
- LLVM_ATTRIBUTE_ALWAYS_INLINE
382
- void setUseSlowRC (bool value) {
383
- setField (UseSlowRC, value);
384
- }
379
+ SWIFT_ALWAYS_INLINE
380
+ void setUseSlowRC (bool value) { setField (UseSlowRC, value); }
385
381
386
382
public:
387
383
388
384
enum Immortal_t { Immortal };
389
385
390
- LLVM_ATTRIBUTE_ALWAYS_INLINE
386
+ SWIFT_ALWAYS_INLINE
391
387
bool isImmortal (bool checkSlowRCBit) const {
392
388
if (checkSlowRCBit) {
393
389
return (getField (IsImmortal) == Offsets::IsImmortalMask) &&
@@ -396,51 +392,51 @@ class RefCountBitsT {
396
392
return (getField (IsImmortal) == Offsets::IsImmortalMask);
397
393
}
398
394
}
399
-
400
- LLVM_ATTRIBUTE_ALWAYS_INLINE
395
+
396
+ SWIFT_ALWAYS_INLINE
401
397
bool isOverflowingUnownedRefCount (uint32_t oldValue, uint32_t inc) const {
402
398
auto newValue = getUnownedRefCount ();
403
399
return newValue != oldValue + inc ||
404
400
newValue == Offsets::UnownedRefCountMask;
405
401
}
406
-
407
- LLVM_ATTRIBUTE_ALWAYS_INLINE
402
+
403
+ SWIFT_ALWAYS_INLINE
408
404
void setIsImmortal (bool value) {
409
405
assert (value);
410
406
setField (IsImmortal, Offsets::IsImmortalMask);
411
407
setField (UseSlowRC, value);
412
408
}
413
-
414
- LLVM_ATTRIBUTE_ALWAYS_INLINE
409
+
410
+ SWIFT_ALWAYS_INLINE
415
411
bool pureSwiftDeallocation () const {
416
412
return bool (getField (PureSwiftDealloc)) && !bool (getField (UseSlowRC));
417
413
}
418
-
419
- LLVM_ATTRIBUTE_ALWAYS_INLINE
414
+
415
+ SWIFT_ALWAYS_INLINE
420
416
void setPureSwiftDeallocation (bool value) {
421
417
setField (PureSwiftDealloc, value);
422
418
}
423
-
424
- LLVM_ATTRIBUTE_ALWAYS_INLINE
419
+
420
+ SWIFT_ALWAYS_INLINE
425
421
RefCountBitsT () = default;
426
422
427
- LLVM_ATTRIBUTE_ALWAYS_INLINE
423
+ SWIFT_ALWAYS_INLINE
428
424
constexpr
429
425
RefCountBitsT (uint32_t strongExtraCount, uint32_t unownedCount)
430
426
: bits((BitsType(strongExtraCount) << Offsets::StrongExtraRefCountShift) |
431
427
(BitsType(1 ) << Offsets::PureSwiftDeallocShift) |
432
428
(BitsType(unownedCount) << Offsets::UnownedRefCountShift))
433
429
{ }
434
-
435
- LLVM_ATTRIBUTE_ALWAYS_INLINE
430
+
431
+ SWIFT_ALWAYS_INLINE
436
432
constexpr
437
433
RefCountBitsT (Immortal_t immortal)
438
434
: bits((BitsType(2 ) << Offsets::StrongExtraRefCountShift) |
439
435
(BitsType(Offsets::IsImmortalMask)) |
440
436
(BitsType(1 ) << Offsets::UseSlowRCShift))
441
437
{ }
442
438
443
- LLVM_ATTRIBUTE_ALWAYS_INLINE
439
+ SWIFT_ALWAYS_INLINE
444
440
RefCountBitsT (HeapObjectSideTableEntry* side)
445
441
: bits((reinterpret_cast <BitsType>(side) >> Offsets::SideTableUnusedLowBits)
446
442
| (BitsType(1 ) << Offsets::UseSlowRCShift)
@@ -449,7 +445,7 @@ class RefCountBitsT {
449
445
assert (refcountIsInline);
450
446
}
451
447
452
- LLVM_ATTRIBUTE_ALWAYS_INLINE
448
+ SWIFT_ALWAYS_INLINE
453
449
RefCountBitsT (const RefCountBitsT<RefCountIsInline> *newbitsPtr) {
454
450
bits = 0 ;
455
451
@@ -472,8 +468,8 @@ class RefCountBitsT {
472
468
copyFieldFrom (newbits, UseSlowRC);
473
469
}
474
470
}
475
-
476
- LLVM_ATTRIBUTE_ALWAYS_INLINE
471
+
472
+ SWIFT_ALWAYS_INLINE
477
473
bool hasSideTable () const {
478
474
bool hasSide = getUseSlowRC () && !isImmortal (false );
479
475
@@ -484,7 +480,7 @@ class RefCountBitsT {
484
480
return hasSide;
485
481
}
486
482
487
- LLVM_ATTRIBUTE_ALWAYS_INLINE
483
+ SWIFT_ALWAYS_INLINE
488
484
HeapObjectSideTableEntry *getSideTable () const {
489
485
assert (hasSideTable ());
490
486
@@ -493,32 +489,31 @@ class RefCountBitsT {
493
489
(uintptr_t (getField (SideTable)) << Offsets::SideTableUnusedLowBits);
494
490
}
495
491
496
- LLVM_ATTRIBUTE_ALWAYS_INLINE
492
+ SWIFT_ALWAYS_INLINE
497
493
uint32_t getUnownedRefCount () const {
498
494
assert (!hasSideTable ());
499
495
return uint32_t (getField (UnownedRefCount));
500
496
}
501
497
502
- LLVM_ATTRIBUTE_ALWAYS_INLINE
498
+ SWIFT_ALWAYS_INLINE
503
499
bool getIsDeiniting () const {
504
500
assert (!hasSideTable ());
505
501
return bool (getField (IsDeiniting));
506
502
}
507
503
508
- LLVM_ATTRIBUTE_ALWAYS_INLINE
504
+ SWIFT_ALWAYS_INLINE
509
505
uint32_t getStrongExtraRefCount () const {
510
506
assert (!hasSideTable ());
511
507
return uint32_t (getField (StrongExtraRefCount));
512
508
}
513
509
514
-
515
- LLVM_ATTRIBUTE_ALWAYS_INLINE
510
+ SWIFT_ALWAYS_INLINE
516
511
void setHasSideTable (bool value) {
517
512
bits = 0 ;
518
513
setUseSlowRC (value);
519
514
}
520
515
521
- LLVM_ATTRIBUTE_ALWAYS_INLINE
516
+ SWIFT_ALWAYS_INLINE
522
517
void setSideTable (HeapObjectSideTableEntry *side) {
523
518
assert (hasSideTable ());
524
519
// Stored value is a shifted pointer.
@@ -529,19 +524,19 @@ class RefCountBitsT {
529
524
setField (SideTableMark, 1 );
530
525
}
531
526
532
- LLVM_ATTRIBUTE_ALWAYS_INLINE
527
+ SWIFT_ALWAYS_INLINE
533
528
void setUnownedRefCount (uint32_t value) {
534
529
assert (!hasSideTable ());
535
530
setField (UnownedRefCount, value);
536
531
}
537
532
538
- LLVM_ATTRIBUTE_ALWAYS_INLINE
533
+ SWIFT_ALWAYS_INLINE
539
534
void setIsDeiniting (bool value) {
540
535
assert (!hasSideTable ());
541
536
setField (IsDeiniting, value);
542
537
}
543
538
544
- LLVM_ATTRIBUTE_ALWAYS_INLINE
539
+ SWIFT_ALWAYS_INLINE
545
540
void setStrongExtraRefCount (uint32_t value) {
546
541
assert (!hasSideTable ());
547
542
setField (StrongExtraRefCount, value);
@@ -551,8 +546,8 @@ class RefCountBitsT {
551
546
// Returns true if the increment is a fast-path result.
552
547
// Returns false if the increment should fall back to some slow path
553
548
// (for example, because UseSlowRC is set or because the refcount overflowed).
554
- LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE
555
- bool incrementStrongExtraRefCount (uint32_t inc) {
549
+ LLVM_NODISCARD SWIFT_ALWAYS_INLINE bool
550
+ incrementStrongExtraRefCount (uint32_t inc) {
556
551
// This deliberately overflows into the UseSlowRC field.
557
552
bits += BitsType (inc) << Offsets::StrongExtraRefCountShift;
558
553
return (SignedBitsType (bits) >= 0 );
@@ -562,8 +557,8 @@ class RefCountBitsT {
562
557
// Returns false if the decrement should fall back to some slow path
563
558
// (for example, because UseSlowRC is set
564
559
// or because the refcount is now zero and should deinit).
565
- LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE
566
- bool decrementStrongExtraRefCount (uint32_t dec) {
560
+ LLVM_NODISCARD SWIFT_ALWAYS_INLINE bool
561
+ decrementStrongExtraRefCount (uint32_t dec) {
567
562
#ifndef NDEBUG
568
563
if (!hasSideTable () && !isImmortal (false )) {
569
564
// Can't check these assertions with side table present.
@@ -583,19 +578,19 @@ class RefCountBitsT {
583
578
}
584
579
585
580
// Returns the old reference count before the increment.
586
- LLVM_ATTRIBUTE_ALWAYS_INLINE
581
+ SWIFT_ALWAYS_INLINE
587
582
uint32_t incrementUnownedRefCount (uint32_t inc) {
588
583
uint32_t old = getUnownedRefCount ();
589
584
setUnownedRefCount (old + inc);
590
585
return old;
591
586
}
592
587
593
- LLVM_ATTRIBUTE_ALWAYS_INLINE
588
+ SWIFT_ALWAYS_INLINE
594
589
void decrementUnownedRefCount (uint32_t dec) {
595
590
setUnownedRefCount (getUnownedRefCount () - dec);
596
591
}
597
592
598
- LLVM_ATTRIBUTE_ALWAYS_INLINE
593
+ SWIFT_ALWAYS_INLINE
599
594
bool isUniquelyReferenced () {
600
595
static_assert (Offsets::UnownedRefCountBitCount +
601
596
Offsets::IsDeinitingBitCount +
@@ -614,7 +609,7 @@ class RefCountBitsT {
614
609
!getUseSlowRC () && !getIsDeiniting () && getStrongExtraRefCount () == 0 ;
615
610
}
616
611
617
- LLVM_ATTRIBUTE_ALWAYS_INLINE
612
+ SWIFT_ALWAYS_INLINE
618
613
BitsType getBitsValue () {
619
614
return bits;
620
615
}
@@ -636,45 +631,41 @@ class alignas(sizeof(void*) * 2) SideTableRefCountBits : public RefCountBitsT<Re
636
631
uint32_t weakBits;
637
632
638
633
public:
639
- LLVM_ATTRIBUTE_ALWAYS_INLINE
640
- SideTableRefCountBits () = default ;
634
+ SWIFT_ALWAYS_INLINE
635
+ SideTableRefCountBits () = default ;
641
636
642
- LLVM_ATTRIBUTE_ALWAYS_INLINE
643
- constexpr
644
- SideTableRefCountBits ( uint32_t strongExtraCount, uint32_t unownedCount)
645
- : RefCountBitsT<RefCountNotInline>(strongExtraCount, unownedCount)
646
- // weak refcount starts at 1 on behalf of the unowned count
647
- , weakBits ( 1 )
648
- { }
637
+ SWIFT_ALWAYS_INLINE
638
+ constexpr SideTableRefCountBits ( uint32_t strongExtraCount,
639
+ uint32_t unownedCount)
640
+ : RefCountBitsT<RefCountNotInline>(strongExtraCount, unownedCount)
641
+ // weak refcount starts at 1 on behalf of the unowned count
642
+ ,
643
+ weakBits ( 1 ) { }
649
644
650
- LLVM_ATTRIBUTE_ALWAYS_INLINE
651
- SideTableRefCountBits (HeapObjectSideTableEntry* side) = delete ;
645
+ SWIFT_ALWAYS_INLINE
646
+ SideTableRefCountBits (HeapObjectSideTableEntry * side) = delete ;
652
647
653
- LLVM_ATTRIBUTE_ALWAYS_INLINE
654
- SideTableRefCountBits (InlineRefCountBits newbits)
655
- : RefCountBitsT<RefCountNotInline>(&newbits), weakBits (1 )
656
- { }
648
+ SWIFT_ALWAYS_INLINE
649
+ SideTableRefCountBits (InlineRefCountBits newbits)
650
+ : RefCountBitsT<RefCountNotInline>(&newbits), weakBits (1 ) {}
657
651
658
-
659
- LLVM_ATTRIBUTE_ALWAYS_INLINE
660
- void incrementWeakRefCount () {
661
- weakBits++;
662
- }
652
+ SWIFT_ALWAYS_INLINE
653
+ void incrementWeakRefCount () { weakBits++; }
663
654
664
- LLVM_ATTRIBUTE_ALWAYS_INLINE
665
- bool decrementWeakRefCount () {
666
- assert (weakBits > 0 );
667
- weakBits--;
668
- return weakBits == 0 ;
655
+ SWIFT_ALWAYS_INLINE
656
+ bool decrementWeakRefCount () {
657
+ assert (weakBits > 0 );
658
+ weakBits--;
659
+ return weakBits == 0 ;
669
660
}
670
661
671
- LLVM_ATTRIBUTE_ALWAYS_INLINE
662
+ SWIFT_ALWAYS_INLINE
672
663
uint32_t getWeakRefCount () {
673
664
return weakBits;
674
665
}
675
666
676
667
// Side table ref count never has a side table of its own.
677
- LLVM_ATTRIBUTE_ALWAYS_INLINE
668
+ SWIFT_ALWAYS_INLINE
678
669
bool hasSideTable () {
679
670
return false ;
680
671
}
@@ -882,22 +873,22 @@ class RefCounts {
882
873
883
874
// Decrement the reference count.
884
875
// Return true if the caller should now deinit the object.
885
- LLVM_ATTRIBUTE_ALWAYS_INLINE
876
+ SWIFT_ALWAYS_INLINE
886
877
bool decrementShouldDeinit (uint32_t dec) {
887
878
return doDecrement<DontPerformDeinit>(dec);
888
879
}
889
880
890
- LLVM_ATTRIBUTE_ALWAYS_INLINE
881
+ SWIFT_ALWAYS_INLINE
891
882
bool decrementShouldDeinitNonAtomic (uint32_t dec) {
892
883
return doDecrementNonAtomic<DontPerformDeinit>(dec);
893
884
}
894
885
895
- LLVM_ATTRIBUTE_ALWAYS_INLINE
886
+ SWIFT_ALWAYS_INLINE
896
887
void decrementAndMaybeDeinit (uint32_t dec) {
897
888
doDecrement<DoPerformDeinit>(dec);
898
889
}
899
890
900
- LLVM_ATTRIBUTE_ALWAYS_INLINE
891
+ SWIFT_ALWAYS_INLINE
901
892
void decrementAndMaybeDeinitNonAtomic (uint32_t dec) {
902
893
doDecrementNonAtomic<DoPerformDeinit>(dec);
903
894
}
@@ -1472,9 +1463,9 @@ class HeapObjectSideTableEntry {
1472
1463
// This version can actually be non-atomic.
1473
1464
template <>
1474
1465
template <PerformDeinit performDeinit>
1475
- LLVM_ATTRIBUTE_ALWAYS_INLINE
1476
- inline bool RefCounts<InlineRefCountBits>::doDecrementNonAtomic(uint32_t dec) {
1477
-
1466
+ SWIFT_ALWAYS_INLINE inline bool
1467
+ RefCounts<InlineRefCountBits>::doDecrementNonAtomic(uint32_t dec) {
1468
+
1478
1469
// We can get away without atomicity here.
1479
1470
// The caller claims that there are no other threads with strong references
1480
1471
// to this object.
0 commit comments