diff options
author | Claire Xen <claire@clairexen.net> | 2022-02-15 17:57:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 17:57:27 +0100 |
commit | 57ef73b2053ad644cfecd608dafdb9b848fc6cdb (patch) | |
tree | 0c3ff28e48071a2c921b7ed1fe7218124c1df629 /src/sat/glucose | |
parent | 9b245d9f6910c048e9bbcf95ee5dee46f2f24f2c (diff) | |
parent | 264dfc7ed414476438e4a858258f5516d7b863c6 (diff) | |
download | abc-57ef73b2053ad644cfecd608dafdb9b848fc6cdb.tar.gz abc-57ef73b2053ad644cfecd608dafdb9b848fc6cdb.tar.bz2 abc-57ef73b2053ad644cfecd608dafdb9b848fc6cdb.zip |
Merge pull request #10 from YosysHQ/yosys-experimental
Integrate write_cex and cexinfo and some fixes in write_cex output code
Diffstat (limited to 'src/sat/glucose')
-rw-r--r-- | src/sat/glucose/Alloc.h | 8 | ||||
-rw-r--r-- | src/sat/glucose/IntTypes.h | 14 | ||||
-rw-r--r-- | src/sat/glucose/Vec.h | 4 | ||||
-rw-r--r-- | src/sat/glucose/XAlloc.h | 4 |
4 files changed, 22 insertions, 8 deletions
diff --git a/src/sat/glucose/Alloc.h b/src/sat/glucose/Alloc.h index e56b5441..a63de032 100644 --- a/src/sat/glucose/Alloc.h +++ b/src/sat/glucose/Alloc.h @@ -100,7 +100,11 @@ void RegionAllocator<T>::capacity(uint32_t min_cap) cap += delta; if (cap <= prev_cap) +#ifdef __wasm + abort(); +#else throw OutOfMemoryException(); +#endif } //printf(" .. (%p) cap = %u\n", this, cap); @@ -122,7 +126,11 @@ RegionAllocator<T>::alloc(int size) // Handle overflow: if (sz < prev_sz) +#ifdef __wasm + abort(); +#else throw OutOfMemoryException(); +#endif return prev_sz; } diff --git a/src/sat/glucose/IntTypes.h b/src/sat/glucose/IntTypes.h index 3f75862b..5c4176b2 100644 --- a/src/sat/glucose/IntTypes.h +++ b/src/sat/glucose/IntTypes.h @@ -28,20 +28,18 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA # include <sys/int_fmtio.h> # include <sys/int_limits.h> -#else +#elif _WIN32 -#define __STDC_LIMIT_MACROS # include "pstdint.h" -//# include <inttypes.h> -#endif +#else -#include <limits.h> +# define __STDC_LIMIT_MACROS +# include <limits.h> +# include <inttypes.h> -#ifndef PRIu64 -#define PRIu64 "lu" -#define PRIi64 "ld" #endif + //================================================================================================= #include <misc/util/abc_namespaces.h> diff --git a/src/sat/glucose/Vec.h b/src/sat/glucose/Vec.h index dd1bc20a..d2781635 100644 --- a/src/sat/glucose/Vec.h +++ b/src/sat/glucose/Vec.h @@ -100,7 +100,11 @@ void vec<T>::capacity(int min_cap) { if (cap >= min_cap) return; int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2 if (add > INT_MAX - cap || (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)) +#ifdef __wasm + abort(); +#else throw OutOfMemoryException(); +#endif } diff --git a/src/sat/glucose/XAlloc.h b/src/sat/glucose/XAlloc.h index 233f834e..d1f1062a 100644 --- a/src/sat/glucose/XAlloc.h +++ b/src/sat/glucose/XAlloc.h @@ -39,7 +39,11 @@ static inline void* xrealloc(void *ptr, size_t size) { void* mem = realloc(ptr, size); if (mem == NULL && errno == ENOMEM){ +#ifdef __wasm + abort(); +#else throw OutOfMemoryException(); +#endif }else { return mem; } |