From f7916158af6f1a486806be721d800c8a2dc199f9 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Fri, 30 Aug 2024 11:40:45 -0400 Subject: [PATCH] Optimize `failureBreakpoint()`. `failureBreakpoint()` currently has optimizations disabled which produces some significant assembly for what's supposed to be a no-op. Enabling optimizations and marking its magic value as `@exclusivity(unchecked)` reduces it to a single indirect store. --- Sources/Testing/Issues/Issue+Recording.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Testing/Issues/Issue+Recording.swift b/Sources/Testing/Issues/Issue+Recording.swift index a45bbb822..1f6f210de 100644 --- a/Sources/Testing/Issues/Issue+Recording.swift +++ b/Sources/Testing/Issues/Issue+Recording.swift @@ -239,7 +239,7 @@ extension Issue { // MARK: - Debugging failures /// A unique value used by ``failureBreakpoint()``. -@usableFromInline nonisolated(unsafe) var failureBreakpointValue = 0 +@usableFromInline @exclusivity(unchecked) nonisolated(unsafe) var failureBreakpointValue = 0 /// A function called by the testing library when a failure occurs. /// @@ -261,7 +261,7 @@ extension Issue { /// This function performs no action of its own. It is not part of the public /// interface of the testing library, but it is exported and its symbol name /// must remain stable. -@inline(never) @_optimize(none) +@inline(never) @usableFromInline func failureBreakpoint() { // This function's body cannot be completely empty or else linker symbol