-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.9] More batched changes #66196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gottesmm
merged 13 commits into
swiftlang:release/5.9
from
gottesmm:release-5.9-more-stuff-2
Jun 5, 2023
Merged
[5.9] More batched changes #66196
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6a5ef8a
[move-only] Make sure that we serialize deinits and if we are not abl…
gottesmm 5530aa9
[move-only] Teach deinit devirtualization how to handle devirtualizin…
gottesmm 7e3c7ca
Some misc fixes for tests.
gottesmm 45a592c
[move-only] Change closure capture diagnostic for let patterns to say…
gottesmm 20bf5d5
[move-only] Teach SILGenApply how to emit subscripts with borrowed ba…
gottesmm c009c32
[move-only] When we emit a noncopyable temporary allocation, always a…
gottesmm 61745ee
[move-only] Make sure that we handle load [take] that are actually bo…
gottesmm 23deccf
[move-only] Restrict 508bf8ae2141f379d24dd0ae2902e5672fc52e9f so it o…
gottesmm 1ae66b2
[move-only] Teach SILGen how to recognize a borrowed read subscript w…
gottesmm 439a719
[move-only] Make sure to run the moveonly interpreter test also at -O…
gottesmm ffa9119
[CanonicalizeOSSALifetime] Renamed member.
nate-chandler 83f99f9
Remove a test since drop_deinit isn't yet on 5.9
gottesmm 20a9b1b
Call indirectCleanup as per JoeG's comment.
gottesmm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/IRGen/Inputs/moveonly_split_module_source_input.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
class Klass { | ||
var name = "John" | ||
} | ||
|
||
#if TEST_LIBRARY_EVOLUTION | ||
public struct MoveOnly : ~Copyable { | ||
var k = Klass() | ||
var k2 = Klass() | ||
deinit { | ||
print("==> I am in the deinit resiliently!") | ||
print("==> My name is \(k.name)") | ||
} | ||
} | ||
#else | ||
struct MoveOnly : ~Copyable { | ||
var k = Klass() | ||
var k2 = Klass() | ||
deinit { | ||
print("==> I am in the deinit!") | ||
print("==> My name is \(k.name)") | ||
} | ||
} | ||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: %target-swiftc_driver -emit-module -module-name server -emit-module-path %t/server.swiftmodule %s %S/Inputs/moveonly_split_module_source_input.swift | ||
// RUN: %target-swift-frontend -module-name server -primary-file %s %S/Inputs/moveonly_split_module_source_input.swift -emit-ir -emit-module-path %t/server.swiftmodule | %FileCheck %s -check-prefix=REFERRING_MODULE | ||
// RUN: %target-swift-frontend -module-name server %s -primary-file %S/Inputs/moveonly_split_module_source_input.swift -emit-ir -emit-module-path %t/server.swiftmodule | %FileCheck %s -check-prefix=DEFINING_MODULE | ||
|
||
// Make sure we call the deinit through the value witness table in the other module. | ||
|
||
// REFERRING_MODULE-LABEL: define swiftcc void @"$s6serverAAV4mainyyKFZ"(%swift.refcounted* swiftself %0, %swift.error** noalias nocapture swifterror dereferenceable(8) %1) #0 { | ||
// REFERRING_MODULE: [[SERVER:%.*]] = alloca %T6server8MoveOnlyV | ||
// REFERRING_MODULE: [[VALUE_WITNESS_TABLE:%.*]] = getelementptr inbounds i8*, i8** %"$s6server8MoveOnlyVN.valueWitnesses" | ||
// REFERRING_MODULE: [[VALUE_WITNESS:%.*]] = load i8*, i8** [[VALUE_WITNESS_TABLE]] | ||
// REFERRING_MODULE: [[DESTROY:%.*]] = bitcast i8* [[VALUE_WITNESS]] | ||
// REFERRING_MODULE: [[CAST_SERVER:%.*]] = bitcast %T6server8MoveOnlyV* [[SERVER]] | ||
// REFERRING_MODULE: call void [[DESTROY]]({{%.*}} [[CAST_SERVER]], {{%.*}} @"$s6server8MoveOnlyVN") | ||
|
||
// Make sure that in the other module, we do call the deinit directly from the value witness. | ||
// DEFINING_MODULE-LABEL: define internal void @"$s6server8MoveOnlyVwxx"(%swift.opaque* noalias %object, %swift.type* %MoveOnly) {{.*}} { | ||
// DEFINING_MODULE: [[SELF:%.*]] = bitcast %swift.opaque* [[ARG:%.*]] to %T6server8MoveOnlyV* | ||
// DEFINING_MODULE: [[VAR:%.*]] = getelementptr inbounds {{%.*}}, {{%.*}}* [[SELF]] | ||
// DEFINING_MODULE: [[LOADED_VAR:%.*]] = load {{%.*}}*, {{%.*}}** [[VAR]], | ||
// DEFINING_MODULE: [[VAR2:%.*]] = getelementptr inbounds {{%.*}}, {{%.*}}* [[SELF]] | ||
// DEFINING_MODULE: [[LOADED_VAR2:%.*]] = load {{%.*}}*, {{%.*}}** [[VAR2]], | ||
// DEFINING_MODULE: call swiftcc void @"$s6server8MoveOnlyVfD"({{%.*}}* [[LOADED_VAR]], {{%.*}}* [[LOADED_VAR2]]) | ||
@main | ||
public struct server { | ||
public static func main() throws { | ||
let server = MoveOnly() | ||
_ = server | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
test/IRGen/moveonly_split_module_source_deinit_library_evolution.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION | ||
// RUN: %target-codesign %t/%target-library-name(MoveOnlySplit) | ||
|
||
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t) | ||
// RUN: %target-codesign %t/main | ||
// RUN: %target-run %t/main %t/%target-library-name(MoveOnlySplit) | %FileCheck -check-prefix=CHECK-LIBRARY-EVOLUTION %s | ||
|
||
// REQUIRES: executable_test | ||
|
||
import MoveOnlySplit | ||
|
||
func main() { | ||
let server = MoveOnly() // CHECK-LIBRARY-EVOLUTION: ==> I am in the deinit resiliently! | ||
} | ||
|
||
main() |
19 changes: 19 additions & 0 deletions
19
test/Interpreter/Inputs/moveonly_split_module_source_input.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
#if TEST_LIBRARY_EVOLUTION | ||
public struct MoveOnly : ~Copyable { | ||
var name = "John" | ||
public init() {} | ||
deinit { | ||
print("==> I am in the deinit resiliently!") | ||
print("==> My name is: \(name)!") | ||
} | ||
} | ||
#else | ||
struct MoveOnly : ~Copyable { | ||
var name = "John" | ||
deinit { | ||
print("==> I am in the deinit!") | ||
print("==> My name is: \(name)!") | ||
} | ||
} | ||
#endif |
16 changes: 16 additions & 0 deletions
16
test/Interpreter/moveonly_split_module_source_deinit.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Normal test. | ||
|
||
// RUN: %empty-directory(%t) | ||
// RUN: %target-swiftc_driver -emit-module -module-name server -emit-module-path %t/server.swiftmodule %s %S/Inputs/moveonly_split_module_source_input.swift | ||
// RUN: %target-swiftc_driver -emit-executable -module-name server -emit-module-path %t/server.swiftmodule %s %S/Inputs/moveonly_split_module_source_input.swift -o %t/server -Xlinker -add_ast_path -Xlinker %t/server.swiftmodule -Xlinker -alias -Xlinker _server_main -Xlinker _main | ||
// RUN: %target-codesign %t/server | ||
// RUN: %target-run %t/server | %FileCheck %s | ||
|
||
// REQUIRES: executable_test | ||
|
||
@main | ||
public struct server { | ||
public static func main() throws { | ||
let server = MoveOnly() // CHECK: ==> I am in the deinit! | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
test/Interpreter/moveonly_split_module_source_deinit_library_evolution.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION | ||
// RUN: %target-codesign %t/%target-library-name(MoveOnlySplit) | ||
|
||
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t) | ||
// RUN: %target-codesign %t/main | ||
// RUN: %target-run %t/main %t/%target-library-name(MoveOnlySplit) | %FileCheck -check-prefix=CHECK-LIBRARY-EVOLUTION %s | ||
|
||
// REQUIRES: executable_test | ||
|
||
import MoveOnlySplit | ||
|
||
func main() { | ||
let server = MoveOnly() // CHECK-LIBRARY-EVOLUTION: ==> I am in the deinit resiliently! | ||
} | ||
|
||
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// RUN: %empty-directory(%t) | ||
// TODO: re-enable the simplification passes once rdar://104875010 is fixed | ||
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyEnumDeinits -Xllvm -sil-disable-pass=simplification -g -emit-module -module-name OtherModule %S/Inputs/moveonly_deinit.swift -emit-module-path %t/OtherModule.swiftmodule | ||
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyEnumDeinits -Xllvm -sil-disable-pass=simplification -g -I %t %s -emit-silgen | ||
// RUN: %target-sil-opt -enable-experimental-feature MoveOnlyEnumDeinits %t/OtherModule.swiftmodule | %FileCheck -check-prefix=CHECK-SERIALIZED %s | ||
|
||
// Make sure we can deserialize deinits of both enums and structs. | ||
|
||
import OtherModule | ||
|
||
// CHECK-SERIALIZED: sil_moveonlydeinit [serialized] MoveOnlyStruct { | ||
// CHECK-SERIALIZED: sil_moveonlydeinit [serialized] MoveOnlyEnum { | ||
let s = MoveOnlyStruct(desc: 5) | ||
let e = MoveOnlyEnum.lhs(5) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to call
indirectCleanup
after the call toindirect
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will prepare a small patch on main that will fix this. Why don't you give the +1 and then I can get TimK to +1 this and I can take care of this tonight/over the weekend.