Page MenuHomePhabricator

[ADT] Introduce LazyAtomicPointer
AcceptedPublic

Authored by steven_wu on Sep 12 2022, 10:41 AM.

Details

Summary

LazyAtomicPointer is a lock-free pointer that can coordinate concurrent
writes to a pointer using a generator.

Diff Detail

Unit TestsFailed

TimeTest
60,060 msx64 debian > libFuzzer.libFuzzer::fuzzer-leak.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LeakTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-leak.test.tmp-LeakTest
60,070 msx64 debian > libFuzzer.libFuzzer::minimize_crash.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/NullDerefTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/minimize_crash.test.tmp-NullDerefTest
60,080 msx64 debian > libFuzzer.libFuzzer::value-profile-load.test
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LoadTest.cpp -fsanitize-coverage=trace-gep -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-load.test.tmp-LoadTest
60,160 msx64 debian > libFuzzer.libFuzzer::value-profile-switch.test
Script: -- : 'RUN: at line 5'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/SwitchTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/value-profile-switch.test.tmp-SwitchTest

Event Timeline

steven_wu created this revision.Sep 12 2022, 10:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:41 AM
steven_wu requested review of this revision.Sep 12 2022, 10:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:41 AM
benlangmuir accepted this revision.Sep 15 2022, 12:05 PM
benlangmuir added inline comments.
llvm/include/llvm/ADT/LazyAtomicPointer.h
2

Looks like "h " got dropped.

This revision is now accepted and ready to land.Sep 15 2022, 12:05 PM
steven_wu updated this revision to Diff 460526.Sep 15 2022, 3:55 PM

Fix the busy state test on windows by avoid lock ownership issues

steven_wu updated this revision to Diff 460528.Sep 15 2022, 3:57 PM

Address review feedback

steven_wu marked an inline comment as done.Sep 15 2022, 3:57 PM
steven_wu updated this revision to Diff 461387.Sep 19 2022, 3:20 PM

Use conditional variable to coordinate to avoid spinning on atomics

steven_wu updated this revision to Diff 486933.Fri, Jan 6, 10:43 AM

Minor format and test update