This is an archive of the discontinued LLVM Phabricator instance.

tsan: don't use caller/current PC in Java interfaces
ClosedPublic

Authored by dvyukov on Jul 28 2021, 7:16 AM.

Details

Summary

Caller PC is plain harmful as native caller PC has nothing to do with Java code.
Current PC is not particularly useful and may be somewhat confusing for Java users
as it makes top frame to point to some magical __tsan function.
But obtaining and using these PCs adds runtime cost for every java event.
Remove these PCs. Rely only on official Java frames.
It makes execution faster, code simpler and reports better.

Depends on D106956.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 28 2021, 7:16 AM
dvyukov requested review of this revision.Jul 28 2021, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 7:16 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 28 2021, 10:45 AM
vitalybuka added inline comments.
compiler-rt/lib/tsan/rtl/tsan_interface_java.cpp
62

why do we have this?

This revision is now accepted and ready to land.Jul 28 2021, 10:45 AM
dvyukov added inline comments.Jul 28 2021, 11:18 AM
compiler-rt/lib/tsan/rtl/tsan_interface_java.cpp
62

It help to avoid irregularity related to "\" at the end of multi-line macro lines. With "/**/" all lines end with "\", so one can reorder/remove/add lines without introducing build breakages and logical errors.

vitalybuka added inline comments.Jul 28 2021, 11:23 AM
compiler-rt/lib/tsan/rtl/tsan_interface_java.cpp
62

Looks unnecessary. That's the case of slight sacrifice of readability to small optimization rare editing.

This revision was automatically updated to reflect the committed changes.
dvyukov added inline comments.Jul 28 2021, 11:42 AM
compiler-rt/lib/tsan/rtl/tsan_interface_java.cpp
62

I've sent https://reviews.llvm.org/D106982 to address this