diff options
| author | Mason Reed <mason@vector35.com> | 2024-11-08 01:23:00 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-11-08 03:13:53 -0500 |
| commit | a4d4c770cb981abdc2799ce1c4ce7d71da6b7314 (patch) | |
| tree | e88f130e3c6e995b5af68d4126b55677aff3caff /plugins | |
| parent | 7a31a0fbfa365c81e5ddc0d866ce83653a5e25bd (diff) | |
WARP: Fix very rare lock contention throwing away cache entry on finish
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/warp/src/cache.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/plugins/warp/src/cache.rs b/plugins/warp/src/cache.rs index e002c795..b8a63cdd 100644 --- a/plugins/warp/src/cache.rs +++ b/plugins/warp/src/cache.rs @@ -9,7 +9,6 @@ use binaryninja::rc::Ref as BNRef; use binaryninja::symbol::Symbol as BNSymbol; use binaryninja::{llil, ObjectDestructor}; use dashmap::mapref::one::Ref; -use dashmap::try_result::TryResult; use dashmap::DashMap; use std::collections::HashSet; use std::hash::{DefaultHasher, Hash, Hasher}; @@ -168,14 +167,13 @@ impl FunctionCache { llil: &llil::Function<A, M, NonSSA<V>>, ) -> Function { let function_id = FunctionID::from(function); - match self.cache.try_get_mut(&function_id) { - TryResult::Present(function) => function.value().to_owned(), - TryResult::Absent => { + match self.cache.get(&function_id) { + Some(function) => function.value().to_owned(), + None => { let function = build_function(function, llil); self.cache.insert(function_id, function.clone()); function } - TryResult::Locked => build_function(function, llil), } } } @@ -289,14 +287,13 @@ impl GUIDCache { llil: &llil::Function<A, M, NonSSA<V>>, ) -> FunctionGUID { let function_id = FunctionID::from(function); - match self.cache.try_get_mut(&function_id) { - TryResult::Present(function_guid) => function_guid.value().to_owned(), - TryResult::Absent => { + match self.cache.get(&function_id) { + Some(function_guid) => function_guid.value().to_owned(), + None => { let function_guid = function_guid(function, llil); self.cache.insert(function_id, function_guid); function_guid } - TryResult::Locked => function_guid(function, llil), } } |
