From: Brian Demsky Date: Thu, 31 Aug 2017 23:38:18 +0000 (-0700) Subject: Bug fixes X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=commitdiff_plain;h=4fb2e495226aac9979e026139f5b4a8eafa0eaba Bug fixes --- diff --git a/src/ASTAnalyses/ordergraph.cc b/src/ASTAnalyses/ordergraph.cc index 6169bd8..fcc9eda 100644 --- a/src/ASTAnalyses/ordergraph.cc +++ b/src/ASTAnalyses/ordergraph.cc @@ -65,7 +65,8 @@ void OrderGraph::addOrderEdge(OrderNode *node1, OrderNode *node2, BooleanOrder * } case P_UNDEFINED: //There is an unreachable order constraint if this assert fires - ASSERT(0); + //Clients can easily do this, so don't do anything. + ; } } diff --git a/src/ASTTransform/decomposeordertransform.h b/src/ASTTransform/decomposeordertransform.h index 84b17f3..3d7d6e8 100644 --- a/src/ASTTransform/decomposeordertransform.h +++ b/src/ASTTransform/decomposeordertransform.h @@ -21,7 +21,8 @@ public: } void setCurrentOrder(Order* _current) { currOrder = _current;} bool canExecuteTransform(); -private: + CMEMALLOC; + private: Order* currOrder; OrderGraph* currGraph; }; diff --git a/src/ASTTransform/transform.h b/src/ASTTransform/transform.h index 98316de..678c732 100644 --- a/src/ASTTransform/transform.h +++ b/src/ASTTransform/transform.h @@ -19,7 +19,8 @@ public: virtual ~Transform(); virtual bool canExecuteTransform() = 0; virtual void doTransform() = 0; -protected: + CMEMALLOC; + protected: // Need solver for translating back the result ... CSolver* solver; }; diff --git a/src/ASTTransform/transformer.h b/src/ASTTransform/transformer.h index 68e64b1..4e9f427 100644 --- a/src/ASTTransform/transformer.h +++ b/src/ASTTransform/transformer.h @@ -19,7 +19,8 @@ public: ~Transformer(); IntegerEncodingTransform* getIntegerEncodingTransform(){ return integerEncoding; } void orderAnalysis(); -private: + CMEMALLOC; + private: //For now we can just add transforms here, but in future we may want take a smarter approach. IntegerEncodingTransform* integerEncoding; DecomposeOrderTransform* decomposeOrder; diff --git a/src/Collections/cppvector.h b/src/Collections/cppvector.h index 377ffe4..e9164df 100644 --- a/src/Collections/cppvector.h +++ b/src/Collections/cppvector.h @@ -78,7 +78,7 @@ public: type *expose() { return array; } - + CMEMALLOC; private: uint size; uint capacity; diff --git a/src/common.mk b/src/common.mk index b60aa70..8ffb364 100644 --- a/src/common.mk +++ b/src/common.mk @@ -8,7 +8,7 @@ UNAME := $(shell uname) LIB_NAME := cons_comp LIB_SO := lib_$(LIB_NAME).so -CPPFLAGS += -Wall -g -O3 +CPPFLAGS += -Wall -g -O0 # Mac OSX options ifeq ($(UNAME), Darwin) diff --git a/src/csolver.cc b/src/csolver.cc index 0270758..19ebe31 100644 --- a/src/csolver.cc +++ b/src/csolver.cc @@ -282,13 +282,15 @@ Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean **array, uint asize) Boolean *b=array[i]; if (b->type == BOOLCONST) { if (b->isTrue()) - return b; + return boolTrue; else continue; } else newarray[newindex++]=b; } - if (newindex==1) + if (newindex==0) { + return boolFalse; + } else if (newindex==1) return newarray[0]; else if (newindex == 2) { bool isNot0 = (newarray[0]->type==BOOLCONST) && ((BooleanLogic *)newarray[0])->op == SATC_NOT; @@ -318,11 +320,13 @@ Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean **array, uint asize) if (b->isTrue()) continue; else - return b; + return boolFalse; } else newarray[newindex++]=b; } - if(newindex==1) { + if (newindex==0) { + return boolTrue; + } else if(newindex==1) { return newarray[0]; } else { array = newarray; @@ -348,6 +352,7 @@ Boolean *CSolver::applyLogicalOperation(LogicOp op, Boolean **array, uint asize) } } + ASSERT(asize != 0); Boolean *boolean = new BooleanLogic(this, op, array, asize); Boolean *b = boolMap.get(boolean); if (b == NULL) { diff --git a/src/mymemory.h b/src/mymemory.h index 1c7f3b3..09ea7cd 100644 --- a/src/mymemory.h +++ b/src/mymemory.h @@ -25,11 +25,21 @@ void * ourcalloc(size_t count, size_t size); void * ourrealloc(void *ptr, size_t size); */ +void * model_malloc(size_t size); +void model_free(void *ptr); +void * model_calloc(size_t count, size_t size); +void * model_realloc(void *ptr, size_t size); + +#define ourmalloc model_malloc +#define ourfree model_free +#define ourrealloc model_realloc +#define ourcalloc model_calloc +/* static inline void *ourmalloc(size_t size) { return malloc(size); } static inline void ourfree(void *ptr) { free(ptr); } static inline void *ourcalloc(size_t count, size_t size) { return calloc(count, size); } -static inline void *ourrealloc(void *ptr, size_t size) { return realloc(ptr, size); } +static inline void *ourrealloc(void *ptr, size_t size) { return realloc(ptr, size); }*/ #define CMEMALLOC \ void *operator new(size_t size) { \