Changeset: 2f8b0dc88a84 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2f8b0dc88a84 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_atoms.h gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_hash.c gdk/gdk_hash.h gdk/gdk_private.h gdk/gdk_string.c gdk/gdk_system.h gdk/gdk_utils.c geom/monetdb5/geom.c monetdb5/mal/mal_exception.c monetdb5/mal/mal_module.c monetdb5/modules/atoms/blob.h monetdb5/modules/kernel/bat5.c monetdb5/modules/mal/remote.c monetdb5/optimizer/opt_oltp.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/UDF/capi/capi.h sql/backends/monet5/UDF/pyapi3/pyheader.h sql/server/rel_schema.c sql/server/sql_mvc.c sql/storage/store.c Branch: default Log Message:
Merge with linear-hashing branch. diffs (truncated from 1125 to 300 lines): 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 @@ -512,7 +512,6 @@ ssize_t shtFromStr(const char *src, size ssize_t shtToStr(str *dst, size_t *len, const sht *src, bool external); const sht sht_nil; ssize_t strFromStr(const char *restrict src, size_t *restrict len, str *restrict dst, bool external); -BUN strHash(const char *s); const char str_nil[2]; gdk_return void_inplace(BAT *b, oid id, const void *val, bool force) __attribute__((__warn_unused_result__)); int win_mkdir(const char *, const int mode); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -983,203 +983,6 @@ typedef var_t stridx_t; #define BATcount(b) ((b)->batCount) -/* - * @+ GDK Extensibility - * GDK can be extended with new atoms, search accelerators and storage - * modes. - * - * @- Atomic Type Descriptors - * The atomic types over which the binary associations are maintained - * are described by an atom descriptor. - * @multitable @columnfractions 0.08 0.7 - * @item void - * @tab ATOMallocate (str nme); - * @item int - * @tab ATOMindex (char *nme); - * @item int - * @tab ATOMdump (); - * @item void - * @tab ATOMdelete (int id); - * @item str - * @tab ATOMname (int id); - * @item unsigned int - * @tab ATOMsize (int id); - * @item int - * @tab ATOMvarsized (int id); - * @item ptr - * @tab ATOMnilptr (int id); - * @item ssize_t - * @tab ATOMfromstr (int id, str s, size_t* len, ptr* v_dst); - * @item ssize_t - * @tab ATOMtostr (int id, str s, size_t* len, ptr* v_dst); - * @item hash_t - * @tab ATOMhash (int id, ptr val, in mask); - * @item int - * @tab ATOMcmp (int id, ptr val_1, ptr val_2); - * @item int - * @tab ATOMfix (int id, ptr v); - * @item int - * @tab ATOMunfix (int id, ptr v); - * @item int - * @tab ATOMheap (int id, Heap *hp, size_t cap); - * @item int - * @tab ATOMput (int id, Heap *hp, BUN pos_dst, ptr val_src); - * @item int - * @tab ATOMdel (int id, Heap *hp, BUN v_src); - * @item size_t - * @tab ATOMlen (int id, ptr val); - * @item ptr - * @tab ATOMnil (int id); - * @item ssize_t - * @tab ATOMformat (int id, ptr val, char** buf); - * @item int - * @tab ATOMprint (int id, ptr val, stream *fd); - * @item ptr - * @tab ATOMdup (int id, ptr val ); - * @end multitable - * - * @- Atom Definition - * User defined atomic types can be added to a running system with the - * following interface:. - * - * @itemize - * @item @emph{ATOMallocate()} registers a new atom definition if - * there is no atom registered yet under that name. - * - * @item @emph{ATOMdelete()} unregisters an atom definition. - * - * @item @emph{ATOMindex()} looks up the atom descriptor with a certain name. - * @end itemize - * - * @- Atom Manipulation - * - * @itemize - * @item The @emph{ATOMname()} operation retrieves the name of an atom - * using its id. - * - * @item The @emph{ATOMsize()} operation returns the atoms fixed size. - * - * @item The @emph{ATOMnilptr()} operation returns a pointer to the - * nil-value of an atom. We usually take one dedicated value halfway - * down the negative extreme of the atom range (if such a concept - * fits), as the nil value. - * - * @item The @emph{ATOMnil()} operation returns a copy of the nil - * value, allocated with GDKmalloc(). - * - * @item The @emph{ATOMheap()} operation creates a new var-sized atom - * heap in 'hp' with capacity 'cap'. - * - * @item The @emph{ATOMhash()} computes a hash index for a - * value. `val' is a direct pointer to the atom value. Its return - * value should be an hash_t between 0 and 'mask'. - * - * @item The @emph{ATOMcmp()} operation compares two atomic - * values. Its parameters are pointers to atomic values. - * - * @item The @emph{ATOMlen()} operation computes the byte length for a - * value. `val' is a direct pointer to the atom value. Its return - * value should be an integer between 0 and 'mask'. - * - * @item The @emph{ATOMdel()} operation deletes a var-sized atom from - * its heap `hp'. The integer byte-index of this value in the heap is - * pointed to by `val_src'. - * - * @item The @emph{ATOMput()} operation inserts an atom `src_val' in a - * BUN at `dst_pos'. This involves copying the fixed sized part in the - * BUN. In case of a var-sized atom, this fixed sized part is an - * integer byte-index into a heap of var-sized atoms. The atom is then - * also copied into that heap `hp'. - * - * @item The @emph{ATOMfix()} and @emph{ATOMunfix()} operations do - * bookkeeping on the number of references that a GDK application - * maintains to the atom. In MonetDB, we use this to count the number - * of references directly, or through BATs that have columns of these - * atoms. The only operator for which this is currently relevant is - * BAT. The operators return the POST reference count to the - * atom. BATs with fixable atoms may not be stored persistently. - * - * @item The @emph{ATOMfromstr()} parses an atom value from string - * `s'. The memory allocation policy is the same as in - * @emph{ATOMget()}. The return value is the number of parsed - * characters or -1 on failure. Also in case of failure, the output - * parameter buf is a valid pointer or NULL. - * - * @item The @emph{ATOMprint()} prints an ASCII description of the - * atom value pointed to by `val' on file descriptor `fd'. The return - * value is the number of parsed characters. - * - * @item The @emph{ATOMformat()} is similar to @emph{ATOMprint()}. It - * prints an atom on a newly allocated string. It must later be freed - * with @strong{GDKfree}. The number of characters written is - * returned. This is minimally the size of the allocated buffer. - * - * @item The @emph{ATOMdup()} makes a copy of the given atom. The - * storage needed for this is allocated and should be removed by the - * user. - * @end itemize - * - * These wrapper functions correspond closely to the interface - * functions one has to provide for a user-defined atom. They - * basically (with exception of @emph{ATOMput()}, @emph{ATOMprint()} - * and @emph{ATOMformat()}) just have the atom id parameter prepended - * to them. - */ - -/* atomFromStr returns the number of bytes of the input string that - * were processed. atomToStr returns the length of the string - * produced. Both functions return -1 on (any kind of) failure. If - * *dst is not NULL, *len specifies the available space. If there is - * not enough space, or if *dst is NULL, *dst will be freed (if not - * NULL) and a new buffer will be allocated and returned in *dst. - * *len will be set to reflect the actual size allocated. If - * allocation fails, *dst will be NULL on return and *len is - * undefined. In any case, if the function returns, *buf is either - * NULL or a valid pointer and then *len is the size of the area *buf - * points to. */ - -typedef struct { - /* simple attributes */ - char name[IDLENGTH]; - uint8_t storage; /* stored as another type? */ - bool linear; /* atom can be ordered linearly */ - uint16_t size; /* fixed size of atom */ - - /* automatically generated fields */ - const void *atomNull; /* global nil value */ - - /* generic (fixed + varsized atom) ADT functions */ - ssize_t (*atomFromStr) (const char *src, size_t *len, void **dst, bool external); - ssize_t (*atomToStr) (char **dst, size_t *len, const void *src, bool external); - void *(*atomRead) (void *dst, stream *s, size_t cnt); - gdk_return (*atomWrite) (const void *src, stream *s, size_t cnt); - int (*atomCmp) (const void *v1, const void *v2); - BUN (*atomHash) (const void *v); - /* optional functions */ - int (*atomFix) (const void *atom); - int (*atomUnfix) (const void *atom); - - /* varsized atom-only ADT functions */ - var_t (*atomPut) (Heap *, var_t *off, const void *src); - void (*atomDel) (Heap *, var_t *atom); - size_t (*atomLen) (const void *atom); - void (*atomHeap) (Heap *, size_t); -} atomDesc; - -gdk_export atomDesc BATatoms[]; -gdk_export int GDKatomcnt; - -gdk_export int ATOMallocate(const char *nme); -gdk_export int ATOMindex(const char *nme); - -gdk_export str ATOMname(int id); -gdk_export size_t ATOMlen(int id, const void *v); -gdk_export void *ATOMnil(int id); -gdk_export int ATOMprint(int id, const void *val, stream *fd); -gdk_export char *ATOMformat(int id, const void *val); - -gdk_export void *ATOMdup(int id, const void *val); - #include "gdk_atoms.h" /* return the oid value at BUN position p from the (v)oid bat b @@ -1714,9 +1517,7 @@ gdk_export void GDKclrerr(void); * @end itemize */ /* NOTE: `p' is evaluated after a possible upgrade of the heap */ -static inline gdk_return Tputvalue(BAT *b, BUN p, const void *v, bool copyall) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) Tputvalue(BAT *b, BUN p, const void *v, bool copyall) { if (b->tvarsized && b->ttype) { @@ -1756,18 +1557,14 @@ Tputvalue(BAT *b, BUN p, const void *v, return GDK_SUCCEED; } -static inline gdk_return tfastins_nocheck(BAT *b, BUN p, const void *v, int s) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) tfastins_nocheck(BAT *b, BUN p, const void *v, int s) { b->theap.free += s; return Tputvalue(b, p, v, false); } -static inline gdk_return bunfastapp_nocheck(BAT *b, BUN p, const void *v, int ts) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) bunfastapp_nocheck(BAT *b, BUN p, const void *v, int ts) { gdk_return rc; @@ -1777,9 +1574,7 @@ bunfastapp_nocheck(BAT *b, BUN p, const return rc; } -static inline gdk_return bunfastapp(BAT *b, const void *v) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) bunfastapp(BAT *b, const void *v) { if (BATcount(b) >= BATcapacity(b)) { @@ -1805,9 +1600,7 @@ bunfastapp(BAT *b, const void *v) ((TYPE *) (b)->theap.base)[(b)->batCount++] = * (const TYPE *) (v), \ GDK_SUCCEED)) -static inline gdk_return tfastins_nocheckVAR(BAT *b, BUN p, const void *v, int s) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) tfastins_nocheckVAR(BAT *b, BUN p, const void *v, int s) { var_t d; @@ -1842,9 +1635,7 @@ tfastins_nocheckVAR(BAT *b, BUN p, const return GDK_SUCCEED; } -static inline gdk_return bunfastapp_nocheckVAR(BAT *b, BUN p, const void *v, int ts) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) bunfastapp_nocheckVAR(BAT *b, BUN p, const void *v, int ts) { gdk_return rc; @@ -1854,9 +1645,7 @@ bunfastapp_nocheckVAR(BAT *b, BUN p, con return rc; } -static inline gdk_return bunfastappVAR(BAT *b, const void *v) - __attribute__((__warn_unused_result__)); -static inline gdk_return +static inline gdk_return __attribute__((__warn_unused_result__)) bunfastappVAR(BAT *b, const void *v) { if (BATcount(b) >= BATcapacity(b)) { diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h --- a/gdk/gdk_atoms.h +++ b/gdk/gdk_atoms.h @@ -9,6 +9,69 @@ #ifndef _GDK_ATOMS_H_ #define _GDK_ATOMS_H_ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list