Update of /cvsroot/monetdb/pathfinder/compiler/debug
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20494/debug

Modified Files:
        logdebug.c physdebug.c 
Log Message:
-- Changed type bit representation of nodes and QNames.

   o Nodes are now represented by the types aat_anode (attributes)
     and aat_pnode (all other nodes) in the logical algebra.
     The type aat_node furthermore represents a mix of attributes
     and other nodes.

   o In the MIL representation aat_anode is split up into
     3 bits (aat_attr, aat_pre, and aat_frag) and aat_pnode
     is split into 3 bits (aat_pre, aat_frag, and aat_nkind).
     The last bit (aat_nkind) is only used to distinct the
     types aat_anode and aat_node (aat_anode | aat_pnode).
     In the MIL representation a type mask projects it away.

   o In the MIL representation the logical QName type aat_qname
     is represented by two bits: aat_qname_id and aat_qname_cont.

   o In the SQL representation the logical QName type aat_qname
     is represented by two bits: aat_qname_loc and aat_qname_uri.

-- Integrated new node and QName type representation in the MIL generation.

-- Completed, cleaned up, and fixed the implementation for
   a large number of operators.

-- Removed fragment information from the physical algebra.
   (MonetDB only works on a global working set anyway.)

-- Added physical primitive for count aggregates with default
   value 0 (pa_count_ext) as this maps to the MIL primitive
   '{count}(a,b)' where b represents the loop relation.

-- Replaced multiple physical path steps by a single path
   step operator (pa_llscjoin).

-- Removed atom equality functions.

-- Removed dead code (e.g., planning for a nested loop join).

-- Added a genType MIL variable that sets the serialization string.
   (Perhaps the mps magic in the embedded variant works.)

-- Added vim fold markers in milgen.brg to make the file more readable.

-- Added some comments on the MIL code generation
   (using doxygen comment style).


Index: logdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/logdebug.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- logdebug.c  6 Feb 2008 16:36:32 -0000       1.93
+++ logdebug.c  15 Feb 2008 16:53:26 -0000      1.94
@@ -307,6 +307,55 @@
 }
 
 static char *
+xml_literal_list (PFalg_simple_type_t ty)
+{
+    bool first = true;
+    PFarray_t *s = PFarray (sizeof (char));
+
+    if (ty & aat_update)
+        PFarray_printf (s, "update");
+    else if (ty & aat_docmgmt)
+        PFarray_printf (s, "docmgmt");
+    else
+        for (PFalg_simple_type_t t = 1; t; t <<= 1) {
+            if (t & ty) {
+                /* hide fragment information */
+                switch (t) {
+                    case aat_pre:
+                    case aat_frag:
+                    case aat_qname_loc:
+                        continue;
+                    default:
+                        break;
+                }
+                
+                /* start printing spaces only after the first type */
+                if (!first)
+                    PFarray_printf (s, " ");
+                else
+                    first = false;
+                
+                /* print the different types */
+                switch (t) {
+                    case aat_nat:      PFarray_printf (s, "nat");   break;
+                    case aat_int:      PFarray_printf (s, "int");   break;
+                    case aat_str:      PFarray_printf (s, "str");   break;
+                    case aat_dec:      PFarray_printf (s, "dec");   break;
+                    case aat_dbl:      PFarray_printf (s, "dbl");   break;
+                    case aat_bln:      PFarray_printf (s, "bool");  break;
+                    case aat_uA:       PFarray_printf (s, "uA");    break;
+                    case aat_qname_id: PFarray_printf (s, "qname"); break;
+                    case aat_attr:     PFarray_printf (s, "attr");  break;
+                    case aat_nkind:    PFarray_printf (s, "pnode"); break;
+                    default:                                        break;
+                }
+            }
+        }
+
+    return (char *) s->base;
+}
+
+static char *
 comp_str (PFalg_comp_t comp) {
     switch (comp) {
         case alg_comp_eq: return "eq";
@@ -1325,52 +1374,10 @@
      *   </schema>
      */
     PFarray_printf (xml, "    <schema>\n");
-    for (unsigned int i = 0; i < n->schema.count; i++) {
-        bool first = true;
-
-        PFarray_printf (xml, "      <col name=\"%s\" types=\"",
-                        PFatt_str (n->schema.items[i].name));
-        
-        if (n->schema.items[i].type & aat_update)
-            PFarray_printf (xml, "update");
-        else if (n->schema.items[i].type & aat_docmgmt)
-            PFarray_printf (xml, "docmgmt");
-        else
-            for (PFalg_simple_type_t t = 1; t; t <<= 1) {
-                if (t & n->schema.items[i].type) {
-                    /* hide fragment information */
-                    switch (t) {
-                        case aat_afrag:
-                        case aat_pfrag:
-                            continue;
-                        default:
-                            break;
-                    }
-                    
-                    /* start printing spaces only after the first type */
-                    if (!first)
-                        PFarray_printf (xml, " ");
-                    else
-                        first = false;
-                    
-                    /* print the different types */
-                    switch (t) {
-                        case aat_nat:    PFarray_printf (xml, "nat");   break;
-                        case aat_int:    PFarray_printf (xml, "int");   break;
-                        case aat_str:    PFarray_printf (xml, "str");   break;
-                        case aat_dec:    PFarray_printf (xml, "dec");   break;
-                        case aat_dbl:    PFarray_printf (xml, "dbl");   break;
-                        case aat_bln:    PFarray_printf (xml, "bln");   break;
-                        case aat_qname:  PFarray_printf (xml, "qname"); break;
-                        case aat_uA:     PFarray_printf (xml, "uA");    break;
-                        case aat_attr:   PFarray_printf (xml, "attr");  break;
-                        case aat_pre:    PFarray_printf (xml, "node");  break;
-                        default:                                        break;
-                    }
-                }
-            }
-        PFarray_printf (xml, "\"/>\n");
-    }
+    for (unsigned int i = 0; i < n->schema.count; i++)
+        PFarray_printf (xml, "      <col name=\"%s\" types=\"%s\"/>\n",
+                        PFatt_str (n->schema.items[i].name),
+                        xml_literal_list (n->schema.items[i].type));
     PFarray_printf (xml, "    </schema>\n");
 
     if (PFstate.format) {
@@ -1536,53 +1543,12 @@
             PFarray_printf (xml, "    <content>\n"); 
 
             /* list the attributes of this table */
-            for (unsigned int i = 0; i < n->schema.count; i++) {
-                bool first = true;
-
-                PFarray_printf (xml, "      <column name=\"%s\" type=\"",
-                                PFatt_str (n->schema.items[i].name));
-
-                if (n->schema.items[i].type & aat_update)
-                    PFarray_printf (xml, "update");
-                else
-                    for (PFalg_simple_type_t t = 1; t; t <<= 1) {
-                        if (t & n->schema.items[i].type) {
-                            /* hide fragment information */
-                            switch (t) {
-                                case aat_afrag:
-                                case aat_pfrag:
-                                    continue;
-                                default:
-                                    break;
-                            }
-
-                            /* start printing spaces only after the first type 
*/
-                            if (!first)
-                                PFarray_printf (xml, " ");
-                            else
-                                first = false;
-
-                            /* print the different types */
-                            switch (t) {
-                                case aat_nat:    PFarray_printf (xml, "nat");  
 break;
-                                case aat_int:    PFarray_printf (xml, "int");  
 break;
-                                case aat_str:    PFarray_printf (xml, "str");  
 break;
-                                case aat_dec:    PFarray_printf (xml, "dec");  
 break;
-                                case aat_dbl:    PFarray_printf (xml, "dbl");  
 break;
-                                case aat_bln:    PFarray_printf (xml, "bln");  
 break;
-                                case aat_qname:  PFarray_printf (xml, 
"qname"); break;
-                                case aat_uA:     PFarray_printf (xml, "uA");   
 break;
-                                case aat_attr:   PFarray_printf (xml, "attr"); 
 break;
-                                case aat_pre:    PFarray_printf (xml, "node"); 
 break;
-                                default:                                       
 break;
-                            }
-                        }
-                    }
-                PFarray_printf (xml, "\" new=\"true\"/>\n");
-            }
-
-             
-
+            for (unsigned int i = 0; i < n->schema.count; i++)
+                PFarray_printf (xml,
+                                "      <column name=\"%s\" type=\"%s\""
+                                             " new=\"true\"/>\n",
+                                PFatt_str (n->schema.items[i].name),
+                                xml_literal_list (n->schema.items[i].type));
 
             PFarray_printf (xml, "    </content>\n");
             break;

Index: physdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/physdebug.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- physdebug.c 6 Feb 2008 16:09:15 -0000       1.54
+++ physdebug.c 15 Feb 2008 16:53:26 -0000      1.55
@@ -75,37 +75,24 @@
     , [pa_refine_sort]     = "refine_sort"
     , [pa_fun_1to1]        = "1:1 fun"
     , [pa_eq]              = "="
-    , [pa_eq_atom]         = "= (atom)"
     , [pa_gt]              = ">"
-    , [pa_gt_atom]         = "> (atom)"
     , [pa_bool_and]        = "AND"
     , [pa_bool_or]         = "OR"
     , [pa_bool_not]        = "NOT"
-    , [pa_bool_and_atom]   = "AND (atom)"
-    , [pa_bool_or_atom]    = "OR (atom)"
     , [pa_to]              = "op:to"
     , [pa_avg]             = "AVG"
     , [pa_min]             = "MAX"
     , [pa_max]             = "MIN"
     , [pa_sum]             = "SUM"
-    , [pa_hash_count]      = "HASH_COUNT"
+    , [pa_count_ext]       = "{COUNT}"
+    , [pa_count]           = "COUNT"
     , [pa_mark]            = "mark"
     , [pa_rank]            = "rank"
     , [pa_mark_grp]        = "mark_grp"
     , [pa_type]            = "TYPE"
     , [pa_type_assert]     = "type assertion"
     , [pa_cast]            = "CAST"
-    , [pa_llscj_anc]       = "//| ancestor"
-    , [pa_llscj_anc_self]  = "//| anc-self"
-    , [pa_llscj_attr]      = "//| attr"
-    , [pa_llscj_child]     = "//| child"
-    , [pa_llscj_desc]      = "//| descendant"
-    , [pa_llscj_desc_self] = "//| desc-self"
-    , [pa_llscj_foll]      = "//| following"
-    , [pa_llscj_foll_sibl] = "//| foll-sibl"
-    , [pa_llscj_parent]    = "//| parent"
-    , [pa_llscj_prec]      = "//| preceding"
-    , [pa_llscj_prec_sibl] = "//| prec-sibl"
+    , [pa_llscjoin]        = "//| "
     , [pa_doc_tbl]         = "DOC"
     , [pa_doc_access]      = "access"
     , [pa_twig]            = "TWIG"             /* lawn \"#00FF00\" */
@@ -117,12 +104,8 @@
     , [pa_comment]         = "COMMENT"          /* lawn \"#00FF00\" */
     , [pa_processi]        = "PI"               /* lawn \"#00FF00\" */
     , [pa_content]         = "CONTENT"          /* lawn \"#00FF00\" */
+    , [pa_slim_content]    = "content"          /* lawn \"#00FF00\" */
     , [pa_merge_adjacent]  = "#pf:merge-adjacent-text-nodes"
-    , [pa_roots]           = "ROOTS"
-    , [pa_fragment]        = "FRAGs"
-    , [pa_frag_extract]    = "FRAG EXTRACT"
-    , [pa_frag_union]      = "FRAG_UNION"
-    , [pa_empty_frag]      = "EMPTY_FRAG"
     , [pa_error]           = "!ERROR"
     , [pa_cond_err]        = "!ERROR"
     , [pa_nil]             = "nil"
@@ -136,7 +119,6 @@
     , [pa_rec_border]      = "rec border"
     , [pa_fun_call]        = "fun call"
     , [pa_fun_param]       = "fun param"
-    , [pa_fun_frag_param]  = "fun frag param"
     , [pa_string_join]     = "fn:string-join"
 };
 
@@ -234,37 +216,24 @@
         , [pa_refine_sort]     = "red"
         , [pa_fun_1to1]        = "\"#C0C0C0\""
         , [pa_eq]              = "\"#00DDDD\""
-        , [pa_eq_atom]         = "\"#00DDDD\""
         , [pa_gt]              = "\"#00DDDD\""
-        , [pa_gt_atom]         = "\"#00DDDD\""
         , [pa_bool_not]        = "\"#C0C0C0\""
         , [pa_bool_and]        = "\"#C0C0C0\""
         , [pa_bool_or]         = "\"#C0C0C0\""
-        , [pa_bool_and_atom]   = "\"#C0C0C0\""
-        , [pa_bool_or_atom]    = "\"#C0C0C0\""
         , [pa_to]              = "\"#C0C0C0\""
         , [pa_avg]             = "\"#A0A0A0\""
         , [pa_max]             = "\"#A0A0A0\""
         , [pa_min]             = "\"#A0A0A0\""
         , [pa_sum]             = "\"#A0A0A0\""
-        , [pa_hash_count]      = "\"#A0A0A0\""
+        , [pa_count_ext]       = "\"#A0A0A0\""
+        , [pa_count]           = "\"#A0A0A0\""
         , [pa_mark]            = "\"#FFBBBB\""
         , [pa_rank]            = "\"#FFBBBB\""
         , [pa_mark_grp]        = "\"#FFBBBB\""
         , [pa_type]            = "\"#C0C0C0\""
         , [pa_type_assert]     = "\"#C0C0C0\""
         , [pa_cast]            = "\"#C0C0C0\""
-        , [pa_llscj_anc]       = "\"#1E90FF\""
-        , [pa_llscj_anc_self]  = "\"#1E90FF\""
-        , [pa_llscj_attr]      = "\"#1E90FF\""
-        , [pa_llscj_child]     = "\"#1E90FF\""
-        , [pa_llscj_desc]      = "\"#1E90FF\""
-        , [pa_llscj_desc_self] = "\"#1E90FF\""
-        , [pa_llscj_foll]      = "\"#1E90FF\""
-        , [pa_llscj_foll_sibl] = "\"#1E90FF\""
-        , [pa_llscj_parent]    = "\"#1E90FF\""
-        , [pa_llscj_prec]      = "\"#1E90FF\""
-        , [pa_llscj_prec_sibl] = "\"#1E90FF\""
+        , [pa_llscjoin]        = "\"#1E90FF\""
         , [pa_doc_tbl]         = "\"#C0C0C0\""
         , [pa_doc_access]      = "\"#CCCCFF\""
         , [pa_twig]            = "\"#00FC59\""
@@ -277,11 +246,6 @@
         , [pa_processi]        = "\"#00FC59\""
         , [pa_content]         = "\"#00FC59\""
         , [pa_merge_adjacent]  = "\"#00D000\""
-        , [pa_roots]           = "\"#E0E0E0\""
-        , [pa_fragment]        = "\"#E0E0E0\""
-        , [pa_frag_extract]    = "\"#DD22DD\""
-        , [pa_frag_union]      = "\"#E0E0E0\""
-        , [pa_empty_frag]      = "\"#E0E0E0\""
         , [pa_error]           = "\"#C0C0C0\""
         , [pa_cond_err]        = "\"#C0C0C0\""
         , [pa_nil]             = "\"#FFFFFF\""
@@ -295,7 +259,6 @@
         , [pa_rec_border]      = "\"#BB00BB\""
         , [pa_fun_call]        = "\"#BB00BB\""
         , [pa_fun_param]       = "\"#BB00BB\""
-        , [pa_fun_frag_param]  = "\"#BB00BB\""
         , [pa_string_join]     = "\"#C0C0C0\""
     };
 
@@ -462,23 +425,14 @@
                             PFatt_str (n->sem.binary.att2));
             break;
 
-        case pa_eq_atom:
-        case pa_gt_atom:
-        case pa_bool_and_atom:
-        case pa_bool_or_atom:
-            PFarray_printf (dot, "%s (%s:<%s, %s>)", a_id[n->kind],
-                            PFatt_str (n->sem.bin_atom.res),
-                            PFatt_str (n->sem.bin_atom.att1),
-                            literal (n->sem.bin_atom.att2));
-            break;
-
         case pa_bool_not:
             PFarray_printf (dot, "%s (%s:<%s>)", a_id[n->kind],
                             PFatt_str (n->sem.unary.res),
                             PFatt_str (n->sem.unary.att));
             break;
 
-        case pa_hash_count:
+        case pa_count_ext:
+        case pa_count:
             if (n->sem.count.part == att_NULL)
                 PFarray_printf (dot, "%s (%s)", a_id[n->kind],
                                 PFatt_str (n->sem.count.res));
@@ -486,6 +440,9 @@
                 PFarray_printf (dot, "%s (%s:/%s)", a_id[n->kind],
                                 PFatt_str (n->sem.count.res),
                                 PFatt_str (n->sem.count.part));
+            if (n->sem.count.loop != att_NULL)
+                PFarray_printf (dot, " (%s)",
+                                PFatt_str (n->sem.count.loop));
             break;
 
         case pa_avg:
@@ -541,19 +498,50 @@
                             PFalg_simple_type_str (n->sem.cast.ty));
             break;
 
-        case pa_llscj_anc:
-        case pa_llscj_anc_self:
-        case pa_llscj_attr:
-        case pa_llscj_child:
-        case pa_llscj_desc:
-        case pa_llscj_desc_self:
-        case pa_llscj_foll:
-        case pa_llscj_foll_sibl:
-        case pa_llscj_parent:
-        case pa_llscj_prec:
-        case pa_llscj_prec_sibl:
+        case pa_llscjoin:
             PFarray_printf (dot, "%s", a_id[n->kind]);
-            PFarray_printf (dot, "::%s", PFty_str (n->sem.scjoin.ty));
+            switch (n->sem.scjoin.axis)
+            {
+                case alg_anc:
+                    PFarray_printf (dot, "ancestor::");
+                    break;
+                case alg_anc_s:
+                    PFarray_printf (dot, "anc-or-self::");
+                    break;
+                case alg_attr:
+                    PFarray_printf (dot, "attribute::");
+                    break;
+                case alg_chld:
+                    PFarray_printf (dot, "child::");
+                    break;
+                case alg_desc:
+                    PFarray_printf (dot, "descendant::");
+                    break;
+                case alg_desc_s:
+                    PFarray_printf (dot, "desc-or-self::");
+                    break;
+                case alg_fol:
+                    PFarray_printf (dot, "following::");
+                    break;
+                case alg_fol_s:
+                    PFarray_printf (dot, "fol-sibling::");
+                    break;
+                case alg_par:
+                    PFarray_printf (dot, "parent::");
+                    break;
+                case alg_prec:
+                    PFarray_printf (dot, "preceding::");
+                    break;
+                case alg_prec_s:
+                    PFarray_printf (dot, "prec-sibling::");
+                    break;
+                case alg_self:
+                    PFarray_printf (dot, "self::");
+                    break;
+                default: PFoops (OOPS_FATAL,
+                        "unknown XPath axis in dot output");
+            }
+            PFarray_printf (dot, "%s", PFty_str (n->sem.scjoin.ty));
             break;
 
         case pa_doc_access:
@@ -587,6 +575,7 @@
         case pa_textnode:
         case pa_comment:
         case pa_content:
+        case pa_slim_content:
         case pa_trace:
         case pa_trace_msg:
             PFarray_printf (dot, "%s (%s, %s)",
@@ -650,12 +639,6 @@
             PFarray_printf (dot, ")");
             break;
             
-        case pa_frag_extract:
-        case pa_fun_frag_param:
-            PFarray_printf (dot, "%s (referencing column %i)",
-                            a_id[n->kind], n->sem.col_ref.pos);
-            break;
-            
         case pa_serialize:
         case pa_cross:
         case pa_append_union:
@@ -664,10 +647,6 @@
         case pa_doc_tbl:
         case pa_fcns:
         case pa_merge_adjacent:
-        case pa_roots:
-        case pa_fragment:
-        case pa_frag_union:
-        case pa_empty_frag:
         case pa_nil:
         case pa_rec_fix:
         case pa_rec_param:


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to