Skip to content

Commit 510589b

Browse files
committed
Workaround a deadlock in the Swift REPL
This was already worked around in rdar://problem/38461035, but it was lost in a follow-up merge resolution. This reinstates the workaround and adds a test (from https://bugs.swift.org/browse/SR-7114) to make sure we don't regress this. apple-llvm-split-commit: ac73e28ffd7b156abbc6a9b3b62db0ba3b4c46f2 apple-llvm-split-dir: lldb/
1 parent 6827a18 commit 510589b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lldb/lit/SwiftREPL/Deadlock.test

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %lldb --repl < %s | FileCheck %s
2+
3+
// From https://bugs.swift.org/browse/SR-7114
4+
// This sequence was deadlocking.
5+
6+
let a = 9007199254740991.0
7+
// CHECK: a: Double = 9007199254740991
8+
(a * a - a * a).squareRoot()
9+
// CHECK: (Double) = {
10+
// CHECK-NEXT: _value = 0
11+
// CHECK-NEXT: }
12+
(a * a).addingProduct(-a, a).squareRoot()
13+
// CHECK: (Double) = {
14+
// CHECK-NEXT: _value = NaN
15+
// CHECK-NEXT: }

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ void ManualDWARFIndex::Index() {
6868
// to wait until all compile units have been indexed in case a DIE in one
6969
// compile unit refers to another and the indexes accesses those DIEs.
7070
//----------------------------------------------------------------------
71-
TaskMapOverInt(0, units_to_index.size(), extract_fn);
71+
for (int i=0; i<units_to_index.size(); ++i) {
72+
extract_fn(i);
73+
}
74+
// This call can deadlock because we are sometimes holding the module lock.
75+
//TaskMapOverInt(0, units_to_index.size(), extract_fn);
7276

7377
// Now create a task runner that can index each DWARF compile unit in a
7478
// separate thread so we can index quickly.

0 commit comments

Comments
 (0)