summaryrefslogtreecommitdiff
path: root/plugins/warp/src/bin
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-11-11 14:27:21 -0500
committerMason Reed <mason@vector35.com>2024-11-11 14:31:53 -0500
commit7df5aa809b78c2ed3abc9f6bc3dae9e34b809d32 (patch)
tree610876597bf9b9f5cc2fb6027758c7cdc2ab4ea1 /plugins/warp/src/bin
parentd7a35743ae442e5ae3cc4f98aff78fb04d81b337 (diff)
WARP: Cache type references in the view caches
This allows us to free the type references instead of keeping them around forever
Diffstat (limited to 'plugins/warp/src/bin')
-rw-r--r--plugins/warp/src/bin/sigem.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/warp/src/bin/sigem.rs b/plugins/warp/src/bin/sigem.rs
index 2da14639..d7f1f50b 100644
--- a/plugins/warp/src/bin/sigem.rs
+++ b/plugins/warp/src/bin/sigem.rs
@@ -103,10 +103,17 @@ fn data_from_view(view: &BinaryView) -> Data {
Some(warp_ninja::cache::cached_function(&f, &llil))
})
.collect::<Vec<_>>();
- data.types.extend(view.types().iter().map(|ty| {
- let ref_ty = ty.type_object().to_owned();
- ComputedType::new(from_bn_type(view, &ref_ty, u8::MAX))
- }));
+
+ if let Some(ref_ty_cache) = cached_type_references(view) {
+ let referenced_types = ref_ty_cache
+ .cache
+ .iter()
+ .filter_map(|t| t.to_owned())
+ .collect::<Vec<_>>();
+
+ data.types.extend(referenced_types);
+ }
+
data
}