Skip to content

Commit 404c46b

Browse files
authored
Merge pull request #4166 from swiftwasm/main
[pull] swiftwasm from main
2 parents 30e9e15 + ac875d0 commit 404c46b

File tree

156 files changed

+4573
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+4573
-986
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ CHANGELOG
33

44
_**Note:** This is in reverse chronological order, so newer entries are added to the top._
55

6-
## Swift Next
6+
## Swift 5.7
77

88
* [SE-0328][]:
99

1010
Opaque types (expressed with 'some') can now be used in structural positions
1111
within a result type, including having multiple opaque types in the same
1212
result. For example:
1313

14-
```
14+
```swift
1515
func getSomeDictionary() -> [some Hashable: some Codable] {
1616
return [ 1: "One", 2: "Two" ]
1717
}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
175175
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
176176
# can be reused when a new version of Swift comes out (assuming the user hasn't
177177
# manually set it as part of their own CMake configuration).
178-
set(SWIFT_VERSION "5.6")
178+
set(SWIFT_VERSION "5.7")
179179

180180
set(SWIFT_VENDOR "" CACHE STRING
181181
"The vendor name of the Swift compiler")

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ swift_compiler_sources(Optimizer
1111
SILPrinter.swift
1212
MergeCondFails.swift
1313
ReleaseDevirtualizer.swift
14+
RunUnitTests.swift
1415
)

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ReleaseDevirtualizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private extension StructExtractInst {
204204
let structType = operand.type
205205

206206
var nonTrivialFieldsCount = 0
207-
for field in structType.getStructFields(in: function) {
207+
for field in structType.getNominalFields(in: function) {
208208
if field.isTrivial(in: function) {
209209
nonTrivialFieldsCount += 1
210210
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===--- UnitTests.swift - A pseudo pass for running the unit tests -------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import SIL
14+
15+
/// This pass should only be used by sil-opt to run all the unit tests.
16+
///
17+
let runUnitTests = FunctionPass(name: "run-unit-tests", {
18+
(function: Function, context: PassContext) in
19+
20+
print("--- Run unit tests ---")
21+
22+
print("test ProjectionPath")
23+
SmallProjectionPath.runUnitTests()
24+
})

SwiftCompilerSources/Sources/Optimizer/PassManager/PassRegistration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ private func registerSwiftPasses() {
5151
registerPass(simplifyStrongRetainPass, { simplifyStrongRetainPass.run($0) })
5252
registerPass(simplifyStrongReleasePass, { simplifyStrongReleasePass.run($0) })
5353
registerPass(assumeSingleThreadedPass, { assumeSingleThreadedPass.run($0) })
54+
registerPass(runUnitTests, { runUnitTests.run($0) })
5455
registerPass(releaseDevirtualizerPass, { releaseDevirtualizerPass.run($0) })
5556
}

SwiftCompilerSources/Sources/Optimizer/PassManager/PassUtils.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ struct PassContext {
123123
func getContextSubstitutionMap(for type: Type) -> SubstitutionMap {
124124
SubstitutionMap(PassContext_getContextSubstitutionMap(_bridged, type.bridged))
125125
}
126+
127+
func modifyEffects(in function: Function, _ body: (inout FunctionEffects) -> ()) {
128+
function._modifyEffects(body)
129+
// TODO: do we need to notify any changes?
130+
}
126131
}
127132

128133
struct FunctionPass {

SwiftCompilerSources/Sources/SIL/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ add_swift_compiler_module(SIL
1111
Argument.swift
1212
BasicBlock.swift
1313
Builder.swift
14+
Effects.swift
1415
Function.swift
1516
GlobalVariable.swift
1617
Instruction.swift
1718
Location.swift
1819
Operand.swift
1920
Registration.swift
21+
SmallProjectionPath.swift
2022
SubstitutionMap.swift
2123
Type.swift
2224
Utils.swift

0 commit comments

Comments
 (0)