Skip to content

Commit 969c48d

Browse files
committed
Fix memory issues
- Use shared pointers for factory methods I think the use of shared pointers in `symbolicallyExecute` is the correct decision due to the filling of a map. I tried for a while to make this a map of objects, but due to [object slicing](https://en.wikipedia.org/wiki/Object_slicing) it would not be possible to store a PredicatedValueBits in this map. (This would require PredicatedValueBits to be redesigned into ValueBits class, but then the internal methods get messy. Virtual functions was a clean answer to this) Additionally, using `unique_ptr` proves difficult due to having to store it in a map. And unique pointers cannot be copied. As `symbolicallyExecute` is the primary user of the factory methods, it made sense for the factory methods to return a shared pointer instead of a raw pointer or object and then wrapping this in a shared pointer within symbolicallyExecute. - Have XOR bits own their LHS/RHS Having them as member objects instead of pointers I don't think makes much sense due to them not being needed for most ValueBit objects, but they would have to be initialized for all ValueBit instantiations. - Use object values instead of pointers for bit representation IMO the cleanest way. They're very lightweight anyway.
1 parent 7438109 commit 969c48d

File tree

1 file changed

+180
-140
lines changed

1 file changed

+180
-140
lines changed

0 commit comments

Comments
 (0)