Update of /cvsroot/monetdb/pathfinder/compiler/include
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26921/include
Modified Files:
physical.h physical_mnemonic.h
Log Message:
-- Implemented generic function application facility (for the physical algebra).
Generic functions can now be implemented in the physical algebra using
the 4 operators pa_fun_call, pa_fun_param, pa_fun_frag_param, and
pa_frag_extract. Their semantics is identical to the logical operators
(see yesterdays checkin message).
-- Added special case for XRPC function calls whose arguments are now
always sorted by iter, post.
NOTE: The output order of XRPC function calls is not defined yet.
If XRPC functions return the results always in a defined order
the fun_call constructor in physical.c has to be adjusted accordingly.
-- Added function call stub in milgen.brg.
The implementation of function calls only has to replace the dummy action
code
(variable assignments to nil) AND has to enrich the variable environment
correctly
(instead of adding dummy variables to it).
NOTE: The variable environments of the function arguments do not necessarily
provide all references to BATs that are required by the function
signature.
The compilation fills only the BATs for the existing types. This can
happen
if the function expects an argument of type item* and the function
argument
consists of strings only. The function definition (e.g., the XRPC
receiver)
then has to cope with all non-existing BATs.
The function application operator furthermore needs to fill the
environment
for all possible result types. All result BATs therefore have to exist
(even if they only contains nil values). If the function specifies its
return type to be item* and the function returns only strings then
additional
BATs for integer, double, decimal, untypedAtomic, ... filled with nil
values
are also needed.
Index: physical_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical_mnemonic.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- physical_mnemonic.h 11 Dec 2007 14:25:55 -0000 1.25
+++ physical_mnemonic.h 14 Dec 2007 12:02:35 -0000 1.26
@@ -172,6 +172,7 @@
#define roots(a) PFpa_roots (a)
#define fragment(a) PFpa_fragment (a)
+#define frag_extract(a,b) PFpa_frag_extract ((a),(b))
#define frag_union(a,b) PFpa_frag_union ((a), (b))
/** empty fragment list */
@@ -191,6 +192,12 @@
#define rec_base(a,b) PFpa_rec_base ((a),(b))
#define rec_border(a) PFpa_rec_border (a)
+/* function application */
+#define fun_call(a,b,c,d,e,f,g,h) \
+ PFpa_fun_call ((a),(b),(c),(d),(e),(f),(g),(h))
+#define fun_param(a,b,c) PFpa_fun_param ((a),(b),(c))
+#define fun_frag_param(a,b,c) PFpa_fun_frag_param ((a),(b),(c))
+
#define fn_concat(a,b,c,d) PFpa_fn_concat ((a), (b), (c), (d))
#define fn_contains(a,b,c,d) PFpa_fn_contains ((a), (b), (c), (d))
#define string_join(a,b,c,d) PFpa_string_join ((a),(b),(c),(d))
Index: physical.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- physical.h 11 Dec 2007 14:25:55 -0000 1.33
+++ physical.h 14 Dec 2007 12:02:35 -0000 1.34
@@ -125,8 +125,9 @@
, pa_merge_adjacent = 131
, pa_roots = 132
, pa_fragment = 133
- , pa_frag_union = 134
- , pa_empty_frag = 135
+ , pa_frag_extract = 134
+ , pa_frag_union = 135
+ , pa_empty_frag = 136
, pa_error = 139 /**< error operator */
, pa_cond_err = 140 /**< conditional error operator */
, pa_nil = 141 /**< end of the list of parameters */
@@ -139,7 +140,10 @@
in the recursion */
, pa_rec_base = 148 /**< base of the DAG describing the recursion */
, pa_rec_border = 149 /**< border of the DAG describing the recursion
*/
- , pa_string_join = 150 /**< Concatenation of multiple strings */
+ , pa_fun_call = 150 /**< function application */
+ , pa_fun_param = 151 /**< function application parameter */
+ , pa_fun_frag_param = 152 /**< function application parameter */
+ , pa_string_join = 160 /**< Concatenation of multiple strings */
};
/** algebra operator kinds */
typedef enum PFpa_op_kind_t PFpa_op_kind_t;
@@ -357,6 +361,23 @@
of the recursion */
} rec_arg;
+ struct {
+ PFalg_fun_call_t kind; /**< kind of function call */
+ PFqname_t qname; /**< function name */
+ void *ctx; /**< reference to the context node
+ representing the function call */
+ PFalg_att_t iter; /**< the loop relation */
+ PFalg_occ_ind_t occ_ind; /**< occurrence indicator for the
+ iter column of the result
+ (used for optimizations) */
+ } fun_call;
+
+ /* semantic content of the function call fragment paramter and
+ the fragment extraction operator */
+ struct {
+ unsigned int pos; /**< position of the referenced column */
+ } col_ref;
+
};
/** semantic content in physical algebra operators */
typedef union PFpa_op_sem_t PFpa_op_sem_t;
@@ -830,6 +851,12 @@
PFpa_op_t *PFpa_fragment (const PFpa_op_t *n);
/**
+ * Constructor for a fragment extract operator
+ * (to be used in combination with a function call)
+ */
+PFpa_op_t * PFpa_frag_extract (const PFpa_op_t *n, unsigned int col_pos);
+
+/**
* Form disjoint union between two fragments.
*/
PFpa_op_t *PFpa_frag_union (const PFpa_op_t *n1, const PFpa_op_t *n2);
@@ -918,6 +945,34 @@
*/
PFpa_op_t *PFpa_rec_border (const PFpa_op_t *n);
+/**
+ * Constructor for the function application
+ */
+PFpa_op_t *PFpa_fun_call (const PFpa_op_t *loop,
+ const PFpa_op_t *param_list,
+ PFalg_schema_t schema,
+ PFalg_fun_call_t kind,
+ PFqname_t qname,
+ void *ctx,
+ PFalg_att_t iter,
+ PFalg_occ_ind_t occ_ind);
+
+/**
+ * Constructor for a list item of a parameter list
+ * related to function application
+ */
+PFpa_op_t *PFpa_fun_param (const PFpa_op_t *argument,
+ const PFpa_op_t *param_list,
+ PFalg_schema_t schema);
+
+/**
+ * Constructor for the fragment information of a list item
+ * of a parameter list related to function application
+ */
+PFpa_op_t *PFpa_fun_frag_param (const PFpa_op_t *argument,
+ const PFpa_op_t *param_list,
+ unsigned int col_pos);
+
/****************************************************************/
/* operators introduced by built-in functions */
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins