@@ -625,41 +625,6 @@ internal enum KeyPathComponent: Hashable {
625625 }
626626}
627627
628- // _semantics("optimize.sil.preserve_exclusivity" forces the compiler to
629- // generate access markers regardless of the current build settings. This way,
630- // user code that accesses keypaths are properly enforced even if the standard
631- // library has exclusivity checking internally disabled. The semantic attribute
632- // must be consistently applied to both the begin and end unpaired access
633- // markers, otherwise the runtime will fail catastrophically and unpredictably.
634- // This relies on Swift module serialization occurring before these _semantic
635- // function are inlined, since inlining would unpredictably cause the attribute
636- // to be dropped.
637- //
638- // An exclusivity violation will report the caller's stack frame location.
639- // Runtime diagnostics will be improved by inlining this function. However, this
640- // cannot be marked @transparent because it can't be inlined prior to
641- // serialization.
642- @inlinable
643- @inline ( __always)
644- @_semantics ( " optimize.sil.preserve_exclusivity " )
645- func beginAccessHelper< T> ( _ address: Builtin . RawPointer , _ accessRecordPtr: Builtin . RawPointer , _ type: T . Type ) {
646- Builtin . beginUnpairedModifyAccess ( address, accessRecordPtr, type)
647- }
648-
649- @inlinable
650- @inline ( __always)
651- @_semantics ( " optimize.sil.preserve_exclusivity " )
652- func endAccessHelper( _ accessRecordPtr: Builtin . RawPointer ) {
653- Builtin . endUnpairedAccess ( accessRecordPtr)
654- }
655-
656- @inlinable
657- @inline ( __always)
658- @_semantics ( " optimize.sil.preserve_exclusivity " )
659- func instantaneousAccessHelper< T> ( _ address: Builtin . RawPointer , _ type: T . Type ) {
660- Builtin . performInstantaneousReadAccess ( address, T . self)
661- }
662-
663628// A class that maintains ownership of another object while a mutable projection
664629// into it is underway. The lifetime of the instance of this class is also used
665630// to begin and end exclusive 'modify' access to the projected address.
@@ -714,7 +679,7 @@ internal final class ClassHolder<ProjectionType> {
714679
715680 // Begin a 'modify' access to the address. This access is ended in
716681 // ClassHolder's deinitializer.
717- beginAccessHelper ( address. _rawValue, accessRecordPtr, type)
682+ Builtin . beginUnpairedModifyAccess ( address. _rawValue, accessRecordPtr, type)
718683
719684 return holder
720685 }
@@ -724,7 +689,7 @@ internal final class ClassHolder<ProjectionType> {
724689 let accessRecordPtr = Builtin . projectTailElems ( self , AccessRecord . self)
725690
726691 // Ends the access begun in _create().
727- endAccessHelper ( accessRecordPtr)
692+ Builtin . endUnpairedAccess ( accessRecordPtr)
728693 }
729694}
730695
@@ -1275,7 +1240,8 @@ internal struct RawKeyPathComponent {
12751240 // Perform an instaneous record access on the address in order to
12761241 // ensure that the read will not conflict with an already in-progress
12771242 // 'modify' access.
1278- instantaneousAccessHelper ( offsetAddress. _rawValue, NewValue . self)
1243+ Builtin . performInstantaneousReadAccess ( offsetAddress. _rawValue,
1244+ NewValue . self)
12791245 return . continue( offsetAddress
12801246 . assumingMemoryBound ( to: NewValue . self)
12811247 . pointee)
0 commit comments