This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][dsl] Avoid false-positive cache hits
AbandonedPublic

Authored by arichardson on Oct 9 2020, 2:24 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Summary

The libc++ dsl gained a cache to improve startup performance in
5390c5a96e9774f0f7d748b5a466c308f916ecd0, but it turns out this cache
can return cache hits even when it shouldn't.
We currently pass c.substitutions as one of the cache keys. However, this
means we are storing a reference to a mutable list as the cache key.
I added some debugging code that modifies config.substitutions between
checks and it turns out that the cache hits even though it shouldn't.
As a workaround for this issue, we now store a deep copy of the cache key
in the cache. I plan to submit a follow-up change that only saves the
relevant substitutions to reduce the amount of copying.

Diff Detail

Event Timeline

arichardson created this revision.Oct 9 2020, 2:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 9 2020, 2:24 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript
arichardson requested review of this revision.Oct 9 2020, 2:24 AM
arichardson abandoned this revision.Oct 9 2020, 7:30 AM

Abandoning in favour of the committed solution (which also allows using a dict for lookup instead): https://reviews.llvm.org/rGddb2baf9fbff3d574c6c2bd69c2c9569100509a4