Changeset: ed9bf635730e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed9bf635730e
Modified Files:
        monetdb5/modules/mosaic/mosaic_delta.c
        monetdb5/modules/mosaic/mosaic_delta_templates.h
        monetdb5/modules/mosaic/mosaic_dict.c
        monetdb5/modules/mosaic/mosaic_dict256.c
        monetdb5/modules/mosaic/mosaic_dictionary.h
        monetdb5/modules/mosaic/mosaic_dictionary_templates.h
        monetdb5/modules/mosaic/mosaic_frame.c
        monetdb5/modules/mosaic/mosaic_frame_templates.h
        monetdb5/modules/mosaic/mosaic_linear.c
        monetdb5/modules/mosaic/mosaic_linear_templates.h
        monetdb5/modules/mosaic/mosaic_prefix.c
        monetdb5/modules/mosaic/mosaic_prefix_templates.h
        monetdb5/modules/mosaic/mosaic_projection_template.h
        monetdb5/modules/mosaic/mosaic_raw.c
        monetdb5/modules/mosaic/mosaic_raw_templates.h
        monetdb5/modules/mosaic/mosaic_runlength.c
        monetdb5/modules/mosaic/mosaic_runlength_templates.h
        monetdb5/modules/mosaic/mosaic_select_template.h
        monetdb5/modules/mosaic/mosaic_utility.h
Branch: mosaic
Log Message:

Transform projection macro's into template functions.


diffs (truncated from 779 to 300 lines):

diff --git a/monetdb5/modules/mosaic/mosaic_delta.c 
b/monetdb5/modules/mosaic/mosaic_delta.c
--- a/monetdb5/modules/mosaic/mosaic_delta.c
+++ b/monetdb5/modules/mosaic/mosaic_delta.c
@@ -88,56 +88,23 @@ MOSlayout_delta(MOStask* task, BAT *btec
 
 #define TPE bte
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE sht
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE int
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE lng
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #ifdef HAVE_HGE
 #define TPE hge
 #include "mosaic_select_template.h"
-#undef TPE
-#endif
-
-#define projection_loop_delta(TPE, CANDITER_NEXT)\
-{\
-       MOSBlockHeaderTpe(delta, TPE)* parameters = (MOSBlockHeaderTpe(delta, 
TPE)*) task->blk;\
-       BitVector base = (BitVector) MOScodevectorDelta(task, TPE);\
-       DeltaTpe(TPE) acc = (DeltaTpe(TPE)) parameters->init; /*previous 
value*/\
-       const bte bits = parameters->bits;\
-       DeltaTpe(TPE) sign_mask = (DeltaTpe(TPE)) ((IPTpe(TPE)) 1) << (bits - 
1);\
-    TPE v = (TPE) acc;\
-    BUN j = 0;\
-       for (oid o = canditer_peekprev(task->ci); !is_oid_nil(o) && o < last; o 
= CANDITER_NEXT(task->ci)) {\
-        BUN i = (BUN) (o - first);\
-        for (;j <= i; j++) {\
-            TPE delta = getBitVector(base, j, bits);\
-                       v = ACCUMULATE(acc, delta, sign_mask, TPE);\
-        }\
-               *bt++ = v;\
-               task->cnt++;\
-       }\
-}
-
-#define TPE bte
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE sht
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE int
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE lng
-#include "mosaic_projection_template.h"
-#undef TPE
-#ifdef HAVE_HGE
-#define TPE hge
 #include "mosaic_projection_template.h"
 #undef TPE
 #endif
diff --git a/monetdb5/modules/mosaic/mosaic_delta_templates.h 
b/monetdb5/modules/mosaic/mosaic_delta_templates.h
--- a/monetdb5/modules/mosaic/mosaic_delta_templates.h
+++ b/monetdb5/modules/mosaic/mosaic_delta_templates.h
@@ -167,3 +167,32 @@ MOSscanloop_SIGNATURE(delta, TPE, CAND_I
     task->lb = o;
 }
 #endif
+
+#ifdef PROJECTION_LOOP_DEFINITION
+MOSprojectionloop_SIGNATURE(delta, TPE, CAND_ITER)
+{
+    (void) first;
+    (void) last;
+
+       TPE* bt= (TPE*) task->src;
+
+       MOSBlockHeaderTpe(delta, TPE)* parameters = (MOSBlockHeaderTpe(delta, 
TPE)*) task->blk;
+       BitVector base = (BitVector) MOScodevectorDelta(task, TPE);
+       DeltaTpe(TPE) acc = (DeltaTpe(TPE)) parameters->init; /*previous value*/
+       const bte bits = parameters->bits;
+       DeltaTpe(TPE) sign_mask = (DeltaTpe(TPE)) ((IPTpe(TPE)) 1) << (bits - 
1);
+    TPE v = (TPE) acc;
+    BUN j = 0;
+       for (oid o = canditer_peekprev(task->ci); !is_oid_nil(o) && o < last; o 
= CAND_ITER(task->ci)) {
+        BUN i = (BUN) (o - first);
+        for (;j <= i; j++) {
+            TPE delta = getBitVector(base, j, bits);
+                       v = ACCUMULATE(acc, delta, sign_mask, TPE);
+        }
+               *bt++ = v;
+               task->cnt++;
+       }
+
+       task->src = (char*) bt;
+}
+#endif
diff --git a/monetdb5/modules/mosaic/mosaic_dict.c 
b/monetdb5/modules/mosaic/mosaic_dict.c
--- a/monetdb5/modules/mosaic/mosaic_dict.c
+++ b/monetdb5/modules/mosaic/mosaic_dict.c
@@ -121,51 +121,31 @@ MOSlayout_dict(MOStask* task, BAT *btech
 
 #define TPE bte
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE sht
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE int
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE lng
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE flt
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE dbl
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #ifdef HAVE_HGE
 #define TPE hge
 #include "mosaic_select_template.h"
-#undef TPE
-#endif
-
-#define projection_loop_dict(TPE, CI_NEXT) \
-    projection_loop_dictionary(dict, TPE, CI_NEXT)
-
-#define TPE bte
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE sht
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE int
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE lng
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE flt
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE dbl
-#include "mosaic_projection_template.h"
-#undef TPE
-#ifdef HAVE_HGE
-#define TPE hge
 #include "mosaic_projection_template.h"
 #undef TPE
 #endif
diff --git a/monetdb5/modules/mosaic/mosaic_dict256.c 
b/monetdb5/modules/mosaic/mosaic_dict256.c
--- a/monetdb5/modules/mosaic/mosaic_dict256.c
+++ b/monetdb5/modules/mosaic/mosaic_dict256.c
@@ -142,51 +142,31 @@ MOSlayout_dict256(MOStask* task, BAT *bt
 
 #define TPE bte
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE sht
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE int
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE lng
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE flt
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE dbl
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #ifdef HAVE_HGE
 #define TPE hge
 #include "mosaic_select_template.h"
-#undef TPE
-#endif
-
-#define projection_loop_dict256(TPE, CI_NEXT) \
-    projection_loop_dictionary(dict256, TPE, CI_NEXT)
-
-#define TPE bte
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE sht
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE int
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE lng
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE flt
-#include "mosaic_projection_template.h"
-#undef TPE
-#define TPE dbl
-#include "mosaic_projection_template.h"
-#undef TPE
-#ifdef HAVE_HGE
-#define TPE hge
 #include "mosaic_projection_template.h"
 #undef TPE
 #endif
diff --git a/monetdb5/modules/mosaic/mosaic_dictionary.h 
b/monetdb5/modules/mosaic/mosaic_dictionary.h
--- a/monetdb5/modules/mosaic/mosaic_dictionary.h
+++ b/monetdb5/modules/mosaic/mosaic_dictionary.h
@@ -76,19 +76,6 @@ typedef struct {\
 
 #define MOScodevectorDict(task, NAME, TPE) ((BitVector) 
&((DICTBlockHeaderTpe(NAME, TPE)*) (task)->blk)->bitvector)
 
-#define projection_loop_dictionary(NAME, TPE, CANDITER_NEXT)\
-{\
-       TPE* dict = GET_FINAL_DICT(task, NAME, TPE);\
-       BitVector base = MOScodevectorDict(task, NAME, TPE);\
-    bte bits = GET_FINAL_BITS(task, NAME);\
-       for (oid o = canditer_peekprev(task->ci); !is_oid_nil(o) && o < last; o 
= CANDITER_NEXT(task->ci)) {\
-        BUN i = (BUN) (o - first);\
-        BitVectorChunk j = getBitVector(base,i,bits); \
-               *bt++ = dict[j];\
-               task->cnt++;\
-       }\
-}
-
 #define outer_loop_dictionary(HAS_NIL, NIL_MATCHES, NAME, TPE, LEFT_CI_NEXT, 
RIGHT_CI_NEXT) \
 {\
        bte bits                = GET_FINAL_BITS(task, NAME);\
diff --git a/monetdb5/modules/mosaic/mosaic_dictionary_templates.h 
b/monetdb5/modules/mosaic/mosaic_dictionary_templates.h
--- a/monetdb5/modules/mosaic/mosaic_dictionary_templates.h
+++ b/monetdb5/modules/mosaic/mosaic_dictionary_templates.h
@@ -463,3 +463,25 @@ MOSscanloop_SIGNATURE(NAME, TPE, CAND_IT
     task->lb = o;
 }
 #endif
+
+#ifdef PROJECTION_LOOP_DEFINITION
+MOSprojectionloop_SIGNATURE(NAME, TPE, CAND_ITER)
+{
+    (void) first;
+    (void) last;
+
+       TPE* bt= (TPE*) task->src;
+
+       TPE* dict = GET_FINAL_DICT(task, NAME, TPE);
+       BitVector base = MOScodevectorDict(task, NAME, TPE);
+    bte bits = GET_FINAL_BITS(task, NAME);
+       for (oid o = canditer_peekprev(task->ci); !is_oid_nil(o) && o < last; o 
= CAND_ITER(task->ci)) {
+        BUN i = (BUN) (o - first);
+        BitVectorChunk j = getBitVector(base,i,bits); 
+               *bt++ = dict[j];
+               task->cnt++;
+       }
+
+       task->src = (char*) bt;
+}
+#endif
diff --git a/monetdb5/modules/mosaic/mosaic_frame.c 
b/monetdb5/modules/mosaic/mosaic_frame.c
--- a/monetdb5/modules/mosaic/mosaic_frame.c
+++ b/monetdb5/modules/mosaic/mosaic_frame.c
@@ -87,49 +87,23 @@ MOSlayout_frame(MOStask* task, BAT *btec
 
 #define TPE bte
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE sht
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE int
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #define TPE lng
 #include "mosaic_select_template.h"
+#include "mosaic_projection_template.h"
 #undef TPE
 #ifdef HAVE_HGE
 #define TPE hge
 #include "mosaic_select_template.h"
-#undef TPE
-#endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to