Skip to content

Commit 69cbb45

Browse files
authored
Merge pull request #67240 from ktoso/wip-fix-indirect_in-handling-in-irgen-dist
[Distributed] Fix handling indirect @in convention params in distributed funcs
2 parents 5ae7399 + 1b74ea6 commit 69cbb45

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/IRGen/GenDistributed.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ 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
479+
arguments.add(stackAddr.getAddressPointer());
478480
break;
479481
}
480482

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)