Changeset: 5b7c7281f0a0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5b7c7281f0a0
Modified Files:
        NT/monetdb_config.h.in
        NT/rules.msc
        common/stream/stream.c
        configure.ag
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_bat.c
        gdk/gdk_bbp.c
        gdk/gdk_calc.c
        gdk/gdk_calc_private.h
        gdk/gdk_imprints.c
        gdk/gdk_logger.c
        gdk/gdk_search.c
        gdk/gdk_select.c
        gdk/gdk_storage.c
        gdk/gdk_utils.c
        monetdb5/extras/jaql/jaql.c
        monetdb5/extras/jaql/json_jaql.c
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_debugger.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_recycle.c
        monetdb5/mal/mal_runtime.c
        monetdb5/modules/atoms/mtime.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/querylog.c
        monetdb5/modules/mal/remote.c
        monetdb5/optimizer/opt_pipes.c
        monetdb5/optimizer/opt_statistics.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/storage/bat/bat_storage.c
Branch: multifarm
Log Message:

Merge with default branch.


diffs (truncated from 1327 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -142,6 +142,9 @@
 /* Define to 1 if you have the <execinfo.h> header file. */
 /* #undef HAVE_EXECINFO_H */
 
+/* Define to 1 if you have the `fabsf' function. */
+#define HAVE_FABSF 1
+
 /* Define to 1 if you have the `fcntl' function. */
 /* #undef HAVE_FCNTL */
 
@@ -305,6 +308,10 @@
 /* Define to 1 if you have the <limits.h> header file. */
 #define HAVE_LIMITS_H 1
 
+/* Define to 1 if you have the `llabs' function. */
+#define HAVE_LLABS 1
+#define llabs _abs64
+
 /* Define to 1 if you have the <locale.h> header file. */
 #define HAVE_LOCALE_H 1
 
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -209,10 +209,10 @@ CONFIGURE_PY = "$(TOPDIR)\..\NT\winconfi
 WINCONFIG_INCS = "-I$(TOPDIR)\..\buildtools\conf"
 
 !IFDEF DEBUG
-COMPILERFLAGS = -GF -W3 $(W_CFLAGS) -MDd -nologo -Od -D_DEBUG -RTC1 -Zi
+COMPILERFLAGS = -GF -W3 $(W_CFLAGS) -MDd -nologo -Od -D_DEBUG -RTC1 -Zi -Oi
 !ELSE
 # add -Zi flag (implies -debug, not -D_DEBUG) to get symbol info in .pdb files
-COMPILERFLAGS = -GF -W3 $(W_CFLAGS) -MD -nologo -Ox -Zi
+COMPILERFLAGS = -GF -W3 $(W_CFLAGS) -MD -nologo -Ox -Zi -Oi
 !ENDIF
 CFLAGS = $(COMPILERFLAGS)  -I. -I$(TOPDIR) $(LIBC_INCS) $(INCLUDES) 
$(WINCONFIG_INCS) $(ICONV_CFLAGS) $(ATOMIC_OPS_CFLAGS)
 
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -118,14 +118,21 @@
 #define UTF8BOM                "\xEF\xBB\xBF" /* UTF-8 encoding of Unicode BOM 
*/
 #define UTF8BOMLENGTH  3              /* length of above */
 
+#ifdef _MSC_VER
+/* use intrinsic functions on Windows */
+#define short_int_SWAP(s)      ((short) _byteswap_ushort((unsigned short) (s)))
+/* on Windows, long is the same size as int */
+#define normal_int_SWAP(s)     ((int) _byteswap_ulong((unsigned long) (s)))
+#define long_long_SWAP(l)      ((lng) _byteswap_uint64((unsigned __int64) (s)))
+#else
 #define short_int_SWAP(s) ((short)(((0x00ff&(s))<<8) | ((0xff00&(s))>>8)))
 
 #define normal_int_SWAP(i) (((0x000000ff&(i))<<24) | ((0x0000ff00&(i))<<8) | \
                       ((0x00ff0000&(i))>>8)  | ((0xff000000&(i))>>24))
-
 #define long_long_SWAP(l) \
                ((((lng)normal_int_SWAP(l))<<32) |\
                 (0xffffffff&normal_int_SWAP(l>>32)))
+#endif
 
 
 struct stream {
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2756,6 +2756,7 @@ LIBS="$LIBS $MATH_LIBS"
 AC_CHECK_FUNCS([\
                                asctime_r \
                                ctime_r \
+                               fabsf \
                                fcntl \
                                fpclass \
                                fpclassify \
@@ -2770,6 +2771,7 @@ AC_CHECK_FUNCS([\
                                getuid \
                                isinf \
                                kill \
+                               llabs \
                                localtime_r \
                                lockf \
                                madvise \
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -531,9 +531,6 @@
  * The interface definitions for the application programs are shown
  * below.  The global variables should not be modified directly.
  */
-#define NEG(A) (((int)(A))>0?-((int)(A)):((int)(A)))
-#define ABS(A) (((int)(A))>0?((int)(A)):-((int)(A)))
-
 #ifndef TRUE
 #define TRUE           1
 #define FALSE          0
@@ -1879,18 +1876,18 @@ gdk_export bat BBPlimit;
 gdk_export BBPrec *BBP[N_BBPINIT];
 
 /* fast defines without checks; internal use only  */
-#define BBP_cache(i)   BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].cache[(i)<0]
-#define BBP_logical(i) 
BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].logical[(i)<0]
-#define BBP_bak(i)     BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].bak[(i)<0]
-#define BBP_next(i)    BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].next[(i)<0]
-#define BBP_physical(i)        
BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].physical
-#define BBP_options(i) BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].options
-#define BBP_desc(i)    BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].desc
-#define BBP_refs(i)    BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].refs
-#define BBP_lrefs(i)   BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].lrefs
-#define BBP_lastused(i)        
BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].lastused
-#define BBP_status(i)  BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].status
-#define BBP_pid(i)     BBP[ABS(i)>>BBPINITLOG][ABS(i)&(BBPINIT-1)].pid
+#define BBP_cache(i)   BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].cache[(i)<0]
+#define BBP_logical(i) 
BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].logical[(i)<0]
+#define BBP_bak(i)     BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].bak[(i)<0]
+#define BBP_next(i)    BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].next[(i)<0]
+#define BBP_physical(i)        
BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].physical
+#define BBP_options(i) BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].options
+#define BBP_desc(i)    BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].desc
+#define BBP_refs(i)    BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].refs
+#define BBP_lrefs(i)   BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].lrefs
+#define BBP_lastused(i)        
BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].lastused
+#define BBP_status(i)  BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].status
+#define BBP_pid(i)     BBP[abs(i)>>BBPINITLOG][abs(i)&(BBPINIT-1)].pid
 
 /* macros that nicely check parameters */
 #define BBPcacheid(b)  ((b)->batCacheid)
@@ -1898,16 +1895,16 @@ gdk_export BBPrec *BBP[N_BBPINIT];
 gdk_export int BBPcurstamp(void);
 #define BBPrefs(i)     (BBPcheck((i),"BBPrefs")?BBP_refs(i):-1)
 #define BBPcache(i)    (BBPcheck((i),"BBPcache")?BBP_cache(i):(BAT*) NULL)
-/* we use ABS(i) instead of -(i) here because of a bug in gcc 4.8.2
+/* we use abs(i) instead of -(i) here because of a bug in gcc 4.8.2
  * (at least) with optimization enabled; it incorrectly complains
  * about an array bound error in monetdb5/modules/kernel/status.c */
 #define BBPname(i)                                                     \
        (BBPcheck((i), "BBPname") ?                                     \
         ((i) > 0 ?                                                     \
          BBP[(i) >> BBPINITLOG][(i) & (BBPINIT - 1)].logical[0] :      \
-         (BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[1] ? \
-          BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[1] : \
-          BBP[ABS(i) >> BBPINITLOG][ABS(i) & (BBPINIT - 1)].logical[0])) : \
+         (BBP[abs(i) >> BBPINITLOG][abs(i) & (BBPINIT - 1)].logical[1] ? \
+          BBP[abs(i) >> BBPINITLOG][abs(i) & (BBPINIT - 1)].logical[1] : \
+          BBP[abs(i) >> BBPINITLOG][abs(i) & (BBPINIT - 1)].logical[0])) : \
         "")
 #define BBPvalid(i)    (BBP_logical(i) != NULL && *BBP_logical(i) != '.')
 #define BATgetId(b)    BBPname((b)->batCacheid)
@@ -2631,7 +2628,7 @@ static inline bat
 BBPcheck(register bat x, register const char *y)
 {
        if (x && x != bat_nil) {
-               register bat z = ABS(x);
+               register bat z = abs(x);
 
                if (z >= getBBPsize() || BBP_logical(z) == NULL) {
                        CHECKDEBUG THRprintf(GDKstdout,"#%s: range error %d\n", 
y, (int) x);
@@ -2921,14 +2918,14 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b
 #define isVIEW(x)                                                      \
        ((x)->H->heap.parentid ||                                       \
         (x)->T->heap.parentid ||                                       \
-        ((x)->H->vheap && (x)->H->vheap->parentid != ABS((x)->batCacheid)) || \
-        ((x)->T->vheap && (x)->T->vheap->parentid != ABS((x)->batCacheid)))
+        ((x)->H->vheap && (x)->H->vheap->parentid != abs((x)->batCacheid)) || \
+        ((x)->T->vheap && (x)->T->vheap->parentid != abs((x)->batCacheid)))
 
 #define isVIEWCOMBINE(x) ((x)->H == (x)->T)
 #define VIEWhparent(x) ((x)->H->heap.parentid)
-#define VIEWvhparent(x)        
(((x)->H->vheap==NULL||(x)->H->vheap->parentid==ABS((x)->batCacheid))?0:(x)->H->vheap->parentid)
+#define VIEWvhparent(x)        
(((x)->H->vheap==NULL||(x)->H->vheap->parentid==abs((x)->batCacheid))?0:(x)->H->vheap->parentid)
 #define VIEWtparent(x) ((x)->T->heap.parentid)
-#define VIEWvtparent(x)        
(((x)->T->vheap==NULL||(x)->T->vheap->parentid==ABS((x)->batCacheid))?0:(x)->T->vheap->parentid)
+#define VIEWvtparent(x)        
(((x)->T->vheap==NULL||(x)->T->vheap->parentid==abs((x)->batCacheid))?0:(x)->T->vheap->parentid)
 
 /* VIEWparentcol(b) tells whether the head column was inherited from
  * the parent "as is". We must check whether the type was not
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -576,7 +576,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                                if (avg == dbl_nil)
                                        *(flt *) res = flt_nil;
                                else if (cnt > 0 &&
-                                        GDK_flt_max / cnt < ABS(avg)) {
+                                        GDK_flt_max / cnt < fabs(avg)) {
                                        if (abort_on_error) {
                                                GDKerror("22003!overflow in 
calculation.\n");
                                                return GDK_FAIL;
@@ -589,7 +589,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                                if (avg == dbl_nil) {
                                        *(dbl *) res = dbl_nil;
                                } else if (cnt > 0 &&
-                                          GDK_dbl_max / cnt < ABS(avg)) {
+                                          GDK_dbl_max / cnt < fabs(avg)) {
                                        if (abort_on_error) {
                                                GDKerror("22003!overflow in 
calculation.\n");
                                                return GDK_FAIL;
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -427,7 +427,7 @@ VIEWcombine(BAT *b)
                if (bn->T->heap.parentid)
                        BBPshare(bn->T->heap.parentid);
                if (bn->T->vheap) {
-                       assert(bn->T->vheap->parentid != ABS(bn->batCacheid));
+                       assert(bn->T->vheap->parentid != abs(bn->batCacheid));
                        assert(bn->T->vheap->parentid > 0);
                        BBPshare(bn->T->vheap->parentid);
                }
@@ -554,9 +554,9 @@ VIEWunlink(BAT *b)
                /* unlink heaps shared with parent */
                assert(b->H->vheap == NULL || b->H->vheap->parentid > 0);
                assert(b->T->vheap == NULL || b->T->vheap->parentid > 0);
-               if (b->H->vheap && b->H->vheap->parentid != ABS(b->batCacheid))
+               if (b->H->vheap && b->H->vheap->parentid != abs(b->batCacheid))
                        b->H->vheap = NULL;
-               if (b->T->vheap && b->T->vheap->parentid != ABS(b->batCacheid))
+               if (b->T->vheap && b->T->vheap->parentid != abs(b->batCacheid))
                        b->T->vheap = NULL;
 
                /* unlink properties shared with parent */
@@ -603,7 +603,7 @@ VIEWreset(BAT *b)
                memset(&hh, 0, sizeof(Heap));
                memset(&th, 0, sizeof(Heap));
 
-               n = BATdescriptor(ABS(b->batCacheid)); /* normalized */
+               n = BATdescriptor(abs(b->batCacheid)); /* normalized */
                if (n == NULL)
                        goto bailout;
                m = BATmirror(n); /* mirror of normalized */
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -580,13 +580,13 @@ BATclear(BAT *b, int force)
                                return NULL;
                        }
                }
-               assert(b->H->vheap == NULL || b->H->vheap->parentid == 
ABS(b->batCacheid));
+               assert(b->H->vheap == NULL || b->H->vheap->parentid == 
abs(b->batCacheid));
                if (b->H->vheap && b->H->vheap->free > 0) {
                        hh.parentid = b->H->vheap->parentid;
                        HEAPfree(b->H->vheap);
                        *b->H->vheap = hh;
                }
-               assert(b->T->vheap == NULL || b->T->vheap->parentid == 
ABS(b->batCacheid));
+               assert(b->T->vheap == NULL || b->T->vheap->parentid == 
abs(b->batCacheid));
                if (b->T->vheap && b->T->vheap->free > 0) {
                        th.parentid = b->T->vheap->parentid;
                        HEAPfree(b->T->vheap);
@@ -1923,11 +1923,11 @@ BUNlocate(BAT *b, const void *x, const v
                                v = BATmirror(v);
                        }
                        if (v->H->hash) {
-                               MT_lock_set(&GDKhashLock(ABS(b->batCacheid)), 
"BUNlocate");
+                               MT_lock_set(&GDKhashLock(abs(b->batCacheid)), 
"BUNlocate");
                                if (b->H->hash == NULL) {       /* give it to 
the parent */
                                        b->H->hash = v->H->hash;
                                }
-                               MT_lock_unset(&GDKhashLock(ABS(b->batCacheid)), 
"BUNlocate");
+                               MT_lock_unset(&GDKhashLock(abs(b->batCacheid)), 
"BUNlocate");
                        }
                        BBPreclaim(v);
                        v = NULL;
@@ -2703,7 +2703,7 @@ BATmode(BAT *b, int mode)
        }
 
        if (mode != b->batPersistence) {
-               bat bid = ABS(b->batCacheid);
+               bat bid = abs(b->batCacheid);
 
                if (mode == PERSISTENT) {
                        check_type(b->htype);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -221,7 +221,7 @@ int BBPout = 0;                     /* bats saved statisti
  *
  * To reduce contention GDKswapLock was split into multiple locks; it
  * is now an array of lock pointers which is accessed by
- * GDKswapLock(ABS(bat))
+ * GDKswapLock(abs(bat))
  * @end table
  *
  * Routines that need both locks should first acquire the locks in the
@@ -464,7 +464,7 @@ fixoidheapcolumn(BAT *b, const char *src
                 const char *filename, const char *headtail,
                 const char *htheap)
 {
-       bat bid = ABS(b->batCacheid);
+       bat bid = abs(b->batCacheid);
        Heap h1, h2;
        int *old;
        oid *new;
@@ -1604,7 +1604,7 @@ BBP_find(const char *nme, int lock)
                /* for tmp_X and tmpr_X BATs, we already know X */
                const char *s;
 
-               if (ABS(i) >= (bat) ATOMIC_GET(BBPsize, BBPsizeLock, 
"BBP_find") || (s = BBP_logical(i)) == NULL || strcmp(s, nme)) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to