Skip to content

Commit 4251e81

Browse files
Merge pull request #5214 from swiftwasm/main
[pull] swiftwasm from main
2 parents cd580a6 + 0f266b8 commit 4251e81

File tree

119 files changed

+1952
-518
lines changed

Some content is hidden

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

119 files changed

+1952
-518
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/WalkUtils.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ extension ValueUseDefWalker {
569569
switch def {
570570
case let str as StructInst:
571571
if let (index, path) = path.pop(kind: .structField) {
572+
if index >= str.operands.count {
573+
// This can happen if there is a type mismatch, e.g. two different concrete types of an existential
574+
// are visited for the same path.
575+
return unmatchedPath(value: str, path: path)
576+
}
572577
return walkUp(value: str.operands[index].value, path: path)
573578
} else if path.popIfMatches(.anyValueFields, index: nil) != nil {
574579
return walkUpAllOperands(of: str, path: path)
@@ -577,6 +582,11 @@ extension ValueUseDefWalker {
577582
}
578583
case let t as TupleInst:
579584
if let (index, path) = path.pop(kind: .tupleField) {
585+
if index >= t.operands.count {
586+
// This can happen if there is a type mismatch, e.g. two different concrete types of an existential
587+
// are visited for the same path.
588+
return unmatchedPath(value: t, path: path)
589+
}
580590
return walkUp(value: t.operands[index].value, path: path)
581591
} else if path.popIfMatches(.anyValueFields, index: nil) != nil {
582592
return walkUpAllOperands(of: t, path: path)

benchmark/cxx-source/ReadAccessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public let benchmarks = [
3232

3333
@inline(never)
3434
public func run_ReadAccessor(_ N: Int) {
35-
for i in 0...N {
35+
for _ in 0...N {
3636
for j in 0..<100 {
3737
let row = vec![j];
3838
for k in 0..<1_000 {

benchmark/single-source/LuhnAlgoEager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ func mapEveryN<S: Sequence>(
206206
) -> [S.Element] {
207207
let isNth = isMultipleOf(n)
208208
return source.enumerated().map {
209-
(pair: (index: Int, elem: S.Element)) in
210-
isNth(pair.index+1)
211-
? transform(pair.elem)
212-
: pair.elem
209+
(pair: (offset: Int, element: S.Element)) in
210+
isNth(pair.offset+1)
211+
? transform(pair.element)
212+
: pair.element
213213
}
214214
}
215215

benchmark/single-source/LuhnAlgoLazy.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ func mapEveryN<S: Sequence>(
206206
) -> [S.Element] {
207207
let isNth = isMultipleOf(n)
208208
return source.enumerated().map {
209-
(pair: (index: Int, elem: S.Element)) in
210-
isNth(pair.index+1)
211-
? transform(pair.elem)
212-
: pair.elem
209+
(pair: (offset: Int, element: S.Element)) in
210+
isNth(pair.offset+1)
211+
? transform(pair.element)
212+
: pair.element
213213
}
214214
}
215215

benchmark/single-source/PopFront.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public func run_PopFrontUnsafePointer(_ n: Int) {
5252
var count = arrayCount
5353
while count != 0 {
5454
result += a[0]
55-
a.assign(from: a + 1, count: count - 1)
55+
a.update(from: a + 1, count: count - 1)
5656
count -= 1
5757
}
5858
check(result == arrayCount)

benchmark/single-source/SetTests.swift

Lines changed: 58 additions & 58 deletions
Large diffs are not rendered by default.

docs/ABI/Mangling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ Types
570570
#if SWIFT_RUNTIME_VERSION >= 5.5
571571
type ::= 'Bj' // Builtin.Job
572572
#endif
573+
type ::= 'BP' // Builtin.PackIndex
573574
type ::= 'BO' // Builtin.UnknownObject (no longer a distinct type, but still used for AnyObject)
574575
type ::= 'Bo' // Builtin.NativeObject
575576
type ::= 'Bp' // Builtin.RawPointer

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ swiftscan_scan_invocation_get_argv(swiftscan_scan_invocation_t invocation);
272272
SWIFTSCAN_PUBLIC void
273273
swiftscan_string_set_dispose(swiftscan_string_set_t *set);
274274

275+
SWIFTSCAN_PUBLIC void
276+
swiftscan_string_dispose(swiftscan_string_ref_t string);
277+
275278
SWIFTSCAN_PUBLIC void
276279
swiftscan_dependency_graph_dispose(swiftscan_dependency_graph_t result);
277280

include/swift/AST/AccessScope.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class AccessScope {
9898
}
9999
if (isPackage())
100100
return AS.isPublic();
101-
102101
// If this is public, it can't be less than access level of AS
103102
// so return false
104103
return false;

include/swift/AST/AttrKind.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ enum class AccessLevel : uint8_t {
6060
FilePrivate,
6161
/// Internal access is limited to the current module.
6262
Internal,
63+
/// Package access is not limited, but some capabilities may be
64+
/// restricted outside of the current package containing modules.
65+
/// It's similar to Public in that it's accessible from other modules
66+
/// and subclassable only within the defining module as long as
67+
/// the modules are in the same package.
68+
Package,
6369
/// Public access is not limited, but some capabilities may be
6470
/// restricted outside of the current module.
6571
Public,

include/swift/AST/Decl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,14 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
693693
NumPathElements : 8
694694
);
695695

696-
SWIFT_INLINE_BITFIELD(ExtensionDecl, Decl, 3+1,
696+
SWIFT_INLINE_BITFIELD(ExtensionDecl, Decl, 4+1,
697697
/// An encoding of the default and maximum access level for this extension.
698+
/// The value 4 corresponds to AccessLevel::Public
698699
///
699700
/// This is encoded as (1 << (maxAccess-1)) | (1 << (defaultAccess-1)),
700701
/// which works because the maximum is always greater than or equal to the
701702
/// default, and 'private' is never used. 0 represents an uncomputed value.
702-
DefaultAndMaxAccessLevel : 3,
703+
DefaultAndMaxAccessLevel : 4,
703704

704705
/// Whether there is are lazily-loaded conformances for this extension.
705706
HasLazyConformances : 1

0 commit comments

Comments
 (0)