Skip to content

Commit 1b74ea6

Browse files
committed
Add test to exercise Indirect_In codepaths in DistributedAccessor emit
1 parent 5abfc91 commit 1b74ea6

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

lib/IRGen/GenDistributed.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
475475

476476
// Remember to deallocate a copy.
477477
AllocatedArguments.push_back(stackAddr);
478+
// Don't forget to actually store the argument
478479
arguments.add(stackAddr.getAddressPointer());
479480
break;
480481
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %target-swift-frontend -emit-ir %s -Xllvm -sil-print-function=takeLarge -swift-version 5 -disable-availability-checking 2>&1 | %IRGenFileCheck %s --dump-input=always
2+
// UNSUPPORTED: back_deploy_concurrency
3+
// REQUIRES: concurrency
4+
// REQUIRES: distributed
5+
6+
import Distributed
7+
8+
// This struct must be "very large" in order to cause it to be passed as `indirect @in`.
9+
// Specifically, this needs to exercise the DistributedAccessor::decodeArgument paths for `Indirect_In` parameter convention.
10+
public struct LargeValue : Codable {
11+
let field1 : Int64 = 1
12+
let field2 : Int64 = 2
13+
let field3 : Int64 = 3
14+
let field4 : Int64 = 4
15+
let field5 : Int64 = 5
16+
let field6 : Int64 = 6
17+
let field7 : Int64 = 7
18+
let field8 : Int64 = 8
19+
}
20+
21+
distributed actor D {
22+
typealias ActorSystem = LocalTestingDistributedActorSystem
23+
24+
// CHECK: sil hidden [distributed] @takeLarge : $@convention(method) (@in LargeValue, @guaranteed D) -> () {
25+
@_silgen_name("takeLarge")
26+
distributed func takeLarge(_ l: LargeValue) {}
27+
}

0 commit comments

Comments
 (0)