Merge branch 'master' of ssh://demsky.eecs.uci.edu/home/git/constraint_compiler into...
authorHamed <hamed.gorjiara@gmail.com>
Fri, 1 Sep 2017 01:43:56 +0000 (18:43 -0700)
committerHamed <hamed.gorjiara@gmail.com>
Fri, 1 Sep 2017 01:43:56 +0000 (18:43 -0700)
src/ASTAnalyses/ordergraph.cc
src/ASTAnalyses/ordernode.h
src/ASTTransform/decomposeordertransform.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 6169bd8..fcc9eda 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 08685d4..50543ac 100644 (file)
@@ -14,7 +14,7 @@
 #include "structs.h"
 #include "orderedge.h"
 
-enum NodeStatus {NOTVISITED, VISITED, FINISHED, SATC_ADDEDTOSET};
+enum NodeStatus {NOTVISITED, VISITED, FINISHED, ADDEDTOSET};
 typedef enum NodeStatus NodeStatus;
 
 class OrderNode {
index f90a666..262497e 100644 (file)
@@ -60,12 +60,12 @@ void DecomposeOrderTransform::doTransform(){
                                else
                                        partialcandidatevec.setExpand(from->sccNum, NULL);
                        }
-                       if (from->status != SATC_ADDEDTOSET) {
-                               from->status = SATC_ADDEDTOSET;
+                       if (from->status != ADDEDTOSET) {
+                               from->status = ADDEDTOSET;
                                ((MutableSet *)neworder->set)->addElementMSet(from->id);
                        }
-                       if (to->status != SATC_ADDEDTOSET) {
-                               to->status = SATC_ADDEDTOSET;
+                       if (to->status != ADDEDTOSET) {
+                               to->status = ADDEDTOSET;
                                ((MutableSet *)neworder->set)->addElementMSet(to->id);
                        }
                        if (currOrder->type == SATC_PARTIAL) {
index 84b17f3..3d7d6e8 100644 (file)
@@ -21,7 +21,8 @@ public:
        }
        void setCurrentOrder(Order* _current) { currOrder = _current;}
        bool canExecuteTransform();
-private:
+       CMEMALLOC;
+ private:
        Order* currOrder;
        OrderGraph* currGraph;
 };
index 98316de..678c732 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 68e64b1..4e9f427 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 377ffe4..e9164df 100644 (file)
@@ -78,7 +78,7 @@ public:
        type *expose() {
                return array;
        }
-
+       CMEMALLOC;
 private:
        uint size;
        uint capacity;
index b60aa70..8ffb364 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 0270758..19ebe31 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 1c7f3b3..09ea7cd 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) {       \