Skip to content

Commit 73cd2c9

Browse files
committed
more debugging the missing deinit runs
1 parent 900c60f commit 73cd2c9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/IRGen/GenDistributed.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
479479
}
480480

481481
case ParameterConvention::Indirect_In_Guaranteed: {
482+
fprintf(stderr, "[%s:%d](%s) Indirect_In_Guaranteed\n", __FILE_NAME__, __LINE__, __FUNCTION__);
482483
// The argument is +0, so we can use the address of the param in
483484
// the context directly.
484485
arguments.add(resultAddr);
@@ -494,8 +495,12 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
494495
case ParameterConvention::Pack_Inout:
495496
llvm_unreachable("pack parameters are not supported");
496497

497-
case ParameterConvention::Direct_Guaranteed:
498+
case ParameterConvention::Direct_Guaranteed: {
499+
fprintf(stderr, "[%s:%d](%s) Direct_Guaranteed\n", __FILE_NAME__, __LINE__, __FUNCTION__);
500+
LLVM_FALLTHROUGH;
501+
}
498502
case ParameterConvention::Direct_Unowned: {
503+
fprintf(stderr, "[%s:%d](%s) UNOWNED\n", __FILE_NAME__, __LINE__, __FUNCTION__);
499504
auto paramTy = param.getSILStorageInterfaceType();
500505
Address eltPtr = IGF.Builder.CreateElementBitCast(
501506
resultValue.getAddress(), IGM.getStorageType(paramTy));
@@ -506,6 +511,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
506511
}
507512

508513
case ParameterConvention::Direct_Owned: {
514+
fprintf(stderr, "[%s:%d](%s) DIRECT OWNED\n", __FILE_NAME__, __LINE__, __FUNCTION__);
509515
// Copy the value out at +1.
510516
cast<LoadableTypeInfo>(paramInfo).loadAsCopy(IGF, resultValue.getAddress(),
511517
arguments);
@@ -593,6 +599,7 @@ void DistributedAccessor::emitReturn(llvm::Value *errorValue) {
593599
// Destroy loaded arguments.
594600
for (auto argInfo = LoadedArguments.rbegin();
595601
argInfo != LoadedArguments.rend(); ++argInfo) {
602+
596603
emitDestroyCall(IGF, argInfo->second, argInfo->first);
597604
}
598605

test/Distributed/Runtime/distributed_actor_func_calls_decoded_args_deinit.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
3-
// RUN: %target-build-swift -module-name main -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
3+
// RUN: %target-build-swift -module-name main -O -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
66

@@ -38,8 +38,10 @@ struct S<T> : Codable {
3838
}
3939

4040
distributed actor Greeter {
41-
distributed func test1<T>(_: SomeClass<T>) {}
42-
distributed func test2<T>(_: S<T>) {}
41+
distributed func test1<T>(_ value: SomeClass<T>) {
42+
print("RETAIN COUNT IN [TEST1]: \(_swift_retainCount(value))")
43+
}
44+
distributed func test2<T>(_ value: S<T>) {}
4345
}
4446

4547
func test() async throws {
@@ -52,7 +54,7 @@ func test() async throws {
5254
var value = SomeClass<Int>()
5355
try await ref.test1(value)
5456
print("RETAIN COUNT: \(_swift_retainCount(value))")
55-
_swift_release(value) // FIXME: we're missing a release!
57+
// _swift_release(value) // FIXME: we're missing a release!
5658
print("RETAIN COUNT: \(_swift_retainCount(value))")
5759
// CHECK: SomeClass: init
5860
// CHECK: SomeClass: deinit

0 commit comments

Comments
 (0)