Skip to content

Commit a719119

Browse files
committed
cleanup
1 parent a20e7b3 commit a719119

9 files changed

+21
-197
lines changed

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
107107
UncheckedContinuation.swift
108108
GlobalActor.swift
109109
MainActor.swift
110-
Job.swift
110+
PartialAsyncTask.swift
111111
SourceCompatibilityShims.swift
112112
Task.cpp
113113
Task.swift

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ public struct UnownedJob: Sendable {
5656
public func _runSynchronously(on executor: UnownedSerialExecutor) {
5757
_swiftJobRun(self, executor)
5858
}
59-
}
6059

60+
@_alwaysEmitIntoClient
61+
@inlinable
62+
public func runSynchronously(on executor: UnownedSerialExecutor) {
63+
_swiftJobRun(self, executor)
64+
}
65+
}
6166

6267
/// A unit of scheduleable work.
6368
///
@@ -79,8 +84,7 @@ public struct Job: Sendable {
7984
}
8085

8186
public var priority: JobPriority {
82-
// let raw = _swift_concurrency_jobPriority(UnownedJob(context: self.context)) // TODO: do we also surface this or the base priority?
83-
let raw = _taskCurrentPriority(context as! Builtin.NativeObject)
87+
let raw = _swift_concurrency_jobPriority(UnownedJob(context: self.context))
8488
return JobPriority(rawValue: raw)
8589
}
8690

test/Concurrency/Runtime/custom_executors_assume_main_asyncmain.swift

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/Concurrency/Runtime/custom_executors_assume_main_asyncmain_crash.swift

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/Concurrency/Runtime/custom_executors_default.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift( -Xfrontend enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s
1+
// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: concurrency
44
// REQUIRES: executable_test

test/Concurrency/Runtime/custom_executors_distributed.swift

Lines changed: 0 additions & 74 deletions
This file was deleted.

test/Concurrency/Runtime/custom_executors_priority.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s
1+
// RUN: %target-run-simple-swift( -Xfrontend -enable-experimental-move-only -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always
22

33
// REQUIRES: concurrency
44
// REQUIRES: executable_test
@@ -41,9 +41,6 @@ actor Custom {
4141
await Task() {
4242
await actor.report()
4343
}.value
44-
await Task(priority: .low) {
45-
await actor.report()
46-
}.value
4744
print("end")
4845
}
4946
}

test/Concurrency/Runtime/custom_executors_protocol.swift

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,6 @@ extension WithSpecifiedExecutor {
2424
}
2525
}
2626

27-
final class InlineExecutor: SpecifiedExecutor, CustomStringConvertible {
28-
let name: String
29-
30-
init(_ name: String) {
31-
self.name = name
32-
}
33-
34-
public func enqueue(_ job: UnownedJob) {
35-
print("\(self): enqueue")
36-
job.runSynchronously(on: self.asUnownedSerialExecutor())
37-
print("\(self): after run")
38-
}
39-
40-
public func enqueue(_ job: __owned Job) {
41-
print("\(self): enqueue")
42-
job.runSynchronously(on: self)
43-
print("\(self): after run")
44-
}
45-
46-
var description: Swift.String {
47-
"InlineExecutor(\(name))"
48-
}
49-
}
50-
5127
final class NaiveQueueExecutor: SpecifiedExecutor, CustomStringConvertible {
5228
let queue: DispatchQueue
5329

@@ -58,7 +34,7 @@ final class NaiveQueueExecutor: SpecifiedExecutor, CustomStringConvertible {
5834
public func enqueue(_ job: UnownedJob) {
5935
print("\(self): enqueue")
6036
queue.sync {
61-
job.runSynchronously(on: self)
37+
job.runSynchronously(on: self.asUnownedSerialExecutor())
6238
}
6339
print("\(self): after run")
6440
}
@@ -67,7 +43,7 @@ final class NaiveQueueExecutor: SpecifiedExecutor, CustomStringConvertible {
6743
print("\(self): enqueue")
6844
let unowned = UnownedJob(job)
6945
queue.sync {
70-
unowned.runSynchronously(on: self)
46+
unowned.runSynchronously(on: self.asUnownedSerialExecutor())
7147
}
7248
print("\(self): after run")
7349
}
@@ -89,7 +65,7 @@ actor MyActor: WithSpecifiedExecutor {
8965
}
9066

9167
func test(expectedExecutor: some SerialExecutor, expectedQueue: DispatchQueue) {
92-
precondition(_taskIsOnExecutor(expectedExecutor), "Expected to be on: \(expectedExecutor)")
68+
// FIXME(waiting on preconditions to merge): preconditionTaskOnExecutor(expectedExecutor, "Expected to be on: \(expectedExecutor)")
9369
dispatchPrecondition(condition: .onQueue(expectedQueue))
9470
print("\(Self.self): on executor \(expectedExecutor)")
9571
}
@@ -109,9 +85,9 @@ actor MyActor: WithSpecifiedExecutor {
10985
}
11086

11187
// CHECK: begin
112-
// CHECK-NEXT: InlineExecutor(one): enqueue
113-
// CHECK-NEXT: MyActor: on executor InlineExecutor(one)
114-
// CHECK-NEXT: MyActor: on executor InlineExecutor(one)
115-
// CHECK-NEXT: MyActor: on executor InlineExecutor(one)
116-
// CHECK-NEXT: InlineExecutor(one): after run
88+
// CHECK-NEXT: NaiveQueueExecutor(<OS_dispatch_queue_serial: CustomQueue>): enqueue
89+
// CHECK-NEXT: MyActor: on executor NaiveQueueExecutor(<OS_dispatch_queue_serial: CustomQueue>)
90+
// CHECK-NEXT: MyActor: on executor NaiveQueueExecutor(<OS_dispatch_queue_serial: CustomQueue>)
91+
// CHECK-NEXT: MyActor: on executor NaiveQueueExecutor(<OS_dispatch_queue_serial: CustomQueue>)
92+
// CHECK-NEXT: NaiveQueueExecutor(<OS_dispatch_queue_serial: CustomQueue>): after run
11793
// CHECK-NEXT: end

test/SourceKit/Indexing/index_with_clang_module.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ func foo(a: FooClassDerived) {
1616
// CHECK: key.kind: source.lang.swift.import.module.clang
1717
// CHECK-NEXT: key.name: "_SwiftConcurrencyShims"
1818

19+
// CHECK: key.kind: source.lang.swift.import.module.clang
20+
// CHECK-NEXT: key.name: "SwiftShims"
21+
1922
// CHECK: key.kind: source.lang.swift.import.module.clang
2023
// CHECK-NEXT: key.name: "Foo"
2124
// CHECK-NEXT: key.filepath: "{{.*[/\\]}}Foo{{.*}}.pcm"

0 commit comments

Comments
 (0)