angr.utils.cowdict¶
- angr.utils.cowdict.merge_candidate_keys(a, b)¶
Return the keys that may differ between two COW chain maps which (typically) descend from a common ancestor and therefore share a common suffix of layer objects.
A key whose binding lives entirely in the shared suffix – an identical
mapsentry (by identity) that is not shadowed by a deletion in either map – resolves to the same value in both maps, so unioning them is always a no-op and the key is omitted. The result is the union of the keys held in each map’s non-shared “head” layers, plus the keys either map has logically deleted: a deleted key may still be bound in the other map’s shared suffix and therefore needs to be resurrected by a merge.- Return type:
- Parameters:
a (ChainMapCOW)
b (ChainMapCOW)
- class angr.utils.cowdict.ChainMapCOW¶
Bases:
ChainMap,Generic[K,V]Implements a copy-on-write version of ChainMap that supports auto-collapsing.
Tracks logically deleted keys via a _deleted set so that pop() and del work correctly even when keys live in parent maps.
Performance note: We deliberately re-implement the ChainMap walk for better performance.
ChainMap.__getitem__raises aKeyErrorfor every layer that misses, andChainMap.getwalks the whole chain twice (__contains__and__getitem__). We avoid both by inliningif key in mapping.We may revisit the implementation in the future when the performance of ChainMap improves.
- maps
- dirty
- collapse_threshold
- clean()¶
- Return type:
ChainMapCOW[K,V]
- class angr.utils.cowdict.DefaultChainMapCOW¶
Bases:
ChainMapCOW,Generic[K,V]Implements a copy-on-write version of ChainMap with default values that supports auto-collapsing.
- default_factory
- clean()¶
- Return type:
DefaultChainMapCOW[K,V]