Update of /cvsroot/monetdb/pathfinder/runtime
In directory 
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28677/pathfinder/runtime

Modified Files:
        pf_support.mx vx_index.mx xrpc_common.mx 
Log Message:
Changed the implementation of the offset heap for type string.

Before, the offset heap would contain values of type var_t (typically
equal in size to oid), so if there are lots of entries but not that
many different strings, a lot of space was wasted, since only the
lower few bytes of the values in the offset heap would be used, the
rest being zero.

In this version, the offset heap has a dynamic width.  It starts off
as a single byte value, and when the offsets become too large to fit
in a single byte, the heap is upgraded to a short, then an int, and
finally (if the system uses 64 bit oids) to lng.

There are tags to mark this change: 
before_variable_string_offset and after_variable_string_offset.

Only MonetDB* and pathfinder needed to be changes, so the tags are
only added there.


Index: xrpc_common.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_common.mx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- xrpc_common.mx      22 Jul 2009 07:40:29 -0000      1.13
+++ xrpc_common.mx      4 Jan 2010 15:08:12 -0000       1.14
@@ -461,7 +461,7 @@
                         oid end_pre = hdr_node_pre + pre_sizeT[hdr_node_pre];
                         while(++hdr_node_pre <= end_pre) {
                             if (pre_kindT[hdr_node_pre] == TEXT) {
-                                s = text_base + 
(prop_textT[pre_propT[hdr_node_pre]] << GDK_VARSHIFT);
+                                s = text_base + VarHeapVal(prop_textT, 
pre_propT[hdr_node_pre], prop_text->T->width);
                                 BUNappend(participants, s, FALSE);
                             }
                         }
@@ -484,7 +484,7 @@
                         oid end_pre = hdr_node_pre + pre_sizeT[hdr_node_pre];
                         while(++hdr_node_pre <= end_pre) {
                             if (pre_kindT[hdr_node_pre] == TEXT) {
-                                s = text_base + 
(prop_textT[pre_propT[hdr_node_pre]] << GDK_VARSHIFT);
+                                s = text_base + VarHeapVal(prop_textT, 
pre_propT[hdr_node_pre], prop_text->T->width);
                                 if (isqid) {
                                     qid = GDKstrdup(s);
                                 } else {
@@ -638,7 +638,7 @@
                                 "is expected to have a simple value", 
msg+strlen(XRPC_NS)+1, i, j, k);
                         goto cleanup;
                     }
-                    req->argval[req->nr_args] = text_base + 
(prop_textT[pre_propT[val_node_pre]] << GDK_VARSHIFT);
+                    req->argval[req->nr_args] = text_base + 
VarHeapVal(prop_textT, pre_propT[val_node_pre], prop_text->T->width);
                 } else if (strcmp(pul, XRPC_NS"|attribute") == 0) {
                     while(ao_ptr < nattrs && attr_ownT[ao_ptr] < tpe_node_pre) 
ao_ptr++;
                     if (attr_ownT[ao_ptr] == tpe_node_pre) {

Index: vx_index.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/vx_index.mx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- vx_index.mx 9 Dec 2009 12:47:48 -0000       1.13
+++ vx_index.mx 4 Jan 2010 15:08:12 -0000       1.14
@@ -90,7 +90,7 @@
         var_t *src = (var_t*) Tloc(b, BUNfirst(b));
         int *dst = (int*) Tloc(bn, BUNfirst(bn));
         for(i=0; i<cnt; i++)
-            dst[i] =  XQH_H(base + (src[i]<<GDK_VARSHIFT));
+            dst[i] =  XQH_H(base + VarHeapVal(src, i, b->T->width));
 
         ALIGNsetH(bn, b);
         BATsetcount(bn, cnt);
@@ -593,12 +593,12 @@
  * to be only of kind TEXT. This is not true during updates,
  * since there might *not* be a text node (deleted).
  */
-pre_hsh[pre] = XQH_H(text_base + (pre_text[pre_prop[pre]]<<GDK_VARSHIFT));
+pre_hsh[pre] = XQH_H(text_base + VarHeapVal(pre_text, pre_prop[pre], 
text_width));
 cur++;
 
 @= found_update_string
 if (pre_kind[pre] == TEXT) {
-    pre_hsh[pre] = XQH_H(text_base + (pre_text[pre_prop[pre]]<<GDK_VARSHIFT));
+    pre_hsh[pre] = XQH_H(text_base + VarHeapVal(pre_text, pre_prop[pre], 
text_width));
     cur++;
 } else {
     /* deal with non-text nodes */
@@ -609,12 +609,12 @@
  * to be only of kind TEXT. This is not true during updates,
  * since there might *not* be a text node (deleted).
  */
-pre_state[pre] = dbl_fsm(text_base + (pre_text[pre_prop[pre]] << 
GDK_VARSHIFT));
+pre_state[pre] = dbl_fsm(text_base + VarHeapVal(pre_text, pre_prop[pre], 
text_width));
 cur++;
 
 @= found_update_dbl
 if (pre_kind[pre] == TEXT) {
-    pre_state[pre] = dbl_fsm(text_base + (pre_text[pre_prop[pre]] << 
GDK_VARSHIFT));
+    pre_state[pre] = dbl_fsm(text_base + VarHeapVal(pre_text, pre_prop[pre], 
text_width));
     cur++;
 } else {
     /* deal with non-text nodes */
@@ -754,10 +754,11 @@
         @:declerati...@1_@2()@
                                           /* DOCUMENT:                   */
         oid* pre_prop,                    /* - pre_prop column           */
-        var_t* pre_text,                  /* - fixed-size offsets of the
+        void* pre_text,                   /* - fixed-size offsets of the
                                                pre_text string column    */
         char* text_base,                  /* - base pointer of the
                                                pre_text string heap      */
+        unsigned short text_width,        /* - width of pre_text column  */
         unsigned int* pre_size,           /* - pre_size column           */
         unsigned char* pre_level,         /* - pre_level column          */
         unsigned char* pre_kind,          /* - pre_kind column           */
@@ -914,6 +915,7 @@
                     pre_prop,
                     (var_t*) Tloc(prop_text, BUNfirst(prop_text)),
                     (char*) prop_text->T->vheap->base,
+                    prop_text->T->width,
                     pre_size, pre_level, pre_kind, limit,
                     context, BATcount(ctx_bat))) {
             status = GDK_SUCCEED;
@@ -1006,6 +1008,7 @@
                 pre_prop,
                 (var_t*) Tloc(prop_text, BUNfirst(prop_text)),
                 (char*) prop_text->T->vheap->base,
+                prop_text->T->width,
                 pre_size, pre_level, pre_kind, limit,
                 context, BATcount(ctx_bat))) {
         status = GDK_SUCCEED;

Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -d -r1.340 -r1.341
--- pf_support.mx       26 Dec 2009 10:57:56 -0000      1.340
+++ pf_support.mx       4 Jan 2010 15:08:12 -0000       1.341
@@ -8266,7 +8266,7 @@
                                nbats++;
                        }
                        BUNfndVOID(r, bn[i], &o);
-                       ATOMreplace(TYPE_str, bn[i].b->theap, Tloc(bn[i].b, r), 
s);
+                       Treplacevalue(bn[i].b, Tloc(bn[i].b, r), s);
                        i++;
                        s = e ? e + seplen : NULL;
                }


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to