about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-26 01:00:17 +0200
committerGitHub <noreply@github.com>2020-04-26 01:00:17 +0200
commit98a43caf9b776516f2afd3ca9b59cbe4ccf11a49 (patch)
treecc0cfa9a253f25e20ec9275f537e4feff76475fb /src/rustllvm/RustWrapper.cpp
parentb964451a72eb20283ee8f23541eae24474278158 (diff)
parent34dfbc3fef3fb02c36beb982523ce8d9d90838e7 (diff)
downloadrust-98a43caf9b776516f2afd3ca9b59cbe4ccf11a49.tar.gz
rust-98a43caf9b776516f2afd3ca9b59cbe4ccf11a49.zip
Rollup merge of #71392 - ecstatic-morse:body-predecessor-cache-arc, r=nikomatsakis
Don't hold the predecessor cache lock longer than necessary

#71044 returns a `LockGuard` with the predecessor cache to callers of `Body::predecessors`. As a result, the lock around the predecessor cache could be held for an arbitrarily long time. This PR uses reference counting for ownership of the predecessor cache, meaning the lock is only ever held within `PredecessorCache::compute`. Checking this API for potential sources of deadlock is much easier now, since we no longer have to consider its consumers, only its internals.

This required removing `predecessors_for`, since there is no equivalent to `LockGuard::map` for `Arc` and `Rc`. I believe this could be emulated with `owning_ref::{Arc,Rc}Ref`, but I don't think it's necessary. Also, we continue to return an opaque type from `Body::predecessors` with the lifetime of the `Body`, not `'static`.

This depends on #71044. Only the last two commits are new.

r? @nikomatsakis
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions