Add default memory allocation and free functions for HSIterator and some other tiny...
authorweiyu <weiyuluo1232@gmail.com>
Sat, 5 Oct 2019 01:36:29 +0000 (18:36 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Sat, 5 Oct 2019 01:36:29 +0000 (18:36 -0700)
concretepredicate.cc
concretepredicate.h
funcnode.cc
hashset.h

index 9633e6c7aded1c991bad063749eb1e18d1225ecc..79643beeb2902f6d15f9ce2b66854f5174d29b5f 100644 (file)
@@ -5,11 +5,6 @@ ConcretePredicate::ConcretePredicate(thread_id_t tid) :
        expressions()
 {}
 
        expressions()
 {}
 
-ConcretePredicate::~ConcretePredicate()
-{
-       expressions.clear();
-}
-
 void ConcretePredicate::add_expression(token_t token, uint64_t value, bool equality)
 {
        expressions.push_back(concrete_pred_expr(token, value, equality));
 void ConcretePredicate::add_expression(token_t token, uint64_t value, bool equality)
 {
        expressions.push_back(concrete_pred_expr(token, value, equality));
index f0eaeea905db2ca421aaa71cc8edb143f0a97710..c3b81bd995e5e15122c59af48645d89997d66e56 100644 (file)
@@ -9,7 +9,7 @@
 class ConcretePredicate {
 public:
        ConcretePredicate(thread_id_t tid);
 class ConcretePredicate {
 public:
        ConcretePredicate(thread_id_t tid);
-       ~ConcretePredicate();
+       ~ConcretePredicate() {}
 
        void add_expression(token_t token, uint64_t value, bool equality);
        SnapVector<struct concrete_pred_expr> * getExpressions() { return &expressions; }
 
        void add_expression(token_t token, uint64_t value, bool equality);
        SnapVector<struct concrete_pred_expr> * getExpressions() { return &expressions; }
index bf8971bdfbf4de48eba3a53a20323358f3594477..18d7771bfba63ff6460a29039a564be1cd4e4000 100644 (file)
@@ -640,6 +640,10 @@ void FuncNode::add_out_edge(FuncNode * other)
        }
 }
 
        }
 }
 
+/* Compute the distance between this FuncNode and the target node.
+ * Return -1 if the target node is unreachable or the actual distance
+ * is greater than max_step.
+ */
 int FuncNode::compute_distance(FuncNode * target, int max_step)
 {
        SnapList<FuncNode *> queue;
 int FuncNode::compute_distance(FuncNode * target, int max_step)
 {
        SnapList<FuncNode *> queue;
index baf6d43e7d6c78e14fe2dcd3fbf5f7f2eeab07bf..d660620fe9cef6574ec15b18a2ad6e4d62f033d4 100644 (file)
--- a/hashset.h
+++ b/hashset.h
@@ -21,7 +21,7 @@ struct LinkNode {
 template<typename _Key, typename _KeyInt, int _Shift, void * (* _malloc)(size_t), void * (* _calloc)(size_t, size_t), void (*_free)(void *), unsigned int (*hash_function)(_Key), bool (*equals)(_Key, _Key)>
 class HashSet;
 
 template<typename _Key, typename _KeyInt, int _Shift, void * (* _malloc)(size_t), void * (* _calloc)(size_t, size_t), void (*_free)(void *), unsigned int (*hash_function)(_Key), bool (*equals)(_Key, _Key)>
 class HashSet;
 
-template<typename _Key, typename _KeyInt, int _Shift, void * (* _malloc)(size_t), void * (* _calloc)(size_t, size_t), void (*_free)(void *), unsigned int (*hash_function)(_Key) = default_hash_function<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = default_equals<_Key> >
+template<typename _Key, typename _KeyInt, int _Shift, void * (* _malloc)(size_t) = snapshot_malloc, void * (* _calloc)(size_t, size_t) = snapshot_calloc, void (*_free)(void *) = snapshot_free, unsigned int (*hash_function)(_Key) = default_hash_function<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = default_equals<_Key> >
 class HSIterator {
 public:
        HSIterator(LinkNode<_Key> *_curr, HashSet <_Key, _KeyInt, _Shift, _malloc, _calloc, _free, hash_function, equals> * _set) :
 class HSIterator {
 public:
        HSIterator(LinkNode<_Key> *_curr, HashSet <_Key, _KeyInt, _Shift, _malloc, _calloc, _free, hash_function, equals> * _set) :