Bug fixes
authorBrian Demsky <bdemsky@uci.edu>
Thu, 31 Aug 2017 23:38:18 +0000 (16:38 -0700)
committerbdemsky <bdemsky@uci.edu>
Thu, 31 Aug 2017 23:38:26 +0000 (16:38 -0700)
src/ASTAnalyses/ordergraph.cc
src/ASTTransform/decomposeordertransform.h
src/ASTTransform/transform.h
src/ASTTransform/transformer.h
src/Collections/cppvector.h
src/common.mk
src/csolver.cc
src/mymemory.h

index 6169bd875b6afbf75e141e83539af56cfa8e2eb1..fcc9eda132f0b3b1e0c56e5e8e409968a243f9e2 100644 (file)
@@ -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.
+               ;
        }
 }
 
index 84b17f323631b6fd966c05df75881c0651ad0cbf..3d7d6e857297c4fefd19fdadb27861b81bb6fe18 100644 (file)
@@ -21,7 +21,8 @@ public:
        }
        void setCurrentOrder(Order* _current) { currOrder = _current;}
        bool canExecuteTransform();
-private:
+       CMEMALLOC;
+ private:
        Order* currOrder;
        OrderGraph* currGraph;
 };
index 98316dea5e03d84f3453c2eb5a031fee58e27f9d..678c732f64f1b401f4535acfdd29cbfcedf2d2a2 100644 (file)
@@ -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;
 };
index 68e64b1e929cd97c66ac12eb160bdaf6db47c8c4..4e9f42715ff7ef2713d749089f20919957bf2e23 100644 (file)
@@ -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;
index 377ffe499d201020533b37d9e776ac4a2de30837..e9164df61bdbe6426fb53093fd0016bae922e82f 100644 (file)
@@ -78,7 +78,7 @@ public:
        type *expose() {
                return array;
        }
-
+       CMEMALLOC;
 private:
        uint size;
        uint capacity;
index b60aa709f74d1d511ba75e8d9881e0fa8279cd17..8ffb36415bedd1a82654855695bdbf3b0be88dcd 100644 (file)
@@ -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)
index 0270758af28faa087efc0d2f2cc358e15a221d53..19ebe3156e4691d63e19d4e91fc8549babc0d0f4 100644 (file)
@@ -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) {
index 1c7f3b3f2f4924daf3fdcd81ea444f4dad14ba55..09ea7cdb535a85f88c5669c302423fbb8d399af3 100644 (file)
    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) {       \