This is an archive of the discontinued LLVM Phabricator instance.

[DWARFLinkerParallel] Add simple list with thread safe insertions.
AbandonedPublic

Authored by avl on Dec 30 2022, 4:16 PM.

Details

Summary

This patch is extracted from D96035. It adds simple non-allocating list class.
The list allows thread safe insertions. List items should be allocated
and deleted outside the list.

Diff Detail

Event Timeline

avl created this revision.Dec 30 2022, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 30 2022, 4:16 PM
Herald added a subscriber: mgrang. · View Herald Transcript
avl requested review of this revision.Dec 30 2022, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 30 2022, 4:16 PM
tschuett added inline comments.
llvm/include/llvm/DWARFLinkerNext/List.h
24 ↗(On Diff #485731)

not atomic?

45 ↗(On Diff #485731)

not atomic?

avl added inline comments.Dec 31 2022, 1:00 AM
llvm/include/llvm/DWARFLinkerNext/List.h
24 ↗(On Diff #485731)

only "Head" requires std::atomic. as only "Head" field is changed by different threads.

45 ↗(On Diff #485731)

CurHead is not visible or changed by other threads, thus not necessarily to make it atomic.

avl updated this revision to Diff 485754.Dec 31 2022, 1:25 AM

renamed AddItem to AddAtFront. Cured test.

avl updated this revision to Diff 494674.Feb 3 2023, 9:40 AM

rebased.

avl retitled this revision from [DWARFLinkerNext] Add simple list with thread safe insertions. to [DWARFLinkerParallel] Add simple list with thread safe insertions..Feb 3 2023, 9:42 AM
avl edited the summary of this revision. (Show Details)
avl added a comment.Feb 27 2023, 11:44 AM

friendly ping.

The implementation looks good. I left some inline comments with suggestions for names that more closely match that of the STL containers to make the class feel more familiar to those who are used to them.

llvm/include/llvm/DWARFLinkerParallel/NonAllocatingList.h
39

front

43

empty

46

pushFront

77

clear

80

sort

99

reverse

avl updated this revision to Diff 501558.Mar 1 2023, 9:59 AM

addressed comments(renamed class methods).

This revision is now accepted and ready to land.Mar 14 2023, 9:34 PM
avl abandoned this revision.Jul 3 2023, 10:41 AM

cancel this patch in favor of another solution used by D153268