Skip to content

Commit 823137b

Browse files
committed
Remove runtime support for exclusivity warnings.
1 parent e560125 commit 823137b

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -997,10 +997,6 @@ enum class ExclusivityFlags : uintptr_t {
997997
// Read or Modify).
998998
ActionMask = 0x1,
999999

1000-
#ifndef NDEBUG
1001-
// Downgrade exclusivity failures to a warning. Only used for unit testing.
1002-
WarningOnly = 0x10,
1003-
#endif
10041000
// The runtime should track this access to check against subsequent accesses.
10051001
Tracking = 0x20
10061002
};
@@ -1016,13 +1012,6 @@ static inline ExclusivityFlags getAccessAction(ExclusivityFlags flags) {
10161012
return ExclusivityFlags(uintptr_t(flags)
10171013
& uintptr_t(ExclusivityFlags::ActionMask));
10181014
}
1019-
static inline bool isWarningOnly(ExclusivityFlags flags) {
1020-
#ifndef NDEBUG
1021-
return uintptr_t(flags) & uintptr_t(ExclusivityFlags::WarningOnly);
1022-
#else
1023-
return false;
1024-
#endif
1025-
}
10261015
static inline bool isTracking(ExclusivityFlags flags) {
10271016
return uintptr_t(flags) & uintptr_t(ExclusivityFlags::Tracking);
10281017
}

stdlib/public/runtime/Exclusivity.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ LLVM_ATTRIBUTE_ALWAYS_INLINE
5050
static void reportExclusivityConflict(ExclusivityFlags oldAction, void *oldPC,
5151
ExclusivityFlags newFlags, void *newPC,
5252
void *pointer) {
53-
static std::atomic<long> reportedConflicts{0};
54-
constexpr long maxReportedConflicts = 100;
55-
// Don't report more that 100 conflicts. Hopefully, this will improve
56-
// performance in case there are conflicts inside a tight loop.
57-
if (reportedConflicts.fetch_add(1, std::memory_order_relaxed) >=
58-
maxReportedConflicts) {
59-
return;
60-
}
61-
6253
constexpr unsigned maxMessageLength = 100;
6354
constexpr unsigned maxAccessDescriptionLength = 50;
6455
char message[maxMessageLength];
@@ -87,9 +78,6 @@ static void reportExclusivityConflict(ExclusivityFlags oldAction, void *oldPC,
8778
constexpr unsigned framesToSkip = 1;
8879
printCurrentBacktrace(framesToSkip);
8980

90-
// Should be inlined away in release builds.
91-
bool keepGoing = isWarningOnly(newFlags);
92-
9381
RuntimeErrorDetails::Thread secondaryThread = {
9482
.description = oldAccess,
9583
.numFrames = 1,
@@ -104,17 +92,7 @@ static void reportExclusivityConflict(ExclusivityFlags oldAction, void *oldPC,
10492
.numExtraThreads = 1,
10593
.threads = &secondaryThread
10694
};
107-
uintptr_t flags = RuntimeErrorFlagNone;
108-
if (!keepGoing)
109-
flags = RuntimeErrorFlagFatal;
110-
_swift_reportToDebugger(flags, message, &details);
111-
112-
if (keepGoing) {
113-
return;
114-
}
115-
116-
// 0 means no backtrace will be printed.
117-
fatalError(0, "Fatal access conflict detected.\n");
95+
_swift_reportToDebugger(RuntimeErrorFlagFatal, message, &details);
11896
}
11997

12098
namespace {
@@ -201,8 +179,8 @@ class AccessSet {
201179
reportExclusivityConflict(cur->getAccessAction(), cur->PC,
202180
flags, pc, pointer);
203181

204-
// If we're only warning, don't report multiple conflicts.
205-
break;
182+
// 0 means no backtrace will be printed.
183+
fatalError(0, "Fatal access conflict detected.\n");
206184
}
207185
if (!isTracking(flags))
208186
return false;

0 commit comments

Comments
 (0)