Skip to content

Commit b70e21e

Browse files
committed
wip
1 parent 391db9c commit b70e21e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ static void fillGroupNextResult(TaskFutureWaitAsyncContext *context,
10401040

10411041
case PollStatus::Error: {
10421042
auto error = reinterpret_cast<SwiftError *>(result.storage);
1043-
fillGroupNextErrorResult(context, error); // FIXME: this specifically retains the error, but likely should not!??!!?
1043+
fillGroupNextErrorResult(context, error);
10441044
return;
10451045
}
10461046

@@ -1384,13 +1384,12 @@ void TaskGroupBase::resumeWaitingTask(
13841384
auto before = completedTask;
13851385
_swift_taskGroup_detachChild(asAbstract(this), completedTask);
13861386
SWIFT_TASK_GROUP_DEBUG_LOG(this, "completedTask %p; AFTER DETACH (count:%d)", completedTask, swift_retainCount(completedTask));
1387-
if (hadErrorResult) {
1387+
if (isDiscardingResults() && hadErrorResult) {
13881388
SWIFT_TASK_GROUP_DEBUG_LOG(this, "BEFORE RELEASE error task=%p (count:%d)\n",
13891389
completedTask,
13901390
swift_retainCount(completedTask));
1391-
// We only used the task to keep the error in the future fragment around
1391+
// We only used the task to keep the error in the future fragment around
13921392
// so now that we emitted the error and detached the task, we are free to release the task immediately.
1393-
auto error = reinterpret_cast<SwiftError *>(result.storage);
13941393
swift_release(completedTask); // we need to do this if the error is a class
13951394
}
13961395

stdlib/public/runtime/HeapObject.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,13 @@ void (*SWIFT_RT_DECLARE_ENTRY _swift_release)(HeapObject *object) =
525525
_swift_release_;
526526

527527
void swift::swift_nonatomic_release(HeapObject *object) {
528-
fprintf(stderr, "[%s:%d](%s) swift_nonatomic_release %p\n", __FILE_NAME__, __LINE__, __FUNCTION__, object);
529528
SWIFT_RT_TRACK_INVOCATION(object, swift_nonatomic_release);
530529
if (isValidPointerForNativeRetain(object))
531530
object->refCounts.decrementAndMaybeDeinitNonAtomic(1);
532531
}
533532

534533
SWIFT_ALWAYS_INLINE
535534
static void _swift_release_n_(HeapObject *object, uint32_t n) {
536-
fprintf(stderr, "[%s:%d](%s) _swift_release_n_ %p (n=%d)\n", __FILE_NAME__, __LINE__, __FUNCTION__, object, n);
537535
SWIFT_RT_TRACK_INVOCATION(object, swift_release_n);
538536
if (isValidPointerForNativeRetain(object))
539537
object->refCounts.decrementAndMaybeDeinit(n);
@@ -797,8 +795,11 @@ void swift::swift_unownedCheck(HeapObject *object) {
797795
}
798796

799797
void _swift_release_dealloc(HeapObject *object) {
800-
fprintf(stderr, "[%s:%d](%s) _swift_release_dealloc %p (count before: %d)\n", __FILE_NAME__, __LINE__, __FUNCTION__, object,
801-
swift_retainCount(object));
798+
// assert(object);
799+
// if (!object->metadata) {
800+
fprintf(stderr, "[%s:%d](%s) object: %p\n", __FILE_NAME__, __LINE__, __FUNCTION__, object);
801+
// }
802+
// assert(object->metadata);
802803
asFullMetadata(object->metadata)->destroy(object);
803804
}
804805

0 commit comments

Comments
 (0)