Skip to content

Commit 473da29

Browse files
authored
🍒[5.8/linux][Distributed] Fix handling indirect @in convention params in distributed funcs (#67382)
1 parent c785ecf commit 473da29

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
@@ -472,6 +472,8 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
472472

473473
// Remember to deallocate a copy.
474474
AllocatedArguments.push_back(stackAddr);
475+
// Don't forget to actually store the argument
476+
arguments.add(stackAddr.getAddressPointer());
475477
break;
476478
}
477479

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)