Changeset: 7dba8fff5ae0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7dba8fff5ae0 Modified Files: gdk/gdk_join.c gdk/gdk_select.c monetdb5/mal/mal_interpreter.c Branch: qcancel Log Message:
merge default diffs (truncated from 7219 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -5722,6 +5722,7 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "str", "pattern batcalc.str(X_0:bat[:any]):bat[:str] ", "CMDconvertsignal_str;", "" ] [ "batcalc", "str", "pattern batcalc.str(X_0:bat[:any], X_1:bat[:oid]):bat[:str] ", "CMDconvertsignal_str;", "" ] [ "batcalc", "str", "pattern batcalc.str(X_0:int, X_1:int, X_2:int, X_3:int, X_4:bat[:any_1], X_5:bat[:oid], X_6:int):bat[:str] ", "SQLbatstr_cast;", "" ] +[ "batcalc", "str", "command batcalc.str(X_0:bat[:uuid], X_1:bat[:oid]):bat[:str] ", "UUIDuuid2str_bulk;", "" ] [ "batcalc", "str_noerror", "pattern batcalc.str_noerror(X_0:bat[:any]):bat[:str] ", "CMDconvert_str;", "" ] [ "batcalc", "str_noerror", "pattern batcalc.str_noerror(X_0:bat[:any], X_1:bat[:oid]):bat[:str] ", "CMDconvert_str;", "" ] [ "batcalc", "sub_noerror", "pattern batcalc.sub_noerror(X_0:bat[:bte], X_1:bat[:bte], X_2:bat[:oid], X_3:bat[:oid]):bat[:bte] ", "CMDbatSUB;", "" ] @@ -5843,6 +5844,8 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:oid], X_1:int):bat[:timestamp] ", "nil_2time_timestamp;", "" ] [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:oid], X_1:int, X_2:bat[:BAT]):bat[:timestamp] ", "nil_2time_timestamp;", "" ] [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:timestamp], X_1:bat[:oid], X_2:int):bat[:timestamp] ", "timestamp_2time_timestamp;", "" ] +[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str], X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ] +[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid], X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ] [ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:int, X_2:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] [ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ", "BATXMLstr2xml;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -8211,6 +8211,7 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "str", "pattern batcalc.str(X_0:bat[:any]):bat[:str] ", "CMDconvertsignal_str;", "" ] [ "batcalc", "str", "pattern batcalc.str(X_0:bat[:any], X_1:bat[:oid]):bat[:str] ", "CMDconvertsignal_str;", "" ] [ "batcalc", "str", "pattern batcalc.str(X_0:int, X_1:int, X_2:int, X_3:int, X_4:bat[:any_1], X_5:bat[:oid], X_6:int):bat[:str] ", "SQLbatstr_cast;", "" ] +[ "batcalc", "str", "command batcalc.str(X_0:bat[:uuid], X_1:bat[:oid]):bat[:str] ", "UUIDuuid2str_bulk;", "" ] [ "batcalc", "str_noerror", "pattern batcalc.str_noerror(X_0:bat[:any]):bat[:str] ", "CMDconvert_str;", "" ] [ "batcalc", "str_noerror", "pattern batcalc.str_noerror(X_0:bat[:any], X_1:bat[:oid]):bat[:str] ", "CMDconvert_str;", "" ] [ "batcalc", "sub_noerror", "pattern batcalc.sub_noerror(X_0:bat[:bte], X_1:bat[:bte], X_2:bat[:oid], X_3:bat[:oid]):bat[:bte] ", "CMDbatSUB;", "" ] @@ -8371,6 +8372,8 @@ stdout of test 'MAL-signatures` in direc [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:oid], X_1:int):bat[:timestamp] ", "nil_2time_timestamp;", "" ] [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:oid], X_1:int, X_2:bat[:BAT]):bat[:timestamp] ", "nil_2time_timestamp;", "" ] [ "batcalc", "timestamp", "pattern batcalc.timestamp(X_0:bat[:timestamp], X_1:bat[:oid], X_2:int):bat[:timestamp] ", "timestamp_2time_timestamp;", "" ] +[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:str], X_1:bat[:oid]):bat[:uuid] ", "UUIDstr2uuid_bulk;", "" ] +[ "batcalc", "uuid", "command batcalc.uuid(X_0:bat[:uuid], X_1:bat[:oid]):bat[:uuid] ", "UUIDuuid2uuid_bulk;", "" ] [ "batcalc", "wkb", "command batcalc.wkb(X_0:bat[:wkb], X_1:int, X_2:int):bat[:wkb] ", "geom_2_geom_bat;", "" ] [ "batcalc", "xml", "command batcalc.xml(X_0:bat[:str]):bat[:xml] ", "BATXMLstr2xml;", "" ] [ "batcalc", "xor", "pattern batcalc.xor(X_0:bat[:bit], X_1:bat[:bit]):bat[:bit] ", "CMDbatXOR;", "" ] diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -291,6 +291,7 @@ ATOMIC_FLAG GDKlocklistlock; ATOMIC_TYPE GDKlocksleepcnt; void GDKlockstatistics(int); void *GDKmalloc(size_t size) __attribute__((__malloc__)) __attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__)); +size_t GDKmallocated(const void *s); size_t GDKmem_cursize(void); gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar); void *GDKmmap(const char *path, int mode, size_t len) __attribute__((__warn_unused_result__)); @@ -1350,7 +1351,6 @@ const char *stoptraceRef; void strAfterCall(ValPtr v, ValPtr bak); void strBeforeCall(ValPtr v, ValPtr bak); const char *strRef; -int str_utf8_length(str s); const char *streamsRef; const char *subavgRef; const char *subcountRef; diff --git a/clients/examples/C/bincopydata.h b/clients/examples/C/bincopydata.h --- a/clients/examples/C/bincopydata.h +++ b/clients/examples/C/bincopydata.h @@ -1,5 +1,6 @@ #include "monetdb_config.h" #include "copybinary.h" +#include "copybinary_support.h" void gen_timestamps(FILE *f, bool byteswap, long nrecs); diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/common/utils/CMakeLists.txt +++ b/common/utils/CMakeLists.txt @@ -173,6 +173,7 @@ install(EXPORT mstringTargets install(FILES matomic.h mstring.h + copybinary.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb COMPONENT diff --git a/common/utils/copybinary.h b/common/utils/copybinary.h --- a/common/utils/copybinary.h +++ b/common/utils/copybinary.h @@ -1,3 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. + */ + #ifndef COPYBINARY_H #define COPYBINARY_H @@ -22,136 +30,4 @@ typedef struct { copy_binary_date date; } copy_binary_timestamp; // natural size: 96, natural alignment: 32 - -// According to Godbolt, these code sequences are recognized by -// GCC at least back to 6.2 and Clang at least back to 6.0.0. -// I didn't check earlier ones. -// They properly use byte swapping instructions. -// MSVC doesn't recognize it but that's no problem because we will -// not ever use it for big endian platforms. - -// First some macros that can be used a expressions: -// uint16_t swapped = copy_binary_byteswap16(value); - - -#ifdef _MSC_VER - -static inline uint16_t -copy_binary_byteswap16(uint16_t value) { - return _byteswap_ushort(value); -} - -static inline uint32_t -copy_binary_byteswap32(uint32_t value) { - return _byteswap_ulong(value); -} - -static inline uint64_t -copy_binary_byteswap64(uint64_t value) { - return _byteswap_uint64(value); -} - -#else - -static inline uint16_t -copy_binary_byteswap16(uint16_t value) { - return - ((value & 0xFF00u) >> 8u) | - ((value & 0x00FFu) << 8u) - ; -} - -static inline uint32_t -copy_binary_byteswap32(uint32_t value) { - return - ((value & 0xFF000000u) >> 24u) | - ((value & 0x00FF0000u) >> 8u) | - ((value & 0x0000FF00u) << 8u) | - ((value & 0x000000FFu) << 24u) - ; -} - -static inline uint64_t -copy_binary_byteswap64(uint64_t value) { - return - ((value & 0xFF00000000000000u) >> 56u) | - ((value & 0x00FF000000000000u) >> 40u) | - ((value & 0x0000FF0000000000u) >> 24u) | - ((value & 0x000000FF00000000u) >> 8u) | - ((value & 0x00000000FF000000u) << 8u) | - ((value & 0x0000000000FF0000u) << 24u) | - ((value & 0x000000000000FF00u) << 40u) | - ((value & 0x00000000000000FFu) << 56u) - ; -} - #endif - -#ifdef HAVE_HGE -static inline -uhge copy_binary_byteswap128(uhge value) { - uint64_t lo = (uint64_t) value; - uint64_t hi = (uint64_t) (value >> 64); - uhge swapped_lo = (uhge)copy_binary_byteswap64(lo); - uhge swapped_hi = (uhge)copy_binary_byteswap64(hi); - return swapped_hi | (swapped_lo << 64); -} -#endif - -// These macros are used to convert a value in-place. -// This makes it possible to also convert timestamp structs. - -static inline void -copy_binary_convert16(void *p) -{ - uint16_t *pp = (uint16_t*)p; - *pp = copy_binary_byteswap16(*pp); -} - -static inline void -copy_binary_convert32(void *p) -{ - uint32_t *pp = (uint32_t*)p; - *pp = copy_binary_byteswap32(*pp); -} - -static inline void -copy_binary_convert64(void *p) -{ - uint64_t *pp = (uint64_t*)p; - *pp = copy_binary_byteswap64(*pp); -} - -#ifdef HAVE_HGE -static inline void -copy_binary_convert128(void *p) -{ - uhge *pp = (uhge*)p; - *pp = copy_binary_byteswap128(*pp); -} -#endif - -static inline void -copy_binary_convert_date(void *p) -{ - copy_binary_date *pp = (copy_binary_date*)p; - copy_binary_convert32(&pp->year); -} - - -static inline void -copy_binary_convert_time(void *p) -{ - copy_binary_time *pp = (copy_binary_time*)p; - copy_binary_convert32(&pp->ms); -} - -static inline void -copy_binary_convert_timestamp(void *p) -{ - copy_binary_timestamp *pp = (copy_binary_timestamp*)p; - copy_binary_convert_date(&pp->date); - copy_binary_convert_time(&pp->time); -} - -#endif diff --git a/common/utils/copybinary_support.h b/common/utils/copybinary_support.h new file mode 100644 --- /dev/null +++ b/common/utils/copybinary_support.h @@ -0,0 +1,137 @@ +#ifndef COPYBINARY_SUPPORT_H +#define COPYBINARY_SUPPORT_H + +#include "copybinary.h" + +// According to Godbolt, these code sequences are recognized by +// GCC at least back to 6.2 and Clang at least back to 6.0.0. +// I didn't check earlier ones. +// They properly use byte swapping instructions. +// MSVC doesn't recognize it but that's no problem because we will +// not ever use it for big endian platforms. + +// First some macros that can be used a expressions: +// uint16_t swapped = copy_binary_byteswap16(value); + + +#ifdef _MSC_VER + +static inline uint16_t +copy_binary_byteswap16(uint16_t value) { + return _byteswap_ushort(value); +} + +static inline uint32_t +copy_binary_byteswap32(uint32_t value) { + return _byteswap_ulong(value); +} + +static inline uint64_t +copy_binary_byteswap64(uint64_t value) { + return _byteswap_uint64(value); +} + +#else + +static inline uint16_t +copy_binary_byteswap16(uint16_t value) { + return + ((value & 0xFF00u) >> 8u) | + ((value & 0x00FFu) << 8u) + ; +} + +static inline uint32_t +copy_binary_byteswap32(uint32_t value) { + return + ((value & 0xFF000000u) >> 24u) | + ((value & 0x00FF0000u) >> 8u) | + ((value & 0x0000FF00u) << 8u) | + ((value & 0x000000FFu) << 24u) + ; +} + +static inline uint64_t +copy_binary_byteswap64(uint64_t value) { + return + ((value & 0xFF00000000000000u) >> 56u) | + ((value & 0x00FF000000000000u) >> 40u) | + ((value & 0x0000FF0000000000u) >> 24u) | + ((value & 0x000000FF00000000u) >> 8u) | + ((value & 0x00000000FF000000u) << 8u) | + ((value & 0x0000000000FF0000u) << 24u) | + ((value & 0x000000000000FF00u) << 40u) | _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list