MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / cached_function_matcher

Function cached_function_matcher

plugins/warp/src/matcher.rs:31–43  ·  view source on GitHub ↗
(function: &BNFunction)

Source from the content-addressed store, hash-verified

29pub static PLAT_MATCHER_CACHE: OnceLock<DashMap<PlatformID, Matcher>> = OnceLock::new();
30
31pub fn cached_function_matcher(function: &BNFunction) {
32 let platform = function.platform();
33 let platform_id = PlatformID::from(platform.as_ref());
34 let matcher_cache = PLAT_MATCHER_CACHE.get_or_init(Default::default);
35 match matcher_cache.get(&platform_id) {
36 Some(matcher) => matcher.match_function(function),
37 None => {
38 let matcher = Matcher::from_platform(platform);
39 matcher.match_function(function);
40 matcher_cache.insert(platform_id, matcher);
41 }
42 }
43}
44
45// TODO: Maybe just clear individual platforms? This works well enough either way.
46pub fn invalidate_function_matcher_cache() {

Callers 2

actionMethod · 0.85
insert_workflowFunction · 0.85

Calls 5

match_functionMethod · 0.80
platformMethod · 0.45
as_refMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected