Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10995
Merged at revision: 11140
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 2346 lines (+502/-655)
40 files modified
ChangeLog (+4/-1)
src/compiler/api/compiler_api.cpp (+28/-9)
src/compiler/api/compilercb.cpp (+3/-0)
src/compiler/api/compilercb.h (+26/-11)
src/compiler/expression/expr_base.cpp (+39/-36)
src/compiler/expression/expr_base.h (+26/-11)
src/compiler/expression/expr_clone.cpp (+1/-1)
src/compiler/expression/expr_iter.cpp (+2/-2)
src/compiler/expression/expr_put.cpp (+2/-2)
src/compiler/expression/expr_type.cpp (+36/-3)
src/compiler/expression/script_exprs.cpp (+15/-17)
src/compiler/expression/script_exprs.h (+48/-53)
src/compiler/expression/var_expr.cpp (+15/-2)
src/compiler/expression/var_expr.h (+11/-7)
src/compiler/rewriter/rules/hoist_rules.cpp (+2/-2)
src/compiler/rewriter/rules/index_join_rule.cpp (+3/-2)
src/compiler/rewriter/rules/nodeid_rules.cpp (+3/-15)
src/compiler/rewriter/rules/type_rules.cpp (+58/-88)
src/compiler/rewriter/tools/dataflow_annotations.cpp (+9/-33)
test/parser/CMakeLists.txt (+3/-3)
test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_dynamic_zorba_collection.iter (+2/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_static_zorba_collection.iter (+2/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_w3c_collection.iter (+2/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx1.iter (+14/-18)
test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx2.iter (+14/-18)
test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter (+29/-83)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter (+5/-25)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter (+5/-25)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx1.iter (+14/-18)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-01.iter (+3/-7)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-02.iter (+6/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-03.iter (+6/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/positioned-access.iter (+2/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_inline_01.iter (+13/-28)
test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf1.iter (+1/-5)
test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q10.iter (+7/-11)
test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q4.iter (+28/-31)
test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q9.iter (+10/-14)
test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter (+3/-12)
test/rbkt/Queries/zorba/windowing/q4.xq (+2/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+138556@code.launchpad.net

Commit message

1. Better computation of the static type for global variables
2. Optimization of comparison operators when untypedAtomic items are involved.

Description of the change

1. Better computation of the static type for global variables
2. Optimization of comparison operators when untypedAtomic items are involved.

To post a comment you must log in.
10995. By Markos Zaharioudakis

1. Better computation of the static type for global variables, 2. Optimization of comparison operators when untypedAtomic items are involved

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2012-12-06T22-59-53.623Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2012-11-29 19:17:08 +0000
+++ ChangeLog 2012-12-06 22:51:20 +0000
@@ -12,6 +12,8 @@
1212
13Optimizations:13Optimizations:
14 * Various optimizations in the implementation of the optimizer rules.14 * Various optimizations in the implementation of the optimizer rules.
15 * Better computation of the static type for global variables.
16 * Optimization of comparison operators when untypedAtomic items are involved.
1517
16Bug Fixes/Other Changes:18Bug Fixes/Other Changes:
17 * Change XQXQ (XQuery-for-XQuery) module now part of Zorba core19 * Change XQXQ (XQuery-for-XQuery) module now part of Zorba core
@@ -28,9 +30,10 @@
28 * Fixed bug #1065321 (following:text() doesn't return results in doc order)30 * Fixed bug #1065321 (following:text() doesn't return results in doc order)
29 * Fixed bug #1067706 (wrong const folding in mutually recursive udfs)31 * Fixed bug #1067706 (wrong const folding in mutually recursive udfs)
30 * Fixed bug #1021492 (while computeing the "sources" of a prolog var, skip32 * Fixed bug #1021492 (while computeing the "sources" of a prolog var, skip
31 any var-setting exprs that appear in non-used (and non-optimized) functions). 33 any var-setting exprs that appear in non-used (and non-optimized) functions).
32 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)34 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)
3335
36
34version 2.737version 2.7
3538
36New Features:39New Features:
3740
=== modified file 'src/compiler/api/compiler_api.cpp'
--- src/compiler/api/compiler_api.cpp 2012-10-08 12:09:36 +0000
+++ src/compiler/api/compiler_api.cpp 2012-12-06 22:51:20 +0000
@@ -138,10 +138,10 @@
138#ifdef ZORBA_XQUERYX138#ifdef ZORBA_XQUERYX
139 char* converted_xquery_str = NULL;139 char* converted_xquery_str = NULL;
140 std::string xquery_str;140 std::string xquery_str;
141 bool is_xqueryx = false;141 bool is_xqueryx = false;
142
142 {143 {
143 char strtemp[1000];144 char strtemp[1000];
144 //int nr_read = 1;
145 do145 do
146 {146 {
147 strtemp[0] = 0;147 strtemp[0] = 0;
@@ -175,26 +175,30 @@
175 {175 {
176 xquery_stream = new std::istringstream(xquery_str);176 xquery_stream = new std::istringstream(xquery_str);
177 }177 }
178#endif178#endif // ZORBA_XQUERYX
179
180 theCompilerCB->setPhase(CompilerCB::PARSING);
179181
180 xquery_driver lDriver(&*theCompilerCB);182 xquery_driver lDriver(&*theCompilerCB);
181 lDriver.parse_stream(*xquery_stream, aFileName);183 lDriver.parse_stream(*xquery_stream, aFileName);
182184
185 theCompilerCB->setPhase(CompilerCB::NONE);
186
183#ifdef ZORBA_XQUERYX187#ifdef ZORBA_XQUERYX
184 delete xquery_stream;188 delete xquery_stream;
185 if(is_xqueryx)189 if (is_xqueryx)
186 {190 {
187 xqxconvertor->freeResult(converted_xquery_str);191 xqxconvertor->freeResult(converted_xquery_str);
188 }192 }
189#endif193#endif
194
190 parsenode_t node = lDriver.get_expr();195 parsenode_t node = lDriver.get_expr();
191196
192 if (typeid (*node) == typeid (ParseErrorNode))197 if (typeid (*node) == typeid (ParseErrorNode))
193 {198 {
194 ParseErrorNode* pen = static_cast<ParseErrorNode *>(&*node);199 ParseErrorNode* pen = static_cast<ParseErrorNode *>(&*node);
195 throw XQUERY_EXCEPTION_VAR(200 throw XQUERY_EXCEPTION_VAR(pen->err,
196 pen->err, ERROR_PARAMS(pen->msg), ERROR_LOC(pen->get_location())201 ERROR_PARAMS(pen->msg), ERROR_LOC(pen->get_location()));
197 );
198 }202 }
199203
200 return node;204 return node;
@@ -285,7 +289,11 @@
285 audit::XQUERY_COMPILATION_CODEGENERATION_DURATION,289 audit::XQUERY_COMPILATION_CODEGENERATION_DURATION,
286 lTimer);290 lTimer);
287291
292 theCompilerCB->setPhase(CompilerCB::CODEGEN);
293
288 plan = codegen("main query", rootExpr, theCompilerCB, nextDynamicVarId);294 plan = codegen("main query", rootExpr, theCompilerCB, nextDynamicVarId);
295
296 theCompilerCB->setPhase(CompilerCB::NONE);
289 }297 }
290298
291 //theCompilerCB->getExprManager()->garbageCollect();299 //theCompilerCB->getExprManager()->garbageCollect();
@@ -306,8 +314,12 @@
306 time::get_current_walltime(startTime);314 time::get_current_walltime(startTime);
307#endif315#endif
308316
317 theCompilerCB->setPhase(CompilerCB::TRANSLATION);
318
309 expr* lExpr = translate(*aParsenode, theCompilerCB);319 expr* lExpr = translate(*aParsenode, theCompilerCB);
310320
321 theCompilerCB->setPhase(CompilerCB::NONE);
322
311#if 0323#if 0
312 std::cout << "Num exprs after translation = "324 std::cout << "Num exprs after translation = "
313 << theCompilerCB->getExprManager()->numExprs()325 << theCompilerCB->getExprManager()->numExprs()
@@ -321,7 +333,7 @@
321 if ( lExpr == NULL )333 if ( lExpr == NULL )
322 {334 {
323 // TODO: can this happen?335 // TODO: can this happen?
324 throw ZORBA_EXCEPTION( zerr::ZAPI0002_XQUERY_COMPILATION_FAILED );336 throw ZORBA_EXCEPTION(zerr::ZAPI0002_XQUERY_COMPILATION_FAILED);
325 }337 }
326338
327 return lExpr;339 return lExpr;
@@ -333,6 +345,8 @@
333********************************************************************************/345********************************************************************************/
334expr* XQueryCompiler::optimize(expr* lExpr)346expr* XQueryCompiler::optimize(expr* lExpr)
335{347{
348 theCompilerCB->setPhase(CompilerCB::OPTIMIZATION);
349
336 // Build the call-graph among the udfs that are actually used in the query350 // Build the call-graph among the udfs that are actually used in the query
337 // program.351 // program.
338 UDFGraph udfGraph(lExpr);352 UDFGraph udfGraph(lExpr);
@@ -343,7 +357,10 @@
343 udfGraph.inferDeterminism();357 udfGraph.inferDeterminism();
344358
345 if (theCompilerCB->theConfig.opt_level <= CompilerCB::config::O0)359 if (theCompilerCB->theConfig.opt_level <= CompilerCB::config::O0)
360 {
361 theCompilerCB->setPhase(CompilerCB::NONE);
346 return lExpr;362 return lExpr;
363 }
347364
348 // Optimize the udfs.365 // Optimize the udfs.
349 udfGraph.optimizeUDFs(theCompilerCB);366 udfGraph.optimizeUDFs(theCompilerCB);
@@ -362,6 +379,8 @@
362 if ( theCompilerCB->theConfig.optimize_cb != NULL )379 if ( theCompilerCB->theConfig.optimize_cb != NULL )
363 theCompilerCB->theConfig.optimize_cb(lExpr, "main query");380 theCompilerCB->theConfig.optimize_cb(lExpr, "main query");
364381
382 theCompilerCB->setPhase(CompilerCB::NONE);
383
365 return lExpr;384 return lExpr;
366}385}
367386
368387
=== modified file 'src/compiler/api/compilercb.cpp'
--- src/compiler/api/compilercb.cpp 2012-10-24 11:32:56 +0000
+++ src/compiler/api/compilercb.cpp 2012-12-06 22:51:20 +0000
@@ -113,6 +113,7 @@
113#ifdef ZORBA_WITH_DEBUGGER113#ifdef ZORBA_WITH_DEBUGGER
114 theDebuggerCommons(0),114 theDebuggerCommons(0),
115#endif115#endif
116 thePhase(NONE),
116 theHasEval(false),117 theHasEval(false),
117 theIsEval(false),118 theIsEval(false),
118 theIsLoadProlog(false),119 theIsLoadProlog(false),
@@ -141,6 +142,7 @@
141#ifdef ZORBA_WITH_DEBUGGER142#ifdef ZORBA_WITH_DEBUGGER
142 theDebuggerCommons(cb.theDebuggerCommons),143 theDebuggerCommons(cb.theDebuggerCommons),
143#endif144#endif
145 thePhase(NONE),
144 theHasEval(false),146 theHasEval(false),
145 theIsEval(false),147 theIsEval(false),
146 theIsLoadProlog(false),148 theIsLoadProlog(false),
@@ -167,6 +169,7 @@
167#ifdef ZORBA_WITH_DEBUGGER169#ifdef ZORBA_WITH_DEBUGGER
168 theDebuggerCommons(NULL),170 theDebuggerCommons(NULL),
169#endif171#endif
172 thePhase(RUNTIME),
170 theHasEval(false),173 theHasEval(false),
171 theIsEval(false),174 theIsEval(false),
172 theNextVisitId(1),175 theNextVisitId(1),
173176
=== modified file 'src/compiler/api/compilercb.h'
--- src/compiler/api/compilercb.h 2012-10-24 11:32:56 +0000
+++ src/compiler/api/compilercb.h 2012-12-06 22:51:20 +0000
@@ -132,7 +132,7 @@
132 Pointer to the function to call to print the expr tree that results from132 Pointer to the function to call to print the expr tree that results from
133 translating the query AST.133 translating the query AST.
134********************************************************************************/134********************************************************************************/
135class ZORBA_DLL_PUBLIC CompilerCB : public zorba::serialization::SerializeBaseClass135class CompilerCB : public zorba::serialization::SerializeBaseClass
136{136{
137public:137public:
138 struct config : public zorba::serialization::SerializeBaseClass138 struct config : public zorba::serialization::SerializeBaseClass
@@ -168,8 +168,22 @@
168 void serialize(::zorba::serialization::Archiver& ar);168 void serialize(::zorba::serialization::Archiver& ar);
169 };169 };
170170
171 typedef enum
172 {
173 NONE,
174 PARSING,
175 TRANSLATION,
176 OPTIMIZATION,
177 CODEGEN,
178 RUNTIME
179 } ProcessingPhase;
180
171 typedef std::map<csize, static_context_t> SctxMap;181 typedef std::map<csize, static_context_t> SctxMap;
172182
183 typedef std::multimap<const expr*, pragma*> PragmaMap;
184
185 typedef PragmaMap::const_iterator PragmaMapIter;
186
173public:187public:
174 XQueryDiagnostics * theXQueryDiagnostics;188 XQueryDiagnostics * theXQueryDiagnostics;
175189
@@ -181,6 +195,8 @@
181 DebuggerCommons * theDebuggerCommons;195 DebuggerCommons * theDebuggerCommons;
182#endif196#endif
183197
198 ProcessingPhase thePhase;
199
184 bool theHasEval;200 bool theHasEval;
185201
186 bool theIsEval;202 bool theIsEval;
@@ -197,15 +213,13 @@
197213
198 uint32_t theTempIndexCounter;214 uint32_t theTempIndexCounter;
199215
200 ulong theNextVisitId;216 uint8_t theNextVisitId;
201217
202 config theConfig;218 config theConfig;
203219
204 ExprManager * const theEM;220 ExprManager * const theEM;
205221
206 typedef std::multimap<const expr*, pragma*> PragmaMap;222 PragmaMap thePragmas;
207 typedef PragmaMap::const_iterator PragmaMapIter;
208 PragmaMap thePragmas;
209223
210public:224public:
211 SERIALIZABLE_CLASS(CompilerCB);225 SERIALIZABLE_CLASS(CompilerCB);
@@ -219,6 +233,10 @@
219233
220 ~CompilerCB();234 ~CompilerCB();
221235
236 ProcessingPhase getPhase() const { return thePhase; }
237
238 void setPhase(ProcessingPhase v) { thePhase = v; }
239
222 bool isLoadPrologQuery() const { return theIsLoadProlog; }240 bool isLoadPrologQuery() const { return theIsLoadProlog; }
223241
224 void setLoadPrologQuery() { theIsLoadProlog = true; }242 void setLoadPrologQuery() { theIsLoadProlog = true; }
@@ -240,12 +258,9 @@
240 //258 //
241 void add_pragma(const expr* e, pragma* p);259 void add_pragma(const expr* e, pragma* p);
242260
243 void261 void lookup_pragmas(const expr* e, std::vector<pragma*>& pragmas) const;
244 lookup_pragmas(const expr* e, std::vector<pragma*>& pragmas) const;262
245263 bool lookup_pragma(const expr* e, const zstring& localname, pragma*&) const;
246 bool
247 lookup_pragma(const expr* e, const zstring& localname, pragma*&) const;
248
249};264};
250265
251266
252267
=== modified file 'src/compiler/expression/expr_base.cpp'
--- src/compiler/expression/expr_base.cpp 2012-10-31 08:02:16 +0000
+++ src/compiler/expression/expr_base.cpp 2012-12-06 22:51:20 +0000
@@ -128,7 +128,9 @@
128 theCCB(NULL),128 theCCB(NULL),
129 theSctx(NULL),129 theSctx(NULL),
130 theUDF(NULL),130 theUDF(NULL),
131 theFlags1(0)131 theAnnotationFlags(0),
132 theBoolFlags(0),
133 theVisitId(0)
132{134{
133}135}
134136
@@ -148,7 +150,8 @@
148 theUDF(udf),150 theUDF(udf),
149 theLoc(loc),151 theLoc(loc),
150 theKind(k),152 theKind(k),
151 theFlags1(0),153 theAnnotationFlags(0),
154 theBoolFlags(0),
152 theVisitId(0)155 theVisitId(0)
153{156{
154 theScriptingKind = UNKNOWN_SCRIPTING_KIND;157 theScriptingKind = UNKNOWN_SCRIPTING_KIND;
@@ -328,7 +331,7 @@
328 if (getDereferencesNodes() != ANNOTATION_TRUE_FIXED)331 if (getDereferencesNodes() != ANNOTATION_TRUE_FIXED)
329 setDereferencesNodes(ANNOTATION_FALSE);332 setDereferencesNodes(ANNOTATION_FALSE);
330333
331 //theFlags1 = 0;334 //theAnnotationFlags = 0;
332 //setNonDiscardable(ANNOTATION_FALSE);335 //setNonDiscardable(ANNOTATION_FALSE);
333 //setUnfoldable(ANNOTATION_FALSE);336 //setUnfoldable(ANNOTATION_FALSE);
334337
@@ -374,14 +377,14 @@
374********************************************************************************/377********************************************************************************/
375BoolAnnotationValue expr::getProducesSortedNodes() const378BoolAnnotationValue expr::getProducesSortedNodes() const
376{379{
377 return (BoolAnnotationValue)(theFlags1 & PRODUCES_SORTED_NODES_MASK);380 return (BoolAnnotationValue)(theAnnotationFlags & PRODUCES_SORTED_NODES_MASK);
378}381}
379382
380383
381void expr::setProducesSortedNodes(BoolAnnotationValue v)384void expr::setProducesSortedNodes(BoolAnnotationValue v)
382{385{
383 theFlags1 &= ~PRODUCES_SORTED_NODES_MASK;386 theAnnotationFlags &= ~PRODUCES_SORTED_NODES_MASK;
384 theFlags1 |= v;387 theAnnotationFlags |= v;
385}388}
386389
387390
@@ -398,14 +401,14 @@
398BoolAnnotationValue expr::getProducesDistinctNodes() const401BoolAnnotationValue expr::getProducesDistinctNodes() const
399{402{
400 return (BoolAnnotationValue)403 return (BoolAnnotationValue)
401 ((theFlags1 & PRODUCES_DISTINCT_NODES_MASK) >> PRODUCES_DISTINCT_NODES);404 ((theAnnotationFlags & PRODUCES_DISTINCT_NODES_MASK) >> PRODUCES_DISTINCT_NODES);
402}405}
403406
404407
405void expr::setProducesDistinctNodes(BoolAnnotationValue v)408void expr::setProducesDistinctNodes(BoolAnnotationValue v)
406{409{
407 theFlags1 &= ~PRODUCES_DISTINCT_NODES_MASK;410 theAnnotationFlags &= ~PRODUCES_DISTINCT_NODES_MASK;
408 theFlags1 |= (v << PRODUCES_DISTINCT_NODES);411 theAnnotationFlags |= (v << PRODUCES_DISTINCT_NODES);
409}412}
410413
411414
@@ -422,14 +425,14 @@
422BoolAnnotationValue expr::getIgnoresSortedNodes() const425BoolAnnotationValue expr::getIgnoresSortedNodes() const
423{426{
424 return (BoolAnnotationValue)427 return (BoolAnnotationValue)
425 ((theFlags1 & IGNORES_SORTED_NODES_MASK) >> IGNORES_SORTED_NODES);428 ((theAnnotationFlags & IGNORES_SORTED_NODES_MASK) >> IGNORES_SORTED_NODES);
426}429}
427430
428431
429void expr::setIgnoresSortedNodes(BoolAnnotationValue v)432void expr::setIgnoresSortedNodes(BoolAnnotationValue v)
430{433{
431 theFlags1 &= ~IGNORES_SORTED_NODES_MASK;434 theAnnotationFlags &= ~IGNORES_SORTED_NODES_MASK;
432 theFlags1 |= (v << IGNORES_SORTED_NODES);435 theAnnotationFlags |= (v << IGNORES_SORTED_NODES);
433}436}
434437
435438
@@ -446,14 +449,14 @@
446BoolAnnotationValue expr::getIgnoresDuplicateNodes() const449BoolAnnotationValue expr::getIgnoresDuplicateNodes() const
447{450{
448 return (BoolAnnotationValue)451 return (BoolAnnotationValue)
449 ((theFlags1 & IGNORES_DUPLICATE_NODES_MASK) >> IGNORES_DUPLICATE_NODES);452 ((theAnnotationFlags & IGNORES_DUPLICATE_NODES_MASK) >> IGNORES_DUPLICATE_NODES);
450}453}
451454
452455
453void expr::setIgnoresDuplicateNodes(BoolAnnotationValue v)456void expr::setIgnoresDuplicateNodes(BoolAnnotationValue v)
454{457{
455 theFlags1 &= ~IGNORES_DUPLICATE_NODES_MASK;458 theAnnotationFlags &= ~IGNORES_DUPLICATE_NODES_MASK;
456 theFlags1 |= (v << IGNORES_DUPLICATE_NODES);459 theAnnotationFlags |= (v << IGNORES_DUPLICATE_NODES);
457}460}
458461
459462
@@ -469,14 +472,14 @@
469BoolAnnotationValue expr::getNonDiscardable() const472BoolAnnotationValue expr::getNonDiscardable() const
470{473{
471 return (BoolAnnotationValue)474 return (BoolAnnotationValue)
472 ((theFlags1 & NON_DISCARDABLE_MASK) >> NON_DISCARDABLE);475 ((theAnnotationFlags & NON_DISCARDABLE_MASK) >> NON_DISCARDABLE);
473}476}
474477
475478
476void expr::setNonDiscardable(BoolAnnotationValue v)479void expr::setNonDiscardable(BoolAnnotationValue v)
477{480{
478 theFlags1 &= ~NON_DISCARDABLE_MASK;481 theAnnotationFlags &= ~NON_DISCARDABLE_MASK;
479 theFlags1 |= (v << NON_DISCARDABLE);482 theAnnotationFlags |= (v << NON_DISCARDABLE);
480}483}
481484
482485
@@ -493,14 +496,14 @@
493BoolAnnotationValue expr::getUnfoldable() const496BoolAnnotationValue expr::getUnfoldable() const
494{497{
495 return (BoolAnnotationValue)498 return (BoolAnnotationValue)
496 ((theFlags1 & UNFOLDABLE_MASK) >> UNFOLDABLE);499 ((theAnnotationFlags & UNFOLDABLE_MASK) >> UNFOLDABLE);
497}500}
498501
499502
500void expr::setUnfoldable(BoolAnnotationValue v)503void expr::setUnfoldable(BoolAnnotationValue v)
501{504{
502 theFlags1 &= ~UNFOLDABLE_MASK;505 theAnnotationFlags &= ~UNFOLDABLE_MASK;
503 theFlags1 |= (v << UNFOLDABLE);506 theAnnotationFlags |= (v << UNFOLDABLE);
504}507}
505508
506509
@@ -517,14 +520,14 @@
517BoolAnnotationValue expr::getContainsRecursiveCall() const520BoolAnnotationValue expr::getContainsRecursiveCall() const
518{521{
519 return (BoolAnnotationValue)522 return (BoolAnnotationValue)
520 ((theFlags1 & CONTAINS_RECURSIVE_CALL_MASK) >> CONTAINS_RECURSIVE_CALL);523 ((theAnnotationFlags & CONTAINS_RECURSIVE_CALL_MASK) >> CONTAINS_RECURSIVE_CALL);
521}524}
522525
523526
524void expr::setContainsRecursiveCall(BoolAnnotationValue v)527void expr::setContainsRecursiveCall(BoolAnnotationValue v)
525{528{
526 theFlags1 &= ~CONTAINS_RECURSIVE_CALL_MASK;529 theAnnotationFlags &= ~CONTAINS_RECURSIVE_CALL_MASK;
527 theFlags1 |= (v << CONTAINS_RECURSIVE_CALL);530 theAnnotationFlags |= (v << CONTAINS_RECURSIVE_CALL);
528}531}
529532
530533
@@ -541,14 +544,14 @@
541BoolAnnotationValue expr::getContainsPragma() const544BoolAnnotationValue expr::getContainsPragma() const
542{545{
543 return (BoolAnnotationValue)546 return (BoolAnnotationValue)
544 ((theFlags1 & CONTAINS_PRAGMA_MASK) >> CONTAINS_PRAGMA);547 ((theAnnotationFlags & CONTAINS_PRAGMA_MASK) >> CONTAINS_PRAGMA);
545}548}
546549
547550
548void expr::setContainsPragma(BoolAnnotationValue v)551void expr::setContainsPragma(BoolAnnotationValue v)
549{552{
550 theFlags1 &= ~CONTAINS_PRAGMA_MASK;553 theAnnotationFlags &= ~CONTAINS_PRAGMA_MASK;
551 theFlags1 |= (v << CONTAINS_PRAGMA);554 theAnnotationFlags |= (v << CONTAINS_PRAGMA);
552}555}
553556
554557
@@ -566,14 +569,14 @@
566BoolAnnotationValue expr::getConstructsNodes() const569BoolAnnotationValue expr::getConstructsNodes() const
567{570{
568 return (BoolAnnotationValue)571 return (BoolAnnotationValue)
569 ((theFlags1 & CONSTRUCTS_NODES_MASK) >> CONSTRUCTS_NODES);572 ((theAnnotationFlags & CONSTRUCTS_NODES_MASK) >> CONSTRUCTS_NODES);
570}573}
571574
572575
573void expr::setConstructsNodes(BoolAnnotationValue v)576void expr::setConstructsNodes(BoolAnnotationValue v)
574{577{
575 theFlags1 &= ~CONSTRUCTS_NODES_MASK;578 theAnnotationFlags &= ~CONSTRUCTS_NODES_MASK;
576 theFlags1 |= (v << CONSTRUCTS_NODES);579 theAnnotationFlags |= (v << CONSTRUCTS_NODES);
577}580}
578581
579582
@@ -591,14 +594,14 @@
591BoolAnnotationValue expr::getDereferencesNodes() const594BoolAnnotationValue expr::getDereferencesNodes() const
592{595{
593 return (BoolAnnotationValue)596 return (BoolAnnotationValue)
594 ((theFlags1 & DEREFERENCES_NODES_MASK) >> DEREFERENCES_NODES);597 ((theAnnotationFlags & DEREFERENCES_NODES_MASK) >> DEREFERENCES_NODES);
595}598}
596599
597600
598void expr::setDereferencesNodes(BoolAnnotationValue v)601void expr::setDereferencesNodes(BoolAnnotationValue v)
599{602{
600 theFlags1 &= ~DEREFERENCES_NODES_MASK;603 theAnnotationFlags &= ~DEREFERENCES_NODES_MASK;
601 theFlags1 |= (v << DEREFERENCES_NODES);604 theAnnotationFlags |= (v << DEREFERENCES_NODES);
602}605}
603606
604607
@@ -620,14 +623,14 @@
620BoolAnnotationValue expr::getMustCopyNodes() const623BoolAnnotationValue expr::getMustCopyNodes() const
621{624{
622 return (BoolAnnotationValue)625 return (BoolAnnotationValue)
623 ((theFlags1 & MUST_COPY_NODES_MASK) >> MUST_COPY_NODES);626 ((theAnnotationFlags & MUST_COPY_NODES_MASK) >> MUST_COPY_NODES);
624}627}
625628
626629
627void expr::setMustCopyNodes(BoolAnnotationValue v)630void expr::setMustCopyNodes(BoolAnnotationValue v)
628{631{
629 theFlags1 &= ~MUST_COPY_NODES_MASK;632 theAnnotationFlags &= ~MUST_COPY_NODES_MASK;
630 theFlags1 |= (v << MUST_COPY_NODES);633 theAnnotationFlags |= (v << MUST_COPY_NODES);
631}634}
632635
633636
634637
=== modified file 'src/compiler/expression/expr_base.h'
--- src/compiler/expression/expr_base.h 2012-10-26 07:13:42 +0000
+++ src/compiler/expression/expr_base.h 2012-12-06 22:51:20 +0000
@@ -169,6 +169,11 @@
169 DEREFERENCES_NODES_MASK = 0xC00000169 DEREFERENCES_NODES_MASK = 0xC00000
170 } AnnotationMask;170 } AnnotationMask;
171171
172 typedef enum
173 {
174 IN_TYPE_COMPUTE = 0x1
175 } BoolFlags;
176
172177
173protected:178protected:
174 static expr* iter_end_expr;179 static expr* iter_end_expr;
@@ -189,12 +194,14 @@
189194
190 xqtref_t theType;195 xqtref_t theType;
191196
192 uint32_t theFlags1;197 uint32_t theAnnotationFlags;
198
199 uint8_t theBoolFlags;
200
201 uint8_t theVisitId;
193202
194 FreeVars theFreeVars;203 FreeVars theFreeVars;
195204
196 int theVisitId;
197
198public:205public:
199 static bool is_sequential(unsigned short theScriptingKind);206 static bool is_sequential(unsigned short theScriptingKind);
200207
@@ -224,9 +231,9 @@
224231
225 void set_loc(const QueryLoc& loc) { theLoc = loc; }232 void set_loc(const QueryLoc& loc) { theLoc = loc; }
226233
227 uint32_t getFlags() const { return theFlags1; }234 uint32_t getAnnotationFlags() const { return theAnnotationFlags; }
228235
229 void setFlags(uint32_t flags) { theFlags1 = flags; }236 void setAnnotationFlags(uint32_t flags) { theAnnotationFlags = flags; }
230237
231 unsigned short get_scripting_detail() const { return theScriptingKind; }238 unsigned short get_scripting_detail() const { return theScriptingKind; }
232239
@@ -263,6 +270,20 @@
263 std::string toString() const;270 std::string toString() const;
264271
265public:272public:
273 //
274 void setVisitId(uint8_t id) { theVisitId = id; }
275
276 bool isVisited(uint8_t id) const { return theVisitId == id; }
277
278 uint8_t getVisitId() const { return theVisitId; }
279
280 // Transient flag used only during the type computation for global vars
281 bool isInTypeCompute() const { return theBoolFlags & IN_TYPE_COMPUTE; }
282
283 void setInTypeCompute() { theBoolFlags |= IN_TYPE_COMPUTE; }
284
285 void resetInTypeCompute() { theBoolFlags &= ~IN_TYPE_COMPUTE; }
286
266 // Annotation : produces-sorted-nodes287 // Annotation : produces-sorted-nodes
267 BoolAnnotationValue getProducesSortedNodes() const;288 BoolAnnotationValue getProducesSortedNodes() const;
268289
@@ -351,12 +372,6 @@
351 void setFreeVars(FreeVars& s);372 void setFreeVars(FreeVars& s);
352373
353 //374 //
354 void setVisitId(int id) { theVisitId = id; }
355
356 bool isVisited(int id) const { return theVisitId == id; }
357
358 int getVisitId() const { return theVisitId; }
359
360 bool is_constant() const;375 bool is_constant() const;
361376
362 bool is_nondeterministic() const;377 bool is_nondeterministic() const;
363378
=== modified file 'src/compiler/expression/expr_clone.cpp'
--- src/compiler/expression/expr_clone.cpp 2012-10-24 11:32:56 +0000
+++ src/compiler/expression/expr_clone.cpp 2012-12-06 22:51:20 +0000
@@ -618,7 +618,7 @@
618 udf,618 udf,
619 theLoc,619 theLoc,
620 varCopy,620 varCopy,
621 (e->theInitExpr ? e->theInitExpr->clone(udf, subst) : NULL));621 (e->theExpr ? e->theExpr->clone(udf, subst) : NULL));
622 622
623 break;623 break;
624 }624 }
625625
=== modified file 'src/compiler/expression/expr_iter.cpp'
--- src/compiler/expression/expr_iter.cpp 2012-10-24 11:32:56 +0000
+++ src/compiler/expression/expr_iter.cpp 2012-12-06 22:51:20 +0000
@@ -825,8 +825,8 @@
825825
826 EXPR_ITER_BEGIN();826 EXPR_ITER_BEGIN();
827827
828 if (varDeclExpr->theInitExpr)828 if (varDeclExpr->theExpr)
829 EXPR_ITER_NEXT(varDeclExpr->theInitExpr);829 EXPR_ITER_NEXT(varDeclExpr->theExpr);
830830
831 EXPR_ITER_END();831 EXPR_ITER_END();
832 return;832 return;
833833
=== modified file 'src/compiler/expression/expr_put.cpp'
--- src/compiler/expression/expr_put.cpp 2012-10-30 10:02:56 +0000
+++ src/compiler/expression/expr_put.cpp 2012-12-06 22:51:20 +0000
@@ -462,8 +462,8 @@
462 BEGIN_PUT(var_decl_expr);462 BEGIN_PUT(var_decl_expr);
463463
464 theVarExpr->put(os);464 theVarExpr->put(os);
465 if (theInitExpr)465 if (theExpr)
466 theInitExpr->put(os);466 theExpr->put(os);
467467
468 END_PUT();468 END_PUT();
469}469}
470470
=== modified file 'src/compiler/expression/expr_type.cpp'
--- src/compiler/expression/expr_type.cpp 2012-10-31 08:02:16 +0000
+++ src/compiler/expression/expr_type.cpp 2012-12-06 22:51:20 +0000
@@ -31,6 +31,9 @@
31#include "compiler/expression/var_expr.h"31#include "compiler/expression/var_expr.h"
32#include "compiler/expression/expr.h"32#include "compiler/expression/expr.h"
33#include "compiler/expression/expr_iter.h"33#include "compiler/expression/expr_iter.h"
34
35#include "compiler/api/compilercb.h"
36
34#include "compiler/xqddf/collection_decl.h"37#include "compiler/xqddf/collection_decl.h"
3538
36#include "functions/function.h"39#include "functions/function.h"
@@ -118,9 +121,9 @@
118121
119 TypeConstants::quantifier_t quant = TypeConstants::QUANT_ONE;122 TypeConstants::quantifier_t quant = TypeConstants::QUANT_ONE;
120123
121 ulong numClauses = e->num_clauses();124 csize numClauses = e->num_clauses();
122125
123 for (ulong i = 0; i < numClauses && quant != TypeConstants::QUANT_STAR; ++i)126 for (csize i = 0; i < numClauses && quant != TypeConstants::QUANT_STAR; ++i)
124 {127 {
125 const flwor_clause* c = e->theClauses[i];128 const flwor_clause* c = e->theClauses[i];
126129
@@ -213,8 +216,38 @@
213 }216 }
214 case var_expr::prolog_var:217 case var_expr::prolog_var:
215 {218 {
216 // For const global vars, their type is set in 219 // NOTE: For const global vars, their declared type is set to the
220 // type of their init expr, if any. This is done in
217 // translator::end_visit(const GlobalVarDecl& v, void*)221 // translator::end_visit(const GlobalVarDecl& v, void*)
222
223 csize numSetExprs = e->num_set_exprs();
224
225 if (e->get_ccb()->getPhase() == CompilerCB::OPTIMIZATION &&
226 numSetExprs > 0 &&
227 !e->is_external() &&
228 !e->isInTypeCompute())
229 {
230 e->setInTypeCompute();
231
232 var_set_expr* setExpr = e->get_set_expr(0);
233
234 derivedType = setExpr->get_expr()->get_return_type();
235
236 for (csize i = 1; i < numSetExprs; ++i)
237 {
238 if (derivedType == rtm.ITEM_TYPE_STAR)
239 break;
240
241 setExpr = e->get_set_expr(i);
242
243 derivedType = TypeOps::union_type(*derivedType,
244 *setExpr->get_expr()->get_return_type(),
245 tm);
246 }
247
248 e->resetInTypeCompute();
249 }
250
218 break;251 break;
219 }252 }
220 case var_expr::local_var: // TODO: compute derived type for const local vars.253 case var_expr::local_var: // TODO: compute derived type for const local vars.
221254
=== modified file 'src/compiler/expression/script_exprs.cpp'
--- src/compiler/expression/script_exprs.cpp 2012-10-24 11:32:56 +0000
+++ src/compiler/expression/script_exprs.cpp 2012-12-06 22:51:20 +0000
@@ -208,17 +208,11 @@
208 var_expr* varExpr,208 var_expr* varExpr,
209 expr* initExpr)209 expr* initExpr)
210 :210 :
211 expr(ccb, sctx, udf, loc, var_decl_expr_kind),211 var_set_expr(ccb, sctx, udf, loc, varExpr, initExpr, true)
212 theVarExpr(varExpr),
213 theInitExpr(initExpr)
214{212{
213 theKind = var_decl_expr_kind;
214
215 compute_scripting_kind();215 compute_scripting_kind();
216
217 // var_decl_expr is unfoldable because it requires access to the dyn ctx.
218 setUnfoldable(ANNOTATION_TRUE_FIXED);
219
220 if (initExpr)
221 varExpr->add_set_expr(this);
222}216}
223217
224218
@@ -234,17 +228,17 @@
234void var_decl_expr::compute_scripting_kind()228void var_decl_expr::compute_scripting_kind()
235{229{
236 if (theVarExpr->get_kind() == var_expr::prolog_var)230 if (theVarExpr->get_kind() == var_expr::prolog_var)
237 checkSimpleExpr(theInitExpr);231 checkSimpleExpr(theExpr);
238 else232 else
239 checkNonUpdating(theInitExpr);233 checkNonUpdating(theExpr);
240234
241 if (theInitExpr == NULL)235 if (theExpr == NULL)
242 {236 {
243 theScriptingKind = SIMPLE_EXPR;237 theScriptingKind = SIMPLE_EXPR;
244 }238 }
245 else239 else
246 {240 {
247 theScriptingKind = theInitExpr->get_scripting_detail();241 theScriptingKind = theExpr->get_scripting_detail();
248 }242 }
249}243}
250244
@@ -258,7 +252,8 @@
258 user_function* udf,252 user_function* udf,
259 const QueryLoc& loc,253 const QueryLoc& loc,
260 var_expr* varExpr,254 var_expr* varExpr,
261 expr* setExpr)255 expr* setExpr,
256 bool isDecl)
262 :257 :
263 expr(ccb, sctx, udf, loc, var_set_expr_kind),258 expr(ccb, sctx, udf, loc, var_set_expr_kind),
264 theVarExpr(varExpr),259 theVarExpr(varExpr),
@@ -267,12 +262,15 @@
267 assert(varExpr->get_kind() == var_expr::prolog_var ||262 assert(varExpr->get_kind() == var_expr::prolog_var ||
268 varExpr->get_kind() == var_expr::local_var);263 varExpr->get_kind() == var_expr::local_var);
269264
270 compute_scripting_kind();265 if (!isDecl)
266 compute_scripting_kind();
271267
272 // var_set_expr is unfoldable because it requires access to the dyn ctx.268 // var_set_expr and var_decl_expr are unfoldable because they require access
269 // to the dyn ctx.
273 setUnfoldable(ANNOTATION_TRUE_FIXED);270 setUnfoldable(ANNOTATION_TRUE_FIXED);
274271
275 varExpr->add_set_expr(this);272 if (setExpr)
273 varExpr->add_set_expr(this);
276}274}
277275
278276
279277
=== modified file 'src/compiler/expression/script_exprs.h'
--- src/compiler/expression/script_exprs.h 2012-10-24 11:32:56 +0000
+++ src/compiler/expression/script_exprs.h 2012-12-06 22:51:20 +0000
@@ -181,6 +181,52 @@
181181
182/*******************************************************************************182/*******************************************************************************
183183
184 AssignStatement ::= "$" VarName ":=" ExprSingle ";"
185
186 The RHS of the assignment must be a non-updating expr.
187
188 var_set_expr is used to assign a value to a prolog or block-local var. During
189 runtime, the function computes theExpr and stores the resulting value inside
190 the appropriate dynamic ctx (global or local), at the location that is identified
191 by the variable id.
192********************************************************************************/
193class var_set_expr : public expr
194{
195 friend class ExprManager;
196 friend class ExprIterator;
197 friend class expr;
198
199protected:
200 var_expr * theVarExpr;
201 expr * theExpr;
202
203protected:
204 var_set_expr(
205 CompilerCB* ccb,
206 static_context* sctx,
207 user_function* udf,
208 const QueryLoc& loc,
209 var_expr* varExpr,
210 expr* setExpr,
211 bool isDecl = false);
212
213public:
214 ~var_set_expr();
215
216 var_expr* get_var_expr() const { return theVarExpr; }
217
218 expr* get_expr() const { return theExpr; }
219
220 void compute_scripting_kind();
221
222 void accept(expr_visitor&);
223
224 std::ostream& put(std::ostream&) const;
225};
226
227
228/*******************************************************************************
229
184 For Global Var:230 For Global Var:
185 ----------------231 ----------------
186232
@@ -207,17 +253,13 @@
207 Note: the init expr must be non-updating. For global vars, it must also be253 Note: the init expr must be non-updating. For global vars, it must also be
208 non-sequential.254 non-sequential.
209********************************************************************************/255********************************************************************************/
210class var_decl_expr : public expr256class var_decl_expr : public var_set_expr
211{257{
212 friend class ExprManager;258 friend class ExprManager;
213 friend class ExprIterator;259 friend class ExprIterator;
214 friend class expr;260 friend class expr;
215261
216protected:262protected:
217 var_expr * theVarExpr;
218 expr * theInitExpr;
219
220protected:
221 var_decl_expr(263 var_decl_expr(
222 CompilerCB* ccb,264 CompilerCB* ccb,
223 static_context* sctx,265 static_context* sctx,
@@ -229,54 +271,7 @@
229public:271public:
230 ~var_decl_expr();272 ~var_decl_expr();
231273
232 var_expr* get_var_expr() const { return theVarExpr; }274 expr* get_init_expr() const { return theExpr; }
233
234 expr* get_init_expr() const { return theInitExpr; }
235
236 void compute_scripting_kind();
237
238 void accept(expr_visitor&);
239
240 std::ostream& put(std::ostream&) const;
241};
242
243
244/*******************************************************************************
245
246 AssignStatement ::= "$" VarName ":=" ExprSingle ";"
247
248 The RHS of the assignment must be a non-updating expr.
249
250 var_set_expr is used to assign a value to a prolog or block-local var. During
251 runtime, the function computes theExpr and stores the resulting value inside
252 the appropriate dynamic ctx (global or local), at the location that is identified
253 by the variable id.
254********************************************************************************/
255class var_set_expr : public expr
256{
257 friend class ExprManager;
258 friend class ExprIterator;
259 friend class expr;
260
261protected:
262 var_expr * theVarExpr;
263 expr * theExpr;
264
265protected:
266 var_set_expr(
267 CompilerCB* ccb,
268 static_context* sctx,
269 user_function* udf,
270 const QueryLoc& loc,
271 var_expr* varExpr,
272 expr* setExpr);
273
274public:
275 ~var_set_expr();
276
277 var_expr* get_var_expr() const { return theVarExpr; }
278
279 expr* get_expr() const { return theExpr; }
280275
281 void compute_scripting_kind();276 void compute_scripting_kind();
282277
283278
=== modified file 'src/compiler/expression/var_expr.cpp'
--- src/compiler/expression/var_expr.cpp 2012-10-31 08:02:16 +0000
+++ src/compiler/expression/var_expr.cpp 2012-12-06 22:51:20 +0000
@@ -18,6 +18,7 @@
18#include "functions/udf.h"18#include "functions/udf.h"
1919
20#include "compiler/expression/var_expr.h"20#include "compiler/expression/var_expr.h"
21#include "compiler/expression/script_exprs.h"
21#include "compiler/expression/update_exprs.h"22#include "compiler/expression/update_exprs.h"
22#include "compiler/expression/flwor_expr.h"23#include "compiler/expression/flwor_expr.h"
23#include "compiler/expression/expr_visitor.h"24#include "compiler/expression/expr_visitor.h"
@@ -300,13 +301,25 @@
300/*******************************************************************************301/*******************************************************************************
301302
302********************************************************************************/303********************************************************************************/
304void var_expr::add_set_expr(expr* e)
305{
306 assert(e->get_expr_kind() == var_decl_expr_kind ||
307 e->get_expr_kind() == var_set_expr_kind);
308
309 theSetExprs.push_back(static_cast<var_set_expr*>(e));
310}
311
312
313/*******************************************************************************
314
315********************************************************************************/
303void var_expr::remove_set_expr(expr* e)316void var_expr::remove_set_expr(expr* e)
304{317{
305 assert(theVarKind == local_var || theVarKind == prolog_var);318 assert(theVarKind == local_var || theVarKind == prolog_var);
306319
307 bool found = false;320 bool found = false;
308 std::vector<expr*>::iterator ite = theSetExprs.begin();321 VarSetExprs::iterator ite = theSetExprs.begin();
309 std::vector<expr*>::iterator end = theSetExprs.end();322 VarSetExprs::iterator end = theSetExprs.end();
310 for (; ite != end; ++ite)323 for (; ite != end; ++ite)
311 {324 {
312 if (*ite == e)325 if (*ite == e)
313326
=== modified file 'src/compiler/expression/var_expr.h'
--- src/compiler/expression/var_expr.h 2012-10-26 07:13:42 +0000
+++ src/compiler/expression/var_expr.h 2012-12-06 22:51:20 +0000
@@ -28,6 +28,8 @@
28class copy_clause;28class copy_clause;
29class var_expr;29class var_expr;
30class VarInfo;30class VarInfo;
31class var_set_expr;
32
3133
32/******************************************************************************34/******************************************************************************
3335
@@ -116,6 +118,8 @@
116 friend class ExprManager;118 friend class ExprManager;
117119
118public:120public:
121 typedef std::vector<var_set_expr*> VarSetExprs;
122
119 enum var_kind123 enum var_kind
120 {124 {
121 unknown_var = 0,125 unknown_var = 0,
@@ -161,7 +165,7 @@
161165
162 csize theParamPos;166 csize theParamPos;
163167
164 std::vector<expr*> theSetExprs;168 VarSetExprs theSetExprs;
165169
166 VarInfo * theVarInfo;170 VarInfo * theVarInfo;
167171
@@ -244,17 +248,17 @@
244248
245 void set_param_pos(csize pos) { theParamPos = pos; }249 void set_param_pos(csize pos) { theParamPos = pos; }
246250
247 void add_set_expr(expr* e) { theSetExprs.push_back(e); }251 void add_set_expr(expr* e);
248252
249 void remove_set_expr(expr* e);253 void remove_set_expr(expr* e);
250254
251 csize num_set_exprs() const { return theSetExprs.size(); }255 csize num_set_exprs() const { return theSetExprs.size(); }
252256
253 expr* get_set_expr(csize i) const { return theSetExprs[i]; }257 var_set_expr* get_set_expr(csize i) const { return theSetExprs[i]; }
254258
255 std::vector<expr*>::const_iterator setExprsBegin() const { return theSetExprs.begin(); }259 VarSetExprs::const_iterator setExprsBegin() const { return theSetExprs.begin(); }
256260
257 std::vector<expr*>::const_iterator setExprsEnd() const { return theSetExprs.end(); }261 VarSetExprs::const_iterator setExprsEnd() const { return theSetExprs.end(); }
258262
259 bool is_context_item() const;263 bool is_context_item() const;
260264
261265
=== modified file 'src/compiler/rewriter/rules/hoist_rules.cpp'
--- src/compiler/rewriter/rules/hoist_rules.cpp 2012-10-29 11:41:36 +0000
+++ src/compiler/rewriter/rules/hoist_rules.cpp 2012-12-06 22:51:20 +0000
@@ -484,7 +484,7 @@
484 expr* hoisted = rCtx.theEM->484 expr* hoisted = rCtx.theEM->
485 create_fo_expr(sctx, udf, loc, BUILTIN_FUNC(OP_HOIST_1), e);485 create_fo_expr(sctx, udf, loc, BUILTIN_FUNC(OP_HOIST_1), e);
486486
487 hoisted->setFlags(e->getFlags());487 hoisted->setAnnotationFlags(e->getAnnotationFlags());
488 //letvar->setFlags(e->getFlags());488 //letvar->setFlags(e->getFlags());
489489
490 let_clause* flref(rCtx.theEM->create_let_clause(sctx, loc, letvar, hoisted));490 let_clause* flref(rCtx.theEM->create_let_clause(sctx, loc, letvar, hoisted));
@@ -523,7 +523,7 @@
523 loc,523 loc,
524 BUILTIN_FUNC(OP_UNHOIST_1),524 BUILTIN_FUNC(OP_UNHOIST_1),
525 rCtx.theEM->create_wrapper_expr(sctx, udf, loc, letvar));525 rCtx.theEM->create_wrapper_expr(sctx, udf, loc, letvar));
526 unhoisted->setFlags(e->getFlags());526 unhoisted->setAnnotationFlags(e->getAnnotationFlags());
527527
528 return unhoisted;528 return unhoisted;
529}529}
530530
=== modified file 'src/compiler/rewriter/rules/index_join_rule.cpp'
--- src/compiler/rewriter/rules/index_join_rule.cpp 2012-11-02 20:00:13 +0000
+++ src/compiler/rewriter/rules/index_join_rule.cpp 2012-12-06 22:51:20 +0000
@@ -309,7 +309,7 @@
309 {309 {
310 // Normally, other rewrite rules should have added the necessary casting310 // Normally, other rewrite rules should have added the necessary casting
311 // to the eq operands so that their static types have quantifiers ONE311 // to the eq operands so that their static types have quantifiers ONE
312 // or QUESTION and the associated prime types are not xs:untypedAtomic.312 // or QUESTION and the associated prime types are not xs:anyAtomicType.
313 // But just in case those rules have been disabled, we check again here313 // But just in case those rules have been disabled, we check again here
314 // and reject the hashjoin rewrite if these condition are violated.314 // and reject the hashjoin rewrite if these condition are violated.
315315
@@ -323,10 +323,11 @@
323323
324 // The type of the outer/inner operands in the join predicate must not be324 // The type of the outer/inner operands in the join predicate must not be
325 // xs:untypedAtomic or xs:anyAtomic.325 // xs:untypedAtomic or xs:anyAtomic.
326 /*
326 if (TypeOps::is_equal(tm, *primeOuterType, *rtm.UNTYPED_ATOMIC_TYPE_ONE, outerLoc) ||327 if (TypeOps::is_equal(tm, *primeOuterType, *rtm.UNTYPED_ATOMIC_TYPE_ONE, outerLoc) ||
327 TypeOps::is_equal(tm, *primeInnerType, *rtm.UNTYPED_ATOMIC_TYPE_ONE, innerLoc))328 TypeOps::is_equal(tm, *primeInnerType, *rtm.UNTYPED_ATOMIC_TYPE_ONE, innerLoc))
328 return false;329 return false;
329330 */
330 if (TypeOps::is_equal(tm, *primeOuterType, *rtm.ANY_ATOMIC_TYPE_ONE, outerLoc) ||331 if (TypeOps::is_equal(tm, *primeOuterType, *rtm.ANY_ATOMIC_TYPE_ONE, outerLoc) ||
331 TypeOps::is_equal(tm, *primeInnerType, *rtm.ANY_ATOMIC_TYPE_ONE, innerLoc))332 TypeOps::is_equal(tm, *primeInnerType, *rtm.ANY_ATOMIC_TYPE_ONE, innerLoc))
332 return false;333 return false;
333334
=== modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp'
--- src/compiler/rewriter/rules/nodeid_rules.cpp 2012-10-31 08:02:16 +0000
+++ src/compiler/rewriter/rules/nodeid_rules.cpp 2012-12-06 22:51:20 +0000
@@ -1161,24 +1161,12 @@
1161 {1161 {
1162 e->setVisitId(1);1162 e->setVisitId(1);
11631163
1164 std::vector<expr*>::const_iterator ite = e->setExprsBegin();1164 var_expr::VarSetExprs::const_iterator ite = e->setExprsBegin();
1165 std::vector<expr*>::const_iterator end = e->setExprsEnd();1165 var_expr::VarSetExprs::const_iterator end = e->setExprsEnd();
11661166
1167 for (; ite != end; ++ite)1167 for (; ite != end; ++ite)
1168 {1168 {
1169 expr* setExpr = *ite;1169 expr* valueExpr = (*ite)->get_expr();
1170 expr* valueExpr;
1171
1172 if (setExpr->get_expr_kind() == var_decl_expr_kind)
1173 {
1174 valueExpr = static_cast<var_decl_expr*>(setExpr)->get_init_expr();
1175 }
1176 else
1177 {
1178 assert(setExpr->get_expr_kind() == var_set_expr_kind);
1179
1180 valueExpr = static_cast<var_set_expr*>(setExpr)->get_expr();
1181 }
11821170
1183 findSourcesForNodeExtractors(valueExpr);1171 findSourcesForNodeExtractors(valueExpr);
1184 }1172 }
11851173
=== modified file 'src/compiler/rewriter/rules/type_rules.cpp'
--- src/compiler/rewriter/rules/type_rules.cpp 2012-10-31 08:02:16 +0000
+++ src/compiler/rewriter/rules/type_rules.cpp 2012-12-06 22:51:20 +0000
@@ -235,12 +235,10 @@
235235
236RULE_REWRITE_POST(SpecializeOperations)236RULE_REWRITE_POST(SpecializeOperations)
237{237{
238 const Properties& props = *Properties::instance();
239
240 RootTypeManager& rtm = GENV_TYPESYSTEM;238 RootTypeManager& rtm = GENV_TYPESYSTEM;
241 TypeManager* tm = node->get_type_manager();239 TypeManager* tm = node->get_type_manager();
242
243 static_context* sctx = node->get_sctx();240 static_context* sctx = node->get_sctx();
241 user_function* udf = node->get_udf();
244242
245 if (node->get_expr_kind() == fo_expr_kind)243 if (node->get_expr_kind() == fo_expr_kind)
246 {244 {
@@ -255,7 +253,9 @@
255 fnKind == FunctionConsts::FN_SUM_2)253 fnKind == FunctionConsts::FN_SUM_2)
256 {254 {
257 expr* argExpr = fo->get_arg(0);255 expr* argExpr = fo->get_arg(0);
256 const QueryLoc& argLoc = argExpr->get_loc();
258 xqtref_t argType = argExpr->get_return_type();257 xqtref_t argType = argExpr->get_return_type();
258
259 std::vector<xqtref_t> argTypes;259 std::vector<xqtref_t> argTypes;
260 argTypes.push_back(argType);260 argTypes.push_back(argType);
261261
@@ -264,14 +264,11 @@
264 {264 {
265 fo->set_func(replacement);265 fo->set_func(replacement);
266266
267 if (TypeOps::is_subtype(tm,267 if (TypeOps::is_subtype(tm, *argType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, argLoc))
268 *argType,
269 *rtm.UNTYPED_ATOMIC_TYPE_STAR,
270 argExpr->get_loc()))
271 {268 {
272 expr* promoteExpr = rCtx.theEM->269 expr* promoteExpr = rCtx.theEM->
273 create_promote_expr(argExpr->get_sctx(),270 create_promote_expr(sctx,
274 argExpr->get_udf(),271 udf,
275 argExpr->get_loc(),272 argExpr->get_loc(),
276 argExpr,273 argExpr,
277 rtm.DOUBLE_TYPE_STAR,274 rtm.DOUBLE_TYPE_STAR,
@@ -359,7 +356,7 @@
359 if (t0->max_card() > 1 || t1->max_card() > 1)356 if (t0->max_card() > 1 || t1->max_card() > 1)
360 return NULL;357 return NULL;
361358
362 if (props.specializeNum() && fn->isArithmeticFunction())359 if (fn->isArithmeticFunction())
363 {360 {
364 if (! TypeOps::is_numeric_or_untyped(tm, *t0) ||361 if (! TypeOps::is_numeric_or_untyped(tm, *t0) ||
365 ! TypeOps::is_numeric_or_untyped(tm, *t1))362 ! TypeOps::is_numeric_or_untyped(tm, *t1))
@@ -368,13 +365,38 @@
368 if (specialize_numeric(fo, sctx, rCtx) != NULL)365 if (specialize_numeric(fo, sctx, rCtx) != NULL)
369 return node;366 return node;
370 }367 }
371 else if (props.specializeCmp() && fn->isComparisonFunction())368 else if (fn->isGeneralComparisonFunction())
372 {369 {
373 if (fn->isGeneralComparisonFunction())370 std::vector<xqtref_t> argTypes;
371 argTypes.push_back(t0);
372 argTypes.push_back(t1);
373 function* replacement = fn->specialize(sctx, argTypes);
374 if (replacement != NULL)
375 {
376 fo->set_func(replacement);
377 return node;
378 }
379 }
380 else if (fn->isValueComparisonFunction())
381 {
382 xqtref_t stringType = rtm.STRING_TYPE_QUESTION;
383 xqtref_t untypedType = rtm.UNTYPED_ATOMIC_TYPE_QUESTION;
384
385 const QueryLoc& loc0 = arg0->get_loc();
386 const QueryLoc& loc1 = arg1->get_loc();
387
388 bool atomicORstring0 = (TypeOps::is_subtype(tm, *t0, *untypedType, loc0) ||
389 TypeOps::is_subtype(tm, *t0, *stringType, loc0));
390
391 bool atomicORstring1 = (TypeOps::is_subtype(tm, *t1, *untypedType, loc1) ||
392 TypeOps::is_subtype(tm, *t1, *stringType, loc1));
393
394 if (atomicORstring0 && atomicORstring1)
374 {395 {
375 std::vector<xqtref_t> argTypes;396 std::vector<xqtref_t> argTypes;
376 argTypes.push_back(t0);397 argTypes.push_back(stringType);
377 argTypes.push_back(t1);398 argTypes.push_back(stringType);
399
378 function* replacement = fn->specialize(sctx, argTypes);400 function* replacement = fn->specialize(sctx, argTypes);
379 if (replacement != NULL)401 if (replacement != NULL)
380 {402 {
@@ -382,72 +404,24 @@
382 return node;404 return node;
383 }405 }
384 }406 }
385 else if (fn->isValueComparisonFunction())407 else if (TypeOps::is_numeric(tm, *t0) && TypeOps::is_numeric(tm, *t1))
386 {408 {
387 xqtref_t string_type = rtm.STRING_TYPE_QUESTION;409 xqtref_t aType = specialize_numeric(fo, sctx, rCtx);
388 bool string_cmp = true;410 if (aType != NULL)
389 expr* nargs[2];411 {
390412 if (TypeOps::is_equal(tm,
391 for (int i = 0; i < 2; ++i)413 *TypeOps::prime_type(tm, *aType),
392 {414 *rtm.DECIMAL_TYPE_ONE,
393 nargs[i] = NULL;415 fo->get_loc()) &&
394416 TypeOps::is_subtype(tm, *t0, *rtm.INTEGER_TYPE_ONE, fo->get_loc()))
395 expr* arg = (i == 0 ? arg0 : arg1);417 {
396 xqtref_t type = (i == 0 ? t0 : t1);418 expr* tmp = fo->get_arg(0);
397 const QueryLoc& loc = arg->get_loc();419 fo->set_arg(0, fo->get_arg(1));
398420 fo->set_arg(1, tmp);
399 if (TypeOps::is_subtype(tm, *type, *rtm.UNTYPED_ATOMIC_TYPE_QUESTION, loc))421 fo->set_func(flip_value_cmp(fo->get_func()->getKind()));
400 {422 }
401 nargs[i] = rCtx.theEM->create_cast_expr(arg->get_sctx(),423
402 arg->get_udf(),424 return node;
403 arg->get_loc(),
404 arg,
405 string_type);
406 }
407 else if (! TypeOps::is_subtype(tm, *type, *string_type, loc))
408 {
409 string_cmp = false;
410 break;
411 }
412 }
413
414 if (string_cmp)
415 {
416 for (int i = 0; i < 2; i++)
417 {
418 if (nargs[i] != NULL)
419 fo->set_arg(i, nargs[i]);
420 }
421
422 std::vector<xqtref_t> argTypes;
423 argTypes.push_back(string_type);
424 argTypes.push_back(string_type);
425 function* replacement = fn->specialize(sctx, argTypes);
426 if (replacement != NULL)
427 {
428 fo->set_func(replacement);
429 return node;
430 }
431 }
432 else if (TypeOps::is_numeric(tm, *t0) && TypeOps::is_numeric(tm, *t1))
433 {
434 xqtref_t aType = specialize_numeric(fo, sctx, rCtx);
435 if (aType != NULL)
436 {
437 if (TypeOps::is_equal(tm,
438 *TypeOps::prime_type(tm, *aType),
439 *rtm.DECIMAL_TYPE_ONE,
440 fo->get_loc()) &&
441 TypeOps::is_subtype(tm, *t0, *rtm.INTEGER_TYPE_ONE, fo->get_loc()))
442 {
443 expr* tmp = fo->get_arg(0);
444 fo->set_arg(0, fo->get_arg(1));
445 fo->set_arg(1, tmp);
446 fo->set_func(flip_value_cmp(fo->get_func()->getKind()));
447 }
448
449 return node;
450 }
451 }425 }
452 }426 }
453 }427 }
@@ -456,7 +430,7 @@
456 else if (node->get_expr_kind() == flwor_expr_kind ||430 else if (node->get_expr_kind() == flwor_expr_kind ||
457 node->get_expr_kind() == gflwor_expr_kind)431 node->get_expr_kind() == gflwor_expr_kind)
458 {432 {
459 flwor_expr* flworExpr = reinterpret_cast<flwor_expr*>(node);433 flwor_expr* flworExpr = static_cast<flwor_expr*>(node);
460434
461 bool modified = false;435 bool modified = false;
462436
@@ -465,8 +439,8 @@
465 {439 {
466 if (flworExpr->get_clause(i)->get_kind() == flwor_clause::order_clause)440 if (flworExpr->get_clause(i)->get_kind() == flwor_clause::order_clause)
467 {441 {
468 orderby_clause* obc = reinterpret_cast<orderby_clause*>442 orderby_clause* obc =
469 (flworExpr->get_clause(i));443 static_cast<orderby_clause*>(flworExpr->get_clause(i));
470444
471 csize numColumns = obc->num_columns();445 csize numColumns = obc->num_columns();
472 for (csize j = 0; j < numColumns; ++j)446 for (csize j = 0; j < numColumns; ++j)
@@ -479,11 +453,7 @@
479 TypeOps::is_subtype(tm, *colType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, colLoc))453 TypeOps::is_subtype(tm, *colType, *rtm.UNTYPED_ATOMIC_TYPE_STAR, colLoc))
480 {454 {
481 expr* castExpr = rCtx.theEM->455 expr* castExpr = rCtx.theEM->
482 create_cast_expr(colExpr->get_sctx(),456 create_cast_expr(sctx, udf, colLoc, colExpr, rtm.STRING_TYPE_QUESTION);
483 colExpr->get_udf(),
484 colExpr->get_loc(),
485 colExpr,
486 rtm.STRING_TYPE_QUESTION);
487457
488 obc->set_column_expr(j, castExpr);458 obc->set_column_expr(j, castExpr);
489 modified = true;459 modified = true;
490460
=== modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp'
--- src/compiler/rewriter/tools/dataflow_annotations.cpp 2012-11-02 20:00:13 +0000
+++ src/compiler/rewriter/tools/dataflow_annotations.cpp 2012-12-06 22:51:20 +0000
@@ -880,30 +880,17 @@
880 varSources = new std::vector<expr*>;;880 varSources = new std::vector<expr*>;;
881 theVarSourcesMap.insert(VarSourcesPair(e, varSources));881 theVarSourcesMap.insert(VarSourcesPair(e, varSources));
882882
883 std::vector<expr*>::const_iterator ite2 = e->setExprsBegin();883 var_expr::VarSetExprs::const_iterator ite2 = e->setExprsBegin();
884 std::vector<expr*>::const_iterator end2 = e->setExprsEnd();884 var_expr::VarSetExprs::const_iterator end2 = e->setExprsEnd();
885885
886 for (; ite2 != end2; ++ite2)886 for (; ite2 != end2; ++ite2)
887 {887 {
888 expr* setExpr = *ite2;888 var_set_expr* setExpr = *ite2;
889889
890 if (setExpr->get_udf() != NULL && !setExpr->get_udf()->isOptimized())890 if (setExpr->get_udf() != NULL && !setExpr->get_udf()->isOptimized())
891 continue;891 continue;
892892
893 if (setExpr->get_expr_kind() == var_decl_expr_kind)893 findNodeSourcesRec(setExpr->get_expr(), *varSources, currentUdf);
894 {
895 findNodeSourcesRec(static_cast<var_decl_expr*>(setExpr)->get_init_expr(),
896 *varSources,
897 currentUdf);
898 }
899 else
900 {
901 assert(setExpr->get_expr_kind() == var_set_expr_kind);
902
903 findNodeSourcesRec(static_cast<var_set_expr*>(setExpr)->get_expr(),
904 *varSources,
905 currentUdf);
906 }
907 }894 }
908 }895 }
909 else896 else
@@ -1323,25 +1310,14 @@
1323 varSources = new std::vector<expr*>;;1310 varSources = new std::vector<expr*>;;
1324 theVarSourcesMap.insert(VarSourcesPair(e, varSources));1311 theVarSourcesMap.insert(VarSourcesPair(e, varSources));
13251312
1326 std::vector<expr*>::const_iterator ite2 = e->setExprsBegin();1313 var_expr::VarSetExprs::const_iterator ite2 = e->setExprsBegin();
1327 std::vector<expr*>::const_iterator end2 = e->setExprsEnd();1314 var_expr::VarSetExprs::const_iterator end2 = e->setExprsEnd();
13281315
1329 for (; ite2 != end2; ++ite2)1316 for (; ite2 != end2; ++ite2)
1330 {1317 {
1331 expr* setExpr = *ite2;1318 var_set_expr* setExpr = *ite2;
13321319
1333 if (setExpr->get_expr_kind() == var_decl_expr_kind)1320 findLocalNodeSources(setExpr->get_expr(), *varSources);
1334 {
1335 findLocalNodeSources(static_cast<var_decl_expr*>(setExpr)->get_init_expr(),
1336 *varSources);
1337 }
1338 else
1339 {
1340 assert(setExpr->get_expr_kind() == var_set_expr_kind);
1341
1342 findLocalNodeSources(static_cast<var_set_expr*>(setExpr)->get_expr(),
1343 *varSources);
1344 }
1345 }1321 }
1346 }1322 }
1347 else1323 else
13481324
=== modified file 'test/parser/CMakeLists.txt'
--- test/parser/CMakeLists.txt 2012-09-19 21:16:15 +0000
+++ test/parser/CMakeLists.txt 2012-12-06 22:51:20 +0000
@@ -15,12 +15,12 @@
15CONFIGURE_FILE(parsertestdriverconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/parsertestdriverconfig.h)15CONFIGURE_FILE(parsertestdriverconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/parsertestdriverconfig.h)
16INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})16INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
1717
18ZORBA_GENERATE_EXE("parsertestdriver" "parsertestdriver.cpp" "" "" "")18#ZORBA_GENERATE_EXE("parsertestdriver" "parsertestdriver.cpp" "" "" "")
1919
20# collect all queries (suffix .xq) in all subdirectories of the Queries dir20# collect all queries (suffix .xq) in all subdirectories of the Queries dir
21FILE(GLOB_RECURSE TESTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/Queries/ *.xq)21#FILE(GLOB_RECURSE TESTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/Queries/ *.xq)
2222
23MESSAGE(STATUS "Adding parser tests for CTest")23#MESSAGE(STATUS "Adding parser tests for CTest")
2424
25FOREACH(TESTFILE ${TESTFILES})25FOREACH(TESTFILE ${TESTFILES})
26 STRING(LENGTH ${TESTFILE} TESTFILELENGTH)26 STRING(LENGTH ${TESTFILE} TESTFILELENGTH)
2727
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_dynamic_zorba_collection.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_dynamic_zorba_collection.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_dynamic_zorba_collection.iter 2012-12-06 22:51:20 +0000
@@ -6,19 +6,11 @@
6 <SequentialIterator>6 <SequentialIterator>
7 <ApplyIterator>7 <ApplyIterator>
8 <ZorbaCreateCollectionIterator>8 <ZorbaCreateCollectionIterator>
9 <PromoteIterator type="xs:QName">9 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
10 <FnDataIterator>
11 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
12 </FnDataIterator>
13 </PromoteIterator>
14 </ZorbaCreateCollectionIterator>10 </ZorbaCreateCollectionIterator>
15 </ApplyIterator>11 </ApplyIterator>
16 <CountCollectionIterator>12 <CountCollectionIterator>
17 <PromoteIterator type="xs:QName">13 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
18 <FnDataIterator>
19 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
20 </FnDataIterator>
21 </PromoteIterator>
22 </CountCollectionIterator>14 </CountCollectionIterator>
23 </SequentialIterator>15 </SequentialIterator>
24</SequentialIterator>16</SequentialIterator>
2517
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_static_zorba_collection.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_static_zorba_collection.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_static_zorba_collection.iter 2012-12-06 22:51:20 +0000
@@ -24,19 +24,11 @@
24 <SequentialIterator>24 <SequentialIterator>
25 <ApplyIterator>25 <ApplyIterator>
26 <ZorbaCreateCollectionIterator>26 <ZorbaCreateCollectionIterator>
27 <PromoteIterator type="xs:QName">27 <CtxVarIterator varid="10" varname="coll" varkind="global"/>
28 <FnDataIterator>
29 <CtxVarIterator varid="10" varname="coll" varkind="global"/>
30 </FnDataIterator>
31 </PromoteIterator>
32 </ZorbaCreateCollectionIterator>28 </ZorbaCreateCollectionIterator>
33 </ApplyIterator>29 </ApplyIterator>
34 <CountCollectionIterator>30 <CountCollectionIterator>
35 <PromoteIterator type="xs:QName">31 <CtxVarIterator varid="10" varname="coll" varkind="global"/>
36 <FnDataIterator>
37 <CtxVarIterator varid="10" varname="coll" varkind="global"/>
38 </FnDataIterator>
39 </PromoteIterator>
40 </CountCollectionIterator>32 </CountCollectionIterator>
41 </SequentialIterator>33 </SequentialIterator>
42</SequentialIterator>34</SequentialIterator>
4335
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_w3c_collection.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_w3c_collection.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/collections/count_w3c_collection.iter 2012-12-06 22:51:20 +0000
@@ -6,19 +6,11 @@
6 <SequentialIterator>6 <SequentialIterator>
7 <ApplyIterator>7 <ApplyIterator>
8 <UDFunctionCallIterator>8 <UDFunctionCallIterator>
9 <PromoteIterator type="xs:string">9 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
10 <FnDataIterator>
11 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
12 </FnDataIterator>
13 </PromoteIterator>
14 </UDFunctionCallIterator>10 </UDFunctionCallIterator>
15 </ApplyIterator>11 </ApplyIterator>
16 <CountCollectionIterator>12 <CountCollectionIterator>
17 <PromoteIterator type="xs:string">13 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
18 <FnDataIterator>
19 <CtxVarIterator varid="4" varname="coll" varkind="global"/>
20 </FnDataIterator>
21 </PromoteIterator>
22 </CountCollectionIterator>14 </CountCollectionIterator>
23 </SequentialIterator>15 </SequentialIterator>
24</SequentialIterator>16</SequentialIterator>
2517
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx1.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx1.iter 2012-09-19 21:16:15 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx1.iter 2012-12-06 22:51:20 +0000
@@ -28,17 +28,15 @@
28 <ReturnClause>28 <ReturnClause>
29 <ValueIndexEntryBuilderIterator>29 <ValueIndexEntryBuilderIterator>
30 <ForVarIterator varname="$$opt_temp_3"/>30 <ForVarIterator varname="$$opt_temp_3"/>
31 <CastIterator type="xs:string">31 <PromoteIterator type="xs:anyAtomicType">
32 <PromoteIterator type="xs:anyAtomicType">32 <FnDataIterator>
33 <FnDataIterator>33 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">
34 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">34 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">
35 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">35 <ForVarIterator varname="$$opt_temp_3"/>
36 <ForVarIterator varname="$$opt_temp_3"/>36 </ChildAxisIterator>
37 </ChildAxisIterator>37 </AttributeAxisIterator>
38 </AttributeAxisIterator>38 </FnDataIterator>
39 </FnDataIterator>39 </PromoteIterator>
40 </PromoteIterator>
41 </CastIterator>
42 </ValueIndexEntryBuilderIterator>40 </ValueIndexEntryBuilderIterator>
43 </ReturnClause>41 </ReturnClause>
44 </flwor::FLWORIterator>42 </flwor::FLWORIterator>
@@ -66,13 +64,11 @@
66 </LetVariable>64 </LetVariable>
67 <LetVariable name="$$opt_temp_1" materialize="true">65 <LetVariable name="$$opt_temp_1" materialize="true">
68 <HoistIterator>66 <HoistIterator>
69 <CastIterator type="xs:string">67 <FnDataIterator>
70 <FnDataIterator>68 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">
71 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">69 <ForVarIterator varname="p"/>
72 <ForVarIterator varname="p"/>70 </AttributeAxisIterator>
73 </AttributeAxisIterator>71 </FnDataIterator>
74 </FnDataIterator>
75 </CastIterator>
76 </HoistIterator>72 </HoistIterator>
77 </LetVariable>73 </LetVariable>
78 <ForVariable name="a">74 <ForVariable name="a">
7975
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx2.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx2.iter 2012-09-19 21:16:15 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx2.iter 2012-12-06 22:51:20 +0000
@@ -36,13 +36,11 @@
36 </LetVariable>36 </LetVariable>
37 <LetVariable name="$$opt_temp_1" materialize="true">37 <LetVariable name="$$opt_temp_1" materialize="true">
38 <HoistIterator>38 <HoistIterator>
39 <CastIterator type="xs:string">39 <FnDataIterator>
40 <FnDataIterator>40 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">
41 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">41 <ForVarIterator varname="p"/>
42 <ForVarIterator varname="p"/>42 </AttributeAxisIterator>
43 </AttributeAxisIterator>43 </FnDataIterator>
44 </FnDataIterator>
45 </CastIterator>
46 </HoistIterator>44 </HoistIterator>
47 </LetVariable>45 </LetVariable>
48 <ForVariable name="a">46 <ForVariable name="a">
@@ -58,17 +56,15 @@
58 <WhereClause>56 <WhereClause>
59 <FnBooleanIterator>57 <FnBooleanIterator>
60 <TypedValueCompareIterator_STRING>58 <TypedValueCompareIterator_STRING>
61 <CastIterator type="xs:string">59 <PromoteIterator type="xs:anyAtomicType">
62 <PromoteIterator type="xs:anyAtomicType">60 <FnDataIterator>
63 <FnDataIterator>61 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">
64 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">62 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">
65 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">63 <ForVarIterator varname="t"/>
66 <ForVarIterator varname="t"/>64 </ChildAxisIterator>
67 </ChildAxisIterator>65 </AttributeAxisIterator>
68 </AttributeAxisIterator>66 </FnDataIterator>
69 </FnDataIterator>67 </PromoteIterator>
70 </PromoteIterator>
71 </CastIterator>
72 <UnhoistIterator>68 <UnhoistIterator>
73 <LetVarIterator varname="$$opt_temp_1"/>69 <LetVarIterator varname="$$opt_temp_1"/>
74 </UnhoistIterator>70 </UnhoistIterator>
7571
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter 2012-12-06 22:51:20 +0000
@@ -19,94 +19,40 @@
19 <SingletonIterator value="xs:QName(,,tests)"/>19 <SingletonIterator value="xs:QName(,,tests)"/>
20 </ElementIterator>20 </ElementIterator>
21 </CtxVarDeclareIterator>21 </CtxVarDeclareIterator>
22 <SequentialIterator>22 <flwor::FLWORIterator>
23 <CreateInternalIndexIterator name="xs:QName(,,tempIndex0)">23 <LetVariable name="test_old" materialize="true">
24 <flwor::FLWORIterator>24 <flwor::FLWORIterator>
25 <ForVariable name="$$opt_temp_2">25 <ForVariable name="$$context-item">
26 <CtxVarIterator varid="4" varname="tests" varkind="global"/>26 <CtxVarIterator varid="4" varname="tests" varkind="global"/>
27 </ForVariable>27 </ForVariable>
28 <WhereClause>
29 <FnBooleanIterator>
30 <TypedValueCompareIterator_STRING>
31 <PromoteIterator type="xs:anyAtomicType">
32 <FnDataIterator>
33 <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
34 <ForVarIterator varname="$$context-item"/>
35 </ChildAxisIterator>
36 </FnDataIterator>
37 </PromoteIterator>
38 <PromoteIterator type="xs:anyAtomicType">
39 <FnDataIterator>
40 <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
41 <CtxVarIterator varid="4" varname="tests" varkind="global"/>
42 </ChildAxisIterator>
43 </FnDataIterator>
44 </PromoteIterator>
45 </TypedValueCompareIterator_STRING>
46 </FnBooleanIterator>
47 </WhereClause>
28 <ReturnClause>48 <ReturnClause>
29 <ValueIndexEntryBuilderIterator>49 <ForVarIterator varname="$$context-item"/>
30 <ForVarIterator varname="$$opt_temp_2"/>
31 <CastIterator type="xs:string">
32 <PromoteIterator type="xs:anyAtomicType">
33 <FnDataIterator>
34 <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
35 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">
36 <ForVarIterator varname="$$opt_temp_2"/>
37 </TreatIterator>
38 </ChildAxisIterator>
39 </FnDataIterator>
40 </PromoteIterator>
41 </CastIterator>
42 </ValueIndexEntryBuilderIterator>
43 </ReturnClause>50 </ReturnClause>
44 </flwor::FLWORIterator>51 </flwor::FLWORIterator>
45 </CreateInternalIndexIterator>52 </LetVariable>
46 <flwor::FLWORIterator>53 <ReturnClause>
47 <LetVariable name="$$opt_temp_1" materialize="true">54 <SingletonIterator value="xs:integer(1)"/>
48 <HoistIterator>55 </ReturnClause>
49 <flwor::FLWORIterator>56 </flwor::FLWORIterator>
50 <ForVariable name="$$context-item">
51 <CtxVarIterator varid="4" varname="tests" varkind="global"/>
52 </ForVariable>
53 <WhereClause>
54 <FnBooleanIterator>
55 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,name)" typename="*" nill allowed="0">
56 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">
57 <ForVarIterator varname="$$context-item"/>
58 </TreatIterator>
59 </AttributeAxisIterator>
60 </FnBooleanIterator>
61 </WhereClause>
62 <ReturnClause>
63 <ForVarIterator varname="$$context-item"/>
64 </ReturnClause>
65 </flwor::FLWORIterator>
66 </HoistIterator>
67 </LetVariable>
68 <ForVariable name="test">
69 <CtxVarIterator varid="4" varname="tests" varkind="global"/>
70 </ForVariable>
71 <LetVariable name="$$opt_temp_0" materialize="true">
72 <HoistIterator>
73 <CastIterator type="xs:string">
74 <PromoteIterator type="xs:anyAtomicType">
75 <FnDataIterator>
76 <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
77 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">
78 <ForVarIterator varname="test"/>
79 </TreatIterator>
80 </ChildAxisIterator>
81 </FnDataIterator>
82 </PromoteIterator>
83 </CastIterator>
84 </HoistIterator>
85 </LetVariable>
86 <LetVariable name="test_old" materialize="true">
87 <flwor::FLWORIterator>
88 <ForVariable name="$$context-item">
89 <ProbeIndexPointValueIterator>
90 <SingletonIterator value="xs:QName(,,tempIndex0)"/>
91 <UnhoistIterator>
92 <LetVarIterator varname="$$opt_temp_0"/>
93 </UnhoistIterator>
94 </ProbeIndexPointValueIterator>
95 </ForVariable>
96 <ReturnClause>
97 <ForVarIterator varname="$$context-item"/>
98 </ReturnClause>
99 </flwor::FLWORIterator>
100 </LetVariable>
101 <LetVariable name="qt_old" materialize="true">
102 <UnhoistIterator>
103 <LetVarIterator varname="$$opt_temp_1"/>
104 </UnhoistIterator>
105 </LetVariable>
106 <ReturnClause>
107 <SingletonIterator value="xs:integer(1)"/>
108 </ReturnClause>
109 </flwor::FLWORIterator>
110 </SequentialIterator>
111</SequentialIterator>57</SequentialIterator>
11258
11359
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter 2012-12-06 22:51:20 +0000
@@ -46,16 +46,8 @@
46 <SequentialIterator>46 <SequentialIterator>
47 <ApplyIterator>47 <ApplyIterator>
48 <MapCreateIterator>48 <MapCreateIterator>
49 <PromoteIterator type="xs:QName">49 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
50 <FnDataIterator>50 <CtxVarIterator varid="6" varname="str" varkind="global"/>
51 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
52 </FnDataIterator>
53 </PromoteIterator>
54 <PromoteIterator type="xs:QName">
55 <FnDataIterator>
56 <CtxVarIterator varid="6" varname="str" varkind="global"/>
57 </FnDataIterator>
58 </PromoteIterator>
59 </MapCreateIterator>51 </MapCreateIterator>
60 </ApplyIterator>52 </ApplyIterator>
61 <CtxVarDeclareIterator varid="8" varname="DG">53 <CtxVarDeclareIterator varid="8" varname="DG">
@@ -69,11 +61,7 @@
69 </CtxVarDeclareIterator>61 </CtxVarDeclareIterator>
70 <ApplyIterator>62 <ApplyIterator>
71 <MapDestroyIterator>63 <MapDestroyIterator>
72 <PromoteIterator type="xs:QName">64 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
73 <FnDataIterator>
74 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
75 </FnDataIterator>
76 </PromoteIterator>
77 </MapDestroyIterator>65 </MapDestroyIterator>
78 </ApplyIterator>66 </ApplyIterator>
79 <CtxVarIterator varid="8" varname="DG" varkind="local"/>67 <CtxVarIterator varid="8" varname="DG" varkind="local"/>
@@ -195,11 +183,7 @@
195 <CtxVarAssignIterator varid="1" varname="label" varkind="local">183 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
196 <TreatIterator type="xs:integer" quant="?">184 <TreatIterator type="xs:integer" quant="?">
197 <MapGetIterator>185 <MapGetIterator>
198 <PromoteIterator type="xs:QName">186 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
199 <FnDataIterator>
200 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
201 </FnDataIterator>
202 </PromoteIterator>
203 <PromoteIterator type="xs:anyAtomicType">187 <PromoteIterator type="xs:anyAtomicType">
204 <FnDataIterator>188 <FnDataIterator>
205 <CtxVarIterator varid="4" varname="s2" varkind="local"/>189 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
@@ -224,11 +208,7 @@
224 </CtxVarAssignIterator>208 </CtxVarAssignIterator>
225 <ApplyIterator>209 <ApplyIterator>
226 <MapInsertIterator>210 <MapInsertIterator>
227 <PromoteIterator type="xs:QName">211 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
228 <FnDataIterator>
229 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
230 </FnDataIterator>
231 </PromoteIterator>
232 <CtxVarIterator varid="4" varname="co" varkind="global"/>212 <CtxVarIterator varid="4" varname="co" varkind="global"/>
233 <PromoteIterator type="xs:anyAtomicType">213 <PromoteIterator type="xs:anyAtomicType">
234 <FnDataIterator>214 <FnDataIterator>
235215
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter 2012-12-06 22:51:20 +0000
@@ -46,16 +46,8 @@
46 <SequentialIterator>46 <SequentialIterator>
47 <ApplyIterator>47 <ApplyIterator>
48 <MapCreateIterator>48 <MapCreateIterator>
49 <PromoteIterator type="xs:QName">49 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
50 <FnDataIterator>50 <CtxVarIterator varid="6" varname="str" varkind="global"/>
51 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
52 </FnDataIterator>
53 </PromoteIterator>
54 <PromoteIterator type="xs:QName">
55 <FnDataIterator>
56 <CtxVarIterator varid="6" varname="str" varkind="global"/>
57 </FnDataIterator>
58 </PromoteIterator>
59 </MapCreateIterator>51 </MapCreateIterator>
60 </ApplyIterator>52 </ApplyIterator>
61 <CtxVarDeclareIterator varid="8" varname="DG">53 <CtxVarDeclareIterator varid="8" varname="DG">
@@ -69,11 +61,7 @@
69 </CtxVarDeclareIterator>61 </CtxVarDeclareIterator>
70 <ApplyIterator>62 <ApplyIterator>
71 <MapDestroyIterator>63 <MapDestroyIterator>
72 <PromoteIterator type="xs:QName">64 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
73 <FnDataIterator>
74 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
75 </FnDataIterator>
76 </PromoteIterator>
77 </MapDestroyIterator>65 </MapDestroyIterator>
78 </ApplyIterator>66 </ApplyIterator>
79 <CtxVarIterator varid="8" varname="DG" varkind="local"/>67 <CtxVarIterator varid="8" varname="DG" varkind="local"/>
@@ -195,11 +183,7 @@
195 <CtxVarAssignIterator varid="1" varname="label" varkind="local">183 <CtxVarAssignIterator varid="1" varname="label" varkind="local">
196 <TreatIterator type="xs:integer" quant="?">184 <TreatIterator type="xs:integer" quant="?">
197 <MapGetIterator>185 <MapGetIterator>
198 <PromoteIterator type="xs:QName">186 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
199 <FnDataIterator>
200 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
201 </FnDataIterator>
202 </PromoteIterator>
203 <PromoteIterator type="xs:anyAtomicType">187 <PromoteIterator type="xs:anyAtomicType">
204 <FnDataIterator>188 <FnDataIterator>
205 <CtxVarIterator varid="4" varname="s2" varkind="local"/>189 <CtxVarIterator varid="4" varname="s2" varkind="local"/>
@@ -224,11 +208,7 @@
224 </CtxVarAssignIterator>208 </CtxVarAssignIterator>
225 <ApplyIterator>209 <ApplyIterator>
226 <MapInsertIterator>210 <MapInsertIterator>
227 <PromoteIterator type="xs:QName">211 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
228 <FnDataIterator>
229 <CtxVarIterator varid="5" varname="map1" varkind="global"/>
230 </FnDataIterator>
231 </PromoteIterator>
232 <CtxVarIterator varid="4" varname="co" varkind="global"/>212 <CtxVarIterator varid="4" varname="co" varkind="global"/>
233 <PromoteIterator type="xs:anyAtomicType">213 <PromoteIterator type="xs:anyAtomicType">
234 <FnDataIterator>214 <FnDataIterator>
235215
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx1.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx1.iter 2012-09-19 21:16:15 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx1.iter 2012-12-06 22:51:20 +0000
@@ -28,17 +28,15 @@
28 <ReturnClause>28 <ReturnClause>
29 <ValueIndexEntryBuilderIterator>29 <ValueIndexEntryBuilderIterator>
30 <ForVarIterator varname="$$opt_temp_3"/>30 <ForVarIterator varname="$$opt_temp_3"/>
31 <CastIterator type="xs:string">31 <PromoteIterator type="xs:anyAtomicType">
32 <PromoteIterator type="xs:anyAtomicType">32 <FnDataIterator>
33 <FnDataIterator>33 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">
34 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">34 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">
35 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,buyer)" typename="*" nill allowed="0">35 <ForVarIterator varname="$$opt_temp_3"/>
36 <ForVarIterator varname="$$opt_temp_3"/>36 </ChildAxisIterator>
37 </ChildAxisIterator>37 </AttributeAxisIterator>
38 </AttributeAxisIterator>38 </FnDataIterator>
39 </FnDataIterator>39 </PromoteIterator>
40 </PromoteIterator>
41 </CastIterator>
42 </ValueIndexEntryBuilderIterator>40 </ValueIndexEntryBuilderIterator>
43 </ReturnClause>41 </ReturnClause>
44 </flwor::FLWORIterator>42 </flwor::FLWORIterator>
@@ -66,13 +64,11 @@
66 </LetVariable>64 </LetVariable>
67 <LetVariable name="$$opt_temp_1" materialize="true">65 <LetVariable name="$$opt_temp_1" materialize="true">
68 <HoistIterator>66 <HoistIterator>
69 <CastIterator type="xs:string">67 <FnDataIterator>
70 <FnDataIterator>68 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">
71 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,id)" typename="*" nill allowed="0">69 <ForVarIterator varname="p"/>
72 <ForVarIterator varname="p"/>70 </AttributeAxisIterator>
73 </AttributeAxisIterator>71 </FnDataIterator>
74 </FnDataIterator>
75 </CastIterator>
76 </HoistIterator>72 </HoistIterator>
77 </LetVariable>73 </LetVariable>
78 <ForVariable name="a">74 <ForVariable name="a">
7975
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-01.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-01.iter 2012-10-05 08:48:49 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-01.iter 2012-12-06 22:51:20 +0000
@@ -20,13 +20,9 @@
20 <SingletonIterator value="xs:QName(,,node)"/>20 <SingletonIterator value="xs:QName(,,node)"/>
21 <FnConcatIterator/>21 <FnConcatIterator/>
22 <EnclosedIterator attr_cont="false">22 <EnclosedIterator attr_cont="false">
23 <NodeSortIterator distinct="true" ascending="true">23 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">
24 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">24 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
25 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">25 </ChildAxisIterator>
26 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
27 </TreatIterator>
28 </ChildAxisIterator>
29 </NodeSortIterator>
30 </EnclosedIterator>26 </EnclosedIterator>
31 </ElementIterator>27 </ElementIterator>
32 </ChildAxisIterator>28 </ChildAxisIterator>
3329
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-02.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-02.iter 2012-10-05 08:48:49 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-02.iter 2012-12-06 22:51:20 +0000
@@ -1,12 +1,12 @@
1Iterator tree for main query:1Iterator tree for main query:
2<SequentialIterator>2<SequentialIterator>
3 <CtxVarDeclareIterator varid="4" varname="doc">3 <CtxVarDeclareIterator varid="4" varname="doc">
4 <ElementIterator>4 <ElementIterator copyInputNodes="false">
5 <SingletonIterator value="xs:QName(,,a)"/>5 <SingletonIterator value="xs:QName(,,a)"/>
6 <FnConcatIterator/>6 <FnConcatIterator/>
7 <ElementIterator>7 <ElementIterator copyInputNodes="false">
8 <SingletonIterator value="xs:QName(,,b)"/>8 <SingletonIterator value="xs:QName(,,b)"/>
9 <ElementIterator>9 <ElementIterator copyInputNodes="false">
10 <SingletonIterator value="xs:QName(,,c)"/>10 <SingletonIterator value="xs:QName(,,c)"/>
11 </ElementIterator>11 </ElementIterator>
12 </ElementIterator>12 </ElementIterator>
@@ -20,13 +20,9 @@
20 <SingletonIterator value="xs:QName(,,node)"/>20 <SingletonIterator value="xs:QName(,,node)"/>
21 <FnConcatIterator/>21 <FnConcatIterator/>
22 <EnclosedIterator attr_cont="false">22 <EnclosedIterator attr_cont="false">
23 <NodeSortIterator distinct="true" ascending="true">23 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">
24 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">24 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
25 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">25 </ChildAxisIterator>
26 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
27 </TreatIterator>
28 </ChildAxisIterator>
29 </NodeSortIterator>
30 </EnclosedIterator>26 </EnclosedIterator>
31 </ElementIterator>27 </ElementIterator>
32 </ChildAxisIterator>28 </ChildAxisIterator>
3329
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-03.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-03.iter 2012-10-05 08:48:49 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/node-copy-03.iter 2012-12-06 22:51:20 +0000
@@ -1,12 +1,12 @@
1Iterator tree for main query:1Iterator tree for main query:
2<SequentialIterator>2<SequentialIterator>
3 <CtxVarDeclareIterator varid="4" varname="doc">3 <CtxVarDeclareIterator varid="4" varname="doc">
4 <ElementIterator>4 <ElementIterator copyInputNodes="false">
5 <SingletonIterator value="xs:QName(,,a)"/>5 <SingletonIterator value="xs:QName(,,a)"/>
6 <FnConcatIterator/>6 <FnConcatIterator/>
7 <ElementIterator>7 <ElementIterator copyInputNodes="false">
8 <SingletonIterator value="xs:QName(,,b)"/>8 <SingletonIterator value="xs:QName(,,b)"/>
9 <ElementIterator>9 <ElementIterator copyInputNodes="false">
10 <SingletonIterator value="xs:QName(,,c)"/>10 <SingletonIterator value="xs:QName(,,c)"/>
11 </ElementIterator>11 </ElementIterator>
12 </ElementIterator>12 </ElementIterator>
@@ -20,13 +20,9 @@
20 <SingletonIterator value="xs:QName(,,node)"/>20 <SingletonIterator value="xs:QName(,,node)"/>
21 <FnConcatIterator/>21 <FnConcatIterator/>
22 <EnclosedIterator attr_cont="false">22 <EnclosedIterator attr_cont="false">
23 <NodeSortIterator distinct="true" ascending="true">23 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">
24 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,b)" typename="*" nill allowed="0">24 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
25 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">25 </ChildAxisIterator>
26 <CtxVarIterator varid="4" varname="doc" varkind="global"/>
27 </TreatIterator>
28 </ChildAxisIterator>
29 </NodeSortIterator>
30 </EnclosedIterator>26 </EnclosedIterator>
31 </ElementIterator>27 </ElementIterator>
32 </ChildAxisIterator>28 </ChildAxisIterator>
3329
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/positioned-access.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/positioned-access.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/positioned-access.iter 2012-12-06 22:51:20 +0000
@@ -17,11 +17,7 @@
17 <FunctionTraceIterator>17 <FunctionTraceIterator>
18 <flwor::FLWORIterator>18 <flwor::FLWORIterator>
19 <LetVariable name="x" materialize="true">19 <LetVariable name="x" materialize="true">
20 <PromoteIterator type="xs:integer">20 <CtxVarIterator varid="4" varname="n1" varkind="global"/>
21 <FnDataIterator>
22 <CtxVarIterator varid="4" varname="n1" varkind="global"/>
23 </FnDataIterator>
24 </PromoteIterator>
25 </LetVariable>21 </LetVariable>
26 <ReturnClause>22 <ReturnClause>
27 <LetVarIterator varname="x">23 <LetVarIterator varname="x">
@@ -35,11 +31,7 @@
35 <FunctionTraceIterator>31 <FunctionTraceIterator>
36 <flwor::FLWORIterator>32 <flwor::FLWORIterator>
37 <LetVariable name="x" materialize="true">33 <LetVariable name="x" materialize="true">
38 <PromoteIterator type="xs:integer">34 <CtxVarIterator varid="5" varname="n2" varkind="global"/>
39 <FnDataIterator>
40 <CtxVarIterator varid="5" varname="n2" varkind="global"/>
41 </FnDataIterator>
42 </PromoteIterator>
43 </LetVariable>35 </LetVariable>
44 <ReturnClause>36 <ReturnClause>
45 <LetVarIterator varname="x">37 <LetVarIterator varname="x">
4638
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_inline_01.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_inline_01.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_inline_01.iter 2012-12-06 22:51:20 +0000
@@ -17,47 +17,32 @@
17 <SingletonIterator value="xs:integer(2)"/>17 <SingletonIterator value="xs:integer(2)"/>
18 </NumArithIterator_ModOperation>18 </NumArithIterator_ModOperation>
19 </ForVariable>19 </ForVariable>
20 <LetVariable name="foo" materialize="true">20 <ForVariable name="foo">
21 <CtxVarIterator varid="4" varname="g" varkind="global"/>21 <CtxVarIterator varid="4" varname="g" varkind="global"/>
22 </LetVariable>22 </ForVariable>
23 <LetVariable name="$$opt_temp_0" materialize="true">
24 <HoistIterator>
25 <PromoteIterator type="xs:anyAtomicType">
26 <FnDataIterator>
27 <LetVarIterator varname="foo"/>
28 </FnDataIterator>
29 </PromoteIterator>
30 </HoistIterator>
31 </LetVariable>
32 <WhereClause>23 <WhereClause>
33 <CompareIterator>24 <TypedValueCompareIterator_INTEGER>
34 <FnSumIterator>25 <FnSumIntegerIterator>
35 <flwor::FLWORIterator>26 <flwor::FLWORIterator>
36 <ForVariable name="z">27 <ForVariable name="z">
37 <FnConcatIterator>28 <FnConcatIterator>
38 <SingletonIterator value="xs:integer(5)"/>29 <SingletonIterator value="xs:integer(5)"/>
39 <LetVarIterator varname="foo"/>30 <ForVarIterator varname="foo"/>
40 </FnConcatIterator>31 </FnConcatIterator>
41 </ForVariable>32 </ForVariable>
42 <ReturnClause>33 <ReturnClause>
43 <GenericArithIterator_AddOperation>34 <SpecificNumArithIterator_AddOperation_INTEGER>
44 <GenericArithIterator_MultiplyOperation>35 <SpecificNumArithIterator_MultiplyOperation_INTEGER>
45 <PromoteIterator type="xs:anyAtomicType">36 <ForVarIterator varname="z"/>
46 <FnDataIterator>
47 <ForVarIterator varname="z"/>
48 </FnDataIterator>
49 </PromoteIterator>
50 <ForVarIterator varname="y"/>37 <ForVarIterator varname="y"/>
51 </GenericArithIterator_MultiplyOperation>38 </SpecificNumArithIterator_MultiplyOperation_INTEGER>
52 <UnhoistIterator>39 <ForVarIterator varname="foo"/>
53 <LetVarIterator varname="$$opt_temp_0"/>40 </SpecificNumArithIterator_AddOperation_INTEGER>
54 </UnhoistIterator>
55 </GenericArithIterator_AddOperation>
56 </ReturnClause>41 </ReturnClause>
57 </flwor::FLWORIterator>42 </flwor::FLWORIterator>
58 </FnSumIterator>43 </FnSumIntegerIterator>
59 <SingletonIterator value="xs:integer(8)"/>44 <SingletonIterator value="xs:integer(8)"/>
60 </CompareIterator>45 </TypedValueCompareIterator_INTEGER>
61 </WhereClause>46 </WhereClause>
62 <ReturnClause>47 <ReturnClause>
63 <ForVarIterator varname="x"/>48 <ForVarIterator varname="x"/>
6449
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf1.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf1.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf1.iter 2012-12-06 22:51:20 +0000
@@ -31,11 +31,7 @@
31 </ElementIterator>31 </ElementIterator>
32 </DescendantAxisIterator>32 </DescendantAxisIterator>
33 </ChildAxisIterator>33 </ChildAxisIterator>
34 <PromoteIterator type="xs:integer">34 <CtxVarIterator varid="4" varname="x" varkind="global"/>
35 <FnDataIterator>
36 <CtxVarIterator varid="4" varname="x" varkind="global"/>
37 </FnDataIterator>
38 </PromoteIterator>
39 </UDFunctionCallIterator>35 </UDFunctionCallIterator>
40</SequentialIterator>36</SequentialIterator>
4137
4238
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q10.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q10.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q10.iter 2012-12-06 22:51:20 +0000
@@ -32,13 +32,9 @@
32 <NodeSortIterator distinct="true" ascending="true">32 <NodeSortIterator distinct="true" ascending="true">
33 <flwor::FLWORIterator>33 <flwor::FLWORIterator>
34 <ForVariable name="$$context-item">34 <ForVariable name="$$context-item">
35 <NodeDistinctIterator allow-atomics="false" check-only="false">35 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">
36 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">36 <CtxVarIterator varid="4" varname="seq" varkind="global"/>
37 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">37 </ChildAxisIterator>
38 <CtxVarIterator varid="4" varname="seq" varkind="global"/>
39 </TreatIterator>
40 </ChildAxisIterator>
41 </NodeDistinctIterator>
42 </ForVariable>38 </ForVariable>
43 <ForVariable name="$$context-item">39 <ForVariable name="$$context-item">
44 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">40 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">
@@ -47,7 +43,7 @@
47 </ForVariable>43 </ForVariable>
48 <WhereClause>44 <WhereClause>
49 <FnBooleanIterator>45 <FnBooleanIterator>
50 <CompareIterator>46 <TypedValueCompareIterator_STRING>
51 <PromoteIterator type="xs:anyAtomicType">47 <PromoteIterator type="xs:anyAtomicType">
52 <FnDataIterator>48 <FnDataIterator>
53 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">49 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">
@@ -56,7 +52,7 @@
56 </FnDataIterator>52 </FnDataIterator>
57 </PromoteIterator>53 </PromoteIterator>
58 <SingletonIterator value="xs:string(in)"/>54 <SingletonIterator value="xs:string(in)"/>
59 </CompareIterator>55 </TypedValueCompareIterator_STRING>
60 </FnBooleanIterator>56 </FnBooleanIterator>
61 </WhereClause>57 </WhereClause>
62 <ReturnClause>58 <ReturnClause>
@@ -100,7 +96,7 @@
100 </ForVariable>96 </ForVariable>
101 <WhereClause>97 <WhereClause>
102 <FnBooleanIterator>98 <FnBooleanIterator>
103 <CompareIterator>99 <TypedValueCompareIterator_STRING>
104 <PromoteIterator type="xs:anyAtomicType">100 <PromoteIterator type="xs:anyAtomicType">
105 <FnDataIterator>101 <FnDataIterator>
106 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">102 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">
@@ -109,7 +105,7 @@
109 </FnDataIterator>105 </FnDataIterator>
110 </PromoteIterator>106 </PromoteIterator>
111 <SingletonIterator value="xs:string(Barbara)"/>107 <SingletonIterator value="xs:string(Barbara)"/>
112 </CompareIterator>108 </TypedValueCompareIterator_STRING>
113 </FnBooleanIterator>109 </FnBooleanIterator>
114 </WhereClause>110 </WhereClause>
115 <ReturnClause>111 <ReturnClause>
116112
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q4.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q4.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q4.iter 2012-12-06 22:51:20 +0000
@@ -1,6 +1,11 @@
1Iterator tree for const-folded expr:1Iterator tree for const-folded expr:
2<SingletonIterator value="xs:integer(2)"/>2<SingletonIterator value="xs:integer(2)"/>
33
4Iterator tree for const-folded expr:
5<PromoteIterator type="xs:double">
6 <SingletonIterator value="xs:integer(2)"/>
7</PromoteIterator>
8
4Iterator tree for main query:9Iterator tree for main query:
5<SequentialIterator>10<SequentialIterator>
6 <CtxVarDeclareIterator varid="4" varname="timesequence">11 <CtxVarDeclareIterator varid="4" varname="timesequence">
@@ -11,60 +16,52 @@
11 <flwor::TupleStreamIterator>16 <flwor::TupleStreamIterator>
12 <flwor::WindowIterator>17 <flwor::WindowIterator>
13 <WindowVariable name="w">18 <WindowVariable name="w">
14 <NodeSortIterator distinct="true" ascending="true">19 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">
15 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">20 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">
16 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">21 <CtxVarIterator varid="4" varname="timesequence" varkind="global"/>
17 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">
18 <CtxVarIterator varid="4" varname="timesequence" varkind="global"/>
19 </TreatIterator>
20 </ChildAxisIterator>
21 </ChildAxisIterator>22 </ChildAxisIterator>
22 </NodeSortIterator>23 </ChildAxisIterator>
23 </WindowVariable>24 </WindowVariable>
24 <WinCondVariable name="start-CurrentIn"/>25 <WinCondVariable name="start-CurrentIn"/>
25 <WinCondVariable name="start-CurrentInPrevIn"/>26 <WinCondVariable name="start-CurrentInPrevIn"/>
26 <OrIterator>27 <OrIterator>
27 <CompareIterator>28 <TypedValueCompareIterator_STRING>
28 <PromoteIterator type="xs:anyAtomicType">29 <FnDataIterator>
29 <FnDataIterator>30 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">
30 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">31 <ForVarIterator varname="s_curr"/>
31 <ForVarIterator varname="s_curr"/>32 </AttributeAxisIterator>
32 </AttributeAxisIterator>33 </FnDataIterator>
33 </FnDataIterator>34 <FnDataIterator>
34 </PromoteIterator>35 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">
35 <PromoteIterator type="xs:anyAtomicType">36 <ForVarIterator varname="s_prev"/>
36 <FnDataIterator>37 </AttributeAxisIterator>
37 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">38 </FnDataIterator>
38 <ForVarIterator varname="s_prev"/>39 </TypedValueCompareIterator_STRING>
39 </AttributeAxisIterator>
40 </FnDataIterator>
41 </PromoteIterator>
42 </CompareIterator>
43 <FnEmptyIterator>40 <FnEmptyIterator>
44 <ForVarIterator varname="s_prev"/>41 <ForVarIterator varname="s_prev"/>
45 </FnEmptyIterator>42 </FnEmptyIterator>
46 </OrIterator>43 </OrIterator>
47 <WinCondVariable name="end-NextIn"/>44 <WinCondVariable name="end-NextIn"/>
48 <FnBooleanIterator>45 <FnBooleanIterator>
49 <CompareIterator>46 <TypedValueCompareIterator_DOUBLE>
50 <GenericArithIterator_SubtractOperation>47 <SpecificNumArithIterator_SubtractOperation_DOUBLE>
51 <PromoteIterator type="xs:anyAtomicType">48 <PromoteIterator type="xs:double">
52 <FnDataIterator>49 <FnDataIterator>
53 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">50 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">
54 <ForVarIterator varname="e_next"/>51 <ForVarIterator varname="e_next"/>
55 </AttributeAxisIterator>52 </AttributeAxisIterator>
56 </FnDataIterator>53 </FnDataIterator>
57 </PromoteIterator>54 </PromoteIterator>
58 <PromoteIterator type="xs:anyAtomicType">55 <PromoteIterator type="xs:double">
59 <FnDataIterator>56 <FnDataIterator>
60 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">57 <AttributeAxisIterator test kind="match_name_test" qname="xs:QName(,,time)" typename="*" nill allowed="0">
61 <ForVarIterator varname="s_curr"/>58 <ForVarIterator varname="s_curr"/>
62 </AttributeAxisIterator>59 </AttributeAxisIterator>
63 </FnDataIterator>60 </FnDataIterator>
64 </PromoteIterator>61 </PromoteIterator>
65 </GenericArithIterator_SubtractOperation>62 </SpecificNumArithIterator_SubtractOperation_DOUBLE>
66 <SingletonIterator value="xs:integer(2)"/>63 <SingletonIterator value="xs:double(2)"/>
67 </CompareIterator>64 </TypedValueCompareIterator_DOUBLE>
68 </FnBooleanIterator>65 </FnBooleanIterator>
69 <flwor::TupleSourceIterator/>66 <flwor::TupleSourceIterator/>
70 </flwor::WindowIterator>67 </flwor::WindowIterator>
7168
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q9.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q9.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/windowing/q9.iter 2012-12-06 22:51:20 +0000
@@ -14,20 +14,16 @@
14 <LetVariable name="person" materialize="true"/>14 <LetVariable name="person" materialize="true"/>
15 <flwor::WindowIterator>15 <flwor::WindowIterator>
16 <WindowVariable name="w">16 <WindowVariable name="w">
17 <NodeSortIterator distinct="true" ascending="true">17 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">
18 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,event)" typename="*" nill allowed="0">18 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">
19 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,stream)" typename="*" nill allowed="0">19 <CtxVarIterator varid="4" varname="seq" varkind="global"/>
20 <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="*">
21 <CtxVarIterator varid="4" varname="seq" varkind="global"/>
22 </TreatIterator>
23 </ChildAxisIterator>
24 </ChildAxisIterator>20 </ChildAxisIterator>
25 </NodeSortIterator>21 </ChildAxisIterator>
26 </WindowVariable>22 </WindowVariable>
27 <WinCondVariable name="start-CurrentIn"/>23 <WinCondVariable name="start-CurrentIn"/>
28 <WinCondVariable name="start-CurrentInCurrentOut"/>24 <WinCondVariable name="start-CurrentInCurrentOut"/>
29 <FnBooleanIterator>25 <FnBooleanIterator>
30 <CompareIterator>26 <TypedValueCompareIterator_STRING>
31 <PromoteIterator type="xs:anyAtomicType">27 <PromoteIterator type="xs:anyAtomicType">
32 <FnDataIterator>28 <FnDataIterator>
33 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">29 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">
@@ -36,12 +32,12 @@
36 </FnDataIterator>32 </FnDataIterator>
37 </PromoteIterator>33 </PromoteIterator>
38 <SingletonIterator value="xs:string(in)"/>34 <SingletonIterator value="xs:string(in)"/>
39 </CompareIterator>35 </TypedValueCompareIterator_STRING>
40 </FnBooleanIterator>36 </FnBooleanIterator>
41 <WinCondVariable name="end-CurrentIn"/>37 <WinCondVariable name="end-CurrentIn"/>
42 <WinCondVariable name="end-CurrentInCurrentOut"/>38 <WinCondVariable name="end-CurrentInCurrentOut"/>
43 <AndIterator>39 <AndIterator>
44 <CompareIterator>40 <TypedValueCompareIterator_STRING>
45 <PromoteIterator type="xs:anyAtomicType">41 <PromoteIterator type="xs:anyAtomicType">
46 <FnDataIterator>42 <FnDataIterator>
47 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">43 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,person)" typename="*" nill allowed="0">
@@ -56,8 +52,8 @@
56 </ChildAxisIterator>52 </ChildAxisIterator>
57 </FnDataIterator>53 </FnDataIterator>
58 </PromoteIterator>54 </PromoteIterator>
59 </CompareIterator>55 </TypedValueCompareIterator_STRING>
60 <CompareIterator>56 <TypedValueCompareIterator_STRING>
61 <PromoteIterator type="xs:anyAtomicType">57 <PromoteIterator type="xs:anyAtomicType">
62 <FnDataIterator>58 <FnDataIterator>
63 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">59 <ChildAxisIterator test kind="match_name_test" qname="xs:QName(,,direction)" typename="*" nill allowed="0">
@@ -66,7 +62,7 @@
66 </FnDataIterator>62 </FnDataIterator>
67 </PromoteIterator>63 </PromoteIterator>
68 <SingletonIterator value="xs:string(out)"/>64 <SingletonIterator value="xs:string(out)"/>
69 </CompareIterator>65 </TypedValueCompareIterator_STRING>
70 </AndIterator>66 </AndIterator>
71 <flwor::TupleSourceIterator/>67 <flwor::TupleSourceIterator/>
72 </flwor::WindowIterator>68 </flwor::WindowIterator>
7369
=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter 2012-10-08 12:09:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter 2012-12-06 22:51:20 +0000
@@ -183,13 +183,6 @@
183 </StringJoinIterator>183 </StringJoinIterator>
184 <SingletonIterator value="xs:string(255)"/>184 <SingletonIterator value="xs:string(255)"/>
185 <flwor::FLWORIterator>185 <flwor::FLWORIterator>
186 <LetVariable name="$$opt_temp_1" materialize="true">
187 <HoistIterator>
188 <TreatIterator type="[NodeXQType elementNode content=[XQType ANY_TYPE_KIND*]]" quant="">
189 <CtxVarIterator varid="6" varname="scene" varkind="global"/>
190 </TreatIterator>
191 </HoistIterator>
192 </LetVariable>
193 <LetVariable name="$$opt_temp_0" materialize="true">186 <LetVariable name="$$opt_temp_0" materialize="true">
194 <HoistIterator>187 <HoistIterator>
195 <OpToIterator>188 <OpToIterator>
@@ -221,7 +214,7 @@
221 <SingletonIterator value="xs:decimal(0.5)"/>214 <SingletonIterator value="xs:decimal(0.5)"/>
222 </SpecificNumArithIterator_AddOperation_DECIMAL>215 </SpecificNumArithIterator_AddOperation_DECIMAL>
223 </ForVariable>216 </ForVariable>
224 <LetVariable name="$$opt_temp_2" materialize="true">217 <LetVariable name="$$opt_temp_1" materialize="true">
225 <HoistIterator>218 <HoistIterator>
226 <PromoteIterator type="xs:double">219 <PromoteIterator type="xs:double">
227 <ForVarIterator varname="y-recentered"/>220 <ForVarIterator varname="y-recentered"/>
@@ -238,9 +231,7 @@
238 <flwor::FLWORIterator>231 <flwor::FLWORIterator>
239 <ForVariable name="channel">232 <ForVariable name="channel">
240 <UDFunctionCallIterator>233 <UDFunctionCallIterator>
241 <UnhoistIterator>234 <CtxVarIterator varid="6" varname="scene" varkind="global"/>
242 <LetVarIterator varname="$$opt_temp_1"/>
243 </UnhoistIterator>
244 <PromoteIterator type="xs:double">235 <PromoteIterator type="xs:double">
245 <SpecificNumArithIterator_MultiplyOperation_DECIMAL>236 <SpecificNumArithIterator_MultiplyOperation_DECIMAL>
246 <SpecificNumArithIterator_SubtractOperation_DECIMAL>237 <SpecificNumArithIterator_SubtractOperation_DECIMAL>
@@ -254,7 +245,7 @@
254 </SpecificNumArithIterator_MultiplyOperation_DECIMAL>245 </SpecificNumArithIterator_MultiplyOperation_DECIMAL>
255 </PromoteIterator>246 </PromoteIterator>
256 <UnhoistIterator>247 <UnhoistIterator>
257 <LetVarIterator varname="$$opt_temp_2"/>248 <LetVarIterator varname="$$opt_temp_1"/>
258 </UnhoistIterator>249 </UnhoistIterator>
259 </UDFunctionCallIterator>250 </UDFunctionCallIterator>
260 </ForVariable>251 </ForVariable>
261252
=== modified file 'test/rbkt/Queries/zorba/windowing/q4.xq'
--- test/rbkt/Queries/zorba/windowing/q4.xq 2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/windowing/q4.xq 2012-12-06 22:51:20 +0000
@@ -4,8 +4,8 @@
44
5for sliding window $w in $timesequence/stream/event 5for sliding window $w in $timesequence/stream/event
6 start $s_curr at $s_pos previous $s_prev6 start $s_curr at $s_pos previous $s_prev
7 when ($s_curr/@time ne $s_prev/@time) or (empty($s_prev))7 when ($s_curr/@time ne $s_prev/@time) or (empty($s_prev))
8 only end next $e_next 8 only end next $e_next
9 when $e_next/@time - $s_curr/@time gt $MAX_DIFF9 when $e_next/@time - $s_curr/@time gt $MAX_DIFF
10return 10return
11 avg( $w/@temp )11 avg( $w/@temp )

Subscribers

People subscribed via source and target branches