diff options
author | Morgan Deters <mdeters@gmail.com> | 2009-12-16 04:25:45 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2009-12-16 04:25:45 +0000 |
commit | 79df573326e6911d3a97fcc2528105acd1c2c525 (patch) | |
tree | 70930bcdb620cdf8ff9e3e9c495f67ed8317aa2e /src/context | |
parent | 8cb3a7b556e8b4b85745bffbd1f0246e6af29588 (diff) |
Fixes to the build system:
Makefile.am files - remove obsolete INCLUDES, incorporate into AM_CPPFLAGS
Makefile files in src/ - support "make" under src/ (current build profile)
configure.ac - updates to fix warnings
config/antlr.m4 - updates to fix warnings
autogen.sh - updates to generate warnings from autotools; also support Macs
src/include/cvc4_config.h - guard with #ifdef
total reimplementation of NodeBuilder
ExprValue => NodeValue
context_mm.{h,cpp} - fixed numerous compile errors
Diffstat (limited to 'src/context')
-rw-r--r-- | src/context/Makefile | 5 | ||||
-rw-r--r-- | src/context/Makefile.am | 5 | ||||
-rw-r--r-- | src/context/Makefile.in | 14 | ||||
-rw-r--r-- | src/context/context_mm.cpp | 36 | ||||
-rw-r--r-- | src/context/context_mm.h | 4 |
5 files changed, 37 insertions, 27 deletions
diff --git a/src/context/Makefile b/src/context/Makefile new file mode 100644 index 000000000..5286dd3ac --- /dev/null +++ b/src/context/Makefile @@ -0,0 +1,5 @@ +topdir = ../.. +srcdir = src/context +builddir = $(topdir)/builds/$(srcdir) + +include $(topdir)/Makefile.subdir diff --git a/src/context/Makefile.am b/src/context/Makefile.am index e38f7f4eb..b36d5e69c 100644 --- a/src/context/Makefile.am +++ b/src/context/Makefile.am @@ -1,6 +1,7 @@ -INCLUDES = -I@srcdir@/../include -I@srcdir@/.. +AM_CPPFLAGS = \ + -D__BUILDING_CVC4LIB \ + -I@srcdir@/../include -I@srcdir@/.. AM_CXXFLAGS = -Wall -fvisibility=hidden -AM_CPPFLAGS = -D__BUILDING_CVC4LIB noinst_LTLIBRARIES = libcontext.la diff --git a/src/context/Makefile.in b/src/context/Makefile.in index 0e5281ca6..51069583d 100644 --- a/src/context/Makefile.in +++ b/src/context/Makefile.in @@ -52,7 +52,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcontext_la_LIBADD = -am_libcontext_la_OBJECTS = context.lo +am_libcontext_la_OBJECTS = context.lo context_mm.lo libcontext_la_OBJECTS = $(am_libcontext_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp @@ -104,6 +104,7 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXXTEST = @CXXTEST@ CXXTESTGEN = @CXXTESTGEN@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ @@ -215,13 +216,17 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I@srcdir@/../include -I@srcdir@/.. +AM_CPPFLAGS = \ + -D__BUILDING_CVC4LIB \ + -I@srcdir@/../include -I@srcdir@/.. + AM_CXXFLAGS = -Wall -fvisibility=hidden -AM_CPPFLAGS = -D__BUILDING_CVC4LIB noinst_LTLIBRARIES = libcontext.la libcontext_la_SOURCES = \ context.cpp \ - context.h + context.h \ + context_mm.cpp \ + context_mm.h all: all-am @@ -276,6 +281,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context_mm.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/src/context/context_mm.cpp b/src/context/context_mm.cpp index 51f192f2a..3b4089b25 100644 --- a/src/context/context_mm.cpp +++ b/src/context/context_mm.cpp @@ -14,14 +14,13 @@ #include <cstdlib> #include <vector> #include <deque> +#include <new> #include "context/context_mm.h" #include "util/Assert.h" - namespace CVC4 { namespace context { - void ContextMemoryManager::newChunk() { // Increment index to chunk list @@ -30,16 +29,16 @@ void ContextMemoryManager::newChunk() { "Index should be at the end of the list"); // Create new chunk if no free chunk available - if (d_freePages.empty()) { + if (d_freeChunks.empty()) { d_chunkList.push_back((char*)malloc(chunkSizeBytes)); if (d_chunkList.back() == NULL) { - throw bad_alloc(); + throw std::bad_alloc(); } } // If there is a free chunk, use that else { - d_chunkList.push_back(d_freePages.back()); - d_freePages.pop_back(); + d_chunkList.push_back(d_freeChunks.back()); + d_freeChunks.pop_back(); } // Set up the current chunk pointers d_nextFree = d_chunkList.back(); @@ -47,30 +46,30 @@ void ContextMemoryManager::newChunk() { } -ContextMemoryManager() : d_indexChunkList(0) { +ContextMemoryManager::ContextMemoryManager() : d_indexChunkList(0) { // Create initial chunk d_chunkList.push_back((char*)malloc(chunkSizeBytes)); d_nextFree = d_chunkList.back(); if (d_nextFree == NULL) { - throw bad_alloc; + throw std::bad_alloc(); } d_endChunk = d_nextFree + chunkSizeBytes; } -~ContextMemoryManager() { +ContextMemoryManager::~ContextMemoryManager() { // Delete all chunks while (!d_chunkList.empty()) { free(d_chunkList.back()); d_chunkList.pop_back(); } - while (!d_freePages.empty()) { - free(d_freePages.back()); - d_freePages.pop_back(); + while (!d_freeChunks.empty()) { + free(d_freeChunks.back()); + d_freeChunks.pop_back(); } } -void* newData(size_t size) { +void* ContextMemoryManager::newData(size_t size) { // Use next available free location in current chunk void* res = (void*)d_nextFree; d_nextFree += size; @@ -86,7 +85,7 @@ void* newData(size_t size) { } -void push() { +void ContextMemoryManager::push() { // Store current state on the stack d_nextFreeStack.push_back(d_nextFree); d_endChunkStack.push_back(d_endChunk); @@ -94,7 +93,7 @@ void push() { } -void pop() { +void ContextMemoryManager::pop() { // Restore state from stack d_nextFree = d_nextFreeStack.back(); d_nextFreeStack.pop_back(); @@ -103,7 +102,7 @@ void pop() { // Free all the new chunks since the last push while (d_indexChunkList > d_indexChunkListStack.back()) { - d_freePages.push_back(d_chunkList.back()); + d_freeChunks.push_back(d_chunkList.back()); d_chunkList.pop_back(); --d_indexChunkList; } @@ -111,12 +110,11 @@ void pop() { // Delete excess free chunks while (d_freeChunks.size() > maxFreeChunks) { - free(d_freePages.front()); - d_freePages.pop_front(); + free(d_freeChunks.front()); + d_freeChunks.pop_front(); } } }/* CVC4::context namespace */ - }/* CVC4 namespace */ diff --git a/src/context/context_mm.h b/src/context/context_mm.h index 6b442d4a0..d48cbedc0 100644 --- a/src/context/context_mm.h +++ b/src/context/context_mm.h @@ -33,13 +33,13 @@ class ContextMemoryManager { /** * Memory in regions is allocated in chunks. This is the minimum chunk size */ - const unsigned chunkSizeBytes = 16384; // #bytes in each chunk + static const unsigned chunkSizeBytes = 16384; // #bytes in each chunk /** * A list of free chunks is maintained. This is the maximum number of * free chunks. */ - const unsigned maxFreeChunks = 100; + static const unsigned maxFreeChunks = 100; /** * List of all chunks that are currently active |