Merge lp:~zorba-coders/zorba/hof-next into lp:zorba
- hof-next
- Merge into trunk
Proposed by
Markos Zaharioudakis
Status: | Merged |
---|---|
Approved by: | Markos Zaharioudakis |
Approved revision: | 11350 |
Merged at revision: | 11402 |
Proposed branch: | lp:~zorba-coders/zorba/hof-next |
Merge into: | lp:zorba |
Diff against target: |
2285 lines (+505/-605) 23 files modified
src/compiler/codegen/plan_visitor.cpp (+24/-63) src/compiler/expression/expr_clone.cpp (+24/-18) src/compiler/expression/expr_iter.cpp (+2/-2) src/compiler/expression/expr_put.cpp (+12/-11) src/compiler/expression/expr_type.cpp (+0/-1) src/compiler/expression/function_item_expr.cpp (+4/-10) src/compiler/expression/function_item_expr.h (+15/-22) src/compiler/expression/var_expr.cpp (+1/-2) src/compiler/expression/var_expr.h (+0/-2) src/compiler/rewriter/rules/nodeid_rules.cpp (+0/-1) src/compiler/rewriter/tools/dataflow_annotations.cpp (+0/-2) src/compiler/translator/translator.cpp (+186/-209) src/functions/udf.cpp (+4/-5) src/functions/udf.h (+2/-2) src/runtime/core/fncall_iterator.cpp (+21/-15) src/runtime/core/fncall_iterator.h (+15/-13) src/runtime/hof/fn_hof_functions_impl.cpp (+13/-9) src/runtime/hof/function_item.cpp (+93/-49) src/runtime/hof/function_item.h (+64/-56) src/runtime/hof/function_item_iter.cpp (+19/-98) src/runtime/hof/function_item_iter.h (+2/-8) test/fots/CMakeLists.txt (+0/-3) test/fots_driver/fots-driver.xq (+4/-4) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/hof-next |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markos Zaharioudakis | Approve | ||
Review via email: mp+160535@code.launchpad.net |
Commit message
No copying of global variables in function item
Description of the change
No copying of global variables in function item
To post a comment you must log in.
lp:~zorba-coders/zorba/hof-next
updated
- 11349. By Markos Zaharioudakis
-
No copying of global variables in function item
- 11350. By Markos Zaharioudakis
-
merge from trunk
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 hof-next-
All tests succeeded!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/compiler/codegen/plan_visitor.cpp' |
2 | --- src/compiler/codegen/plan_visitor.cpp 2013-04-16 20:06:08 +0000 |
3 | +++ src/compiler/codegen/plan_visitor.cpp 2013-04-24 02:27:27 +0000 |
4 | @@ -472,69 +472,31 @@ |
5 | fnInfo->theCCB = theCCB; |
6 | fnInfo->theLoc = qloc; |
7 | |
8 | + csize numOuterVars = v.get_in_scope_vars().size(); |
9 | + |
10 | + for (csize i = 0; i < numOuterVars; ++i) |
11 | + { |
12 | + fnInfo->theInScopeVarIterators.push_back(pop_itstack()); |
13 | + } |
14 | + |
15 | + std::reverse(fnInfo->theInScopeVarIterators.begin(), |
16 | + fnInfo->theInScopeVarIterators.end()); |
17 | + |
18 | + |
19 | + for (csize i = 0; i < numOuterVars; ++i) |
20 | { |
21 | - for (csize i = 0; i < v.get_subst_vars().size(); ++i) |
22 | - { |
23 | - if (!v.get_is_global_var()[i]) |
24 | - fnInfo->theScopedVarsIterators.push_back(pop_itstack()); |
25 | - else if (fnInfo->theScopedVarsValues[i] != NULL) |
26 | - pop_itstack(); |
27 | - } |
28 | - |
29 | - std::reverse(fnInfo->theScopedVarsIterators.begin(), |
30 | - fnInfo->theScopedVarsIterators.end()); |
31 | - } |
32 | - |
33 | - |
34 | - // This portion is similar to the eval iterator |
35 | - { |
36 | - csize curChild = -1; |
37 | - csize numOuterVars = fnInfo->theScopedVarsNames.size(); |
38 | - for (csize i = 0; i < numOuterVars; ++i) |
39 | - { |
40 | - if (!fnInfo->theIsGlobalVar[i]) |
41 | - { |
42 | - ++curChild; |
43 | - |
44 | - if (fnInfo->theSubstVarsValues[i] != NULL && |
45 | - fnInfo->theSubstVarsValues[i]->get_unique_id() == 0) |
46 | - { |
47 | - fnInfo->theSubstVarsValues[i]->set_var_info(NULL); |
48 | - fnInfo->theSubstVarsValues[i]->set_unique_id(theNextDynamicVarId++); |
49 | - } |
50 | - |
51 | - fnInfo->theVarId[i] = fnInfo->theSubstVarsValues[i]->get_unique_id(); |
52 | - } |
53 | - else |
54 | - { |
55 | - static_context* outerSctx = fnInfo->theClosureSctx; |
56 | - |
57 | - VarInfo* outerGlobalVar = outerSctx->lookup_var(fnInfo->theScopedVarsNames[i]); |
58 | - |
59 | - ulong outerGlobalVarId = 0; |
60 | - |
61 | - if (outerGlobalVar) |
62 | - { |
63 | - outerGlobalVarId = outerGlobalVar->getId(); |
64 | - } |
65 | - else |
66 | - { |
67 | - for (csize j=0; j<fnInfo->theSubstVarsValues.size(); j++) |
68 | - { |
69 | - if (fnInfo->theSubstVarsValues[j]->get_name()->equals(fnInfo->theScopedVarsNames[i].getp())) |
70 | - outerGlobalVarId = fnInfo->theSubstVarsValues[j]->get_unique_id(); |
71 | - } |
72 | - } |
73 | - |
74 | - if (fnInfo->theSubstVarsValues[i] != NULL && |
75 | - fnInfo->theSubstVarsValues[i]->get_unique_id() == 0) |
76 | - { |
77 | - fnInfo->theSubstVarsValues[i]->set_unique_id(outerGlobalVarId); |
78 | - } |
79 | - |
80 | - fnInfo->theVarId[i] = outerGlobalVarId; |
81 | - } |
82 | - } // for |
83 | + fnInfo->theInScopeVars[i]->set_var_info(NULL); |
84 | + |
85 | + if (fnInfo->theInScopeVars[i]->get_unique_id() != 0) |
86 | + { |
87 | + ZORBA_ASSERT(fnInfo->theInScopeVars[i]->get_unique_id() == i+1); |
88 | + } |
89 | + else |
90 | + { |
91 | + fnInfo->theInScopeVars[i]->set_unique_id(i+1); |
92 | + } |
93 | + |
94 | + fnInfo->theInScopeVarIds[i] = fnInfo->theInScopeVars[i]->get_unique_id(); |
95 | } |
96 | |
97 | push_itstack(new FunctionItemIterator(sctx, qloc, fnInfo)); |
98 | @@ -929,7 +891,6 @@ |
99 | } |
100 | |
101 | case var_expr::prolog_var: |
102 | - case var_expr::hof_var: |
103 | { |
104 | push_itstack(new CtxVarIterator(sctx, |
105 | qloc, |
106 | |
107 | === modified file 'src/compiler/expression/expr_clone.cpp' |
108 | --- src/compiler/expression/expr_clone.cpp 2013-04-16 20:06:08 +0000 |
109 | +++ src/compiler/expression/expr_clone.cpp 2013-04-24 02:27:27 +0000 |
110 | @@ -375,6 +375,23 @@ |
111 | { |
112 | const function_item_expr* e = static_cast<const function_item_expr*>(this); |
113 | |
114 | + csize numInScopeVars = e->theFunctionItemInfo->theInScopeVars.size(); |
115 | + |
116 | +#if 0 |
117 | + std::vector<var_expr*> clonedInScopeVars(numInScopeVars); |
118 | + |
119 | + for (csize i = 0; i < numInScopeVars; ++i) |
120 | + { |
121 | + var_expr* var = e->theFunctionItemInfo->theInScopeVars[i]; |
122 | + |
123 | + clonedInScopeVars[i] = theCCB->theEM->create_var_expr(udf, var); |
124 | + |
125 | + subst[var] = clonedVar; |
126 | + } |
127 | + |
128 | + user_function* fiudf = e->theFunctionItemInfo->theFunction; |
129 | +#endif |
130 | + |
131 | function_item_expr* cloneExpr = theCCB->theEM-> |
132 | create_function_item_expr(theSctx, |
133 | udf, |
134 | @@ -384,25 +401,14 @@ |
135 | e->is_inline(), |
136 | e->is_coercion()); |
137 | |
138 | - std::vector<expr*>::const_iterator varIter = |
139 | - e->theFunctionItemInfo->theScopedVarsValues.begin(); |
140 | - |
141 | - std::vector<var_expr*>::const_iterator substVarIter = |
142 | - e->theFunctionItemInfo->theSubstVarsValues.begin(); |
143 | - |
144 | - std::vector<store::Item_t>::const_iterator nameIter = |
145 | - e->theFunctionItemInfo->theScopedVarsNames.begin(); |
146 | - |
147 | - std::vector<int>::const_iterator isGlobalIter = |
148 | - e->theFunctionItemInfo->theIsGlobalVar.begin(); |
149 | - |
150 | - for (; varIter != e->theFunctionItemInfo->theScopedVarsValues.end(); |
151 | - ++varIter, ++substVarIter, ++nameIter, ++isGlobalIter) |
152 | + for (csize i = 0; i < numInScopeVars; ++i) |
153 | { |
154 | - cloneExpr->add_variable((*varIter) ? (*varIter)->clone(udf, subst) : NULL, |
155 | - (*substVarIter) ? static_cast<var_expr*>((*substVarIter)->clone(udf, subst)) : NULL, |
156 | - *nameIter, |
157 | - *isGlobalIter); |
158 | + var_expr* var = e->theFunctionItemInfo->theInScopeVars[i]; |
159 | + |
160 | + expr* clonedDomainExpr = |
161 | + e->theFunctionItemInfo->theInScopeVarValues[i]->clone(udf, subst); |
162 | + |
163 | + cloneExpr->add_variable(clonedDomainExpr, var); |
164 | } |
165 | |
166 | newExpr = cloneExpr; |
167 | |
168 | === modified file 'src/compiler/expression/expr_iter.cpp' |
169 | --- src/compiler/expression/expr_iter.cpp 2013-04-16 20:06:08 +0000 |
170 | +++ src/compiler/expression/expr_iter.cpp 2013-04-24 02:27:27 +0000 |
171 | @@ -704,8 +704,8 @@ |
172 | |
173 | EXPR_ITER_BEGIN(); |
174 | |
175 | - theArgsIter = fiExpr->theFunctionItemInfo->theScopedVarsValues.begin(); |
176 | - theArgsEnd = fiExpr->theFunctionItemInfo->theScopedVarsValues.end(); |
177 | + theArgsIter = fiExpr->theFunctionItemInfo->theInScopeVarValues.begin(); |
178 | + theArgsEnd = fiExpr->theFunctionItemInfo->theInScopeVarValues.end(); |
179 | |
180 | for (; theArgsIter != theArgsEnd; ++theArgsIter) |
181 | { |
182 | |
183 | === modified file 'src/compiler/expression/expr_put.cpp' |
184 | --- src/compiler/expression/expr_put.cpp 2013-04-16 20:06:08 +0000 |
185 | +++ src/compiler/expression/expr_put.cpp 2013-04-24 02:27:27 +0000 |
186 | @@ -185,7 +185,7 @@ |
187 | put_qname(get_name(), os); |
188 | } |
189 | |
190 | - if (get_kind() == prolog_var || get_kind() == hof_var) |
191 | + if (get_kind() == prolog_var) |
192 | { |
193 | os << " uniqueId=" << theUniqueId; |
194 | } |
195 | @@ -539,23 +539,24 @@ |
196 | os << " " << theFunctionItemInfo->theQName->getStringValue() |
197 | << "#" << theFunctionItemInfo->theArity << " [\n"; |
198 | |
199 | - for (csize i = 0; i < theFunctionItemInfo->theScopedVarsValues.size(); ++i) |
200 | + for (csize i = 0; i < theFunctionItemInfo->theInScopeVarValues.size(); ++i) |
201 | { |
202 | os << indent << "using $" |
203 | - << theFunctionItemInfo->theScopedVarsNames[i]->getStringValue() |
204 | - << expr_addr(theFunctionItemInfo->theSubstVarsValues[i]) |
205 | - << (theFunctionItemInfo->theIsGlobalVar[i] ? " global=1" : "") << " := ["; |
206 | - os << endl << inc_indent; |
207 | + << theFunctionItemInfo->theInScopeVarNames[i]->getStringValue() |
208 | + << expr_addr(theFunctionItemInfo->theInScopeVars[i]) |
209 | + << " := [" << endl << inc_indent; |
210 | |
211 | - if (theFunctionItemInfo->theScopedVarsValues[i]) |
212 | - theFunctionItemInfo->theScopedVarsValues[i]->put(os); |
213 | + if (theFunctionItemInfo->theInScopeVarValues[i]) |
214 | + theFunctionItemInfo->theInScopeVarValues[i]->put(os); |
215 | |
216 | os << dec_indent << indent << "]" << endl; |
217 | } |
218 | |
219 | - if (theFunctionItemInfo->theFunction != NULL && |
220 | - static_cast<user_function*>(theFunctionItemInfo->theFunction.getp())->getBody() != NULL) |
221 | - static_cast<user_function*>(theFunctionItemInfo->theFunction.getp())->getBody()->put(os); |
222 | + user_function* udf = |
223 | + static_cast<user_function*>(theFunctionItemInfo->theFunction.getp()); |
224 | + |
225 | + if (udf != NULL && udf->getBody() != NULL) |
226 | + udf->getBody()->put(os); |
227 | |
228 | END_PUT(); |
229 | } |
230 | |
231 | === modified file 'src/compiler/expression/expr_type.cpp' |
232 | --- src/compiler/expression/expr_type.cpp 2013-04-08 15:07:13 +0000 |
233 | +++ src/compiler/expression/expr_type.cpp 2013-04-24 02:27:27 +0000 |
234 | @@ -260,7 +260,6 @@ |
235 | case var_expr::catch_var: // TODO |
236 | case var_expr::arg_var: |
237 | case var_expr::eval_var: |
238 | - case var_expr::hof_var: |
239 | { |
240 | break; |
241 | } |
242 | |
243 | === modified file 'src/compiler/expression/function_item_expr.cpp' |
244 | --- src/compiler/expression/function_item_expr.cpp 2013-04-16 20:06:08 +0000 |
245 | +++ src/compiler/expression/function_item_expr.cpp 2013-04-24 02:27:27 +0000 |
246 | @@ -140,17 +140,13 @@ |
247 | } |
248 | |
249 | |
250 | -void function_item_expr::add_variable( |
251 | - expr* var, |
252 | - var_expr* substVar, |
253 | - const store::Item_t& name, |
254 | - int isGlobal) |
255 | +void function_item_expr::add_variable(expr* var, var_expr* substVar) |
256 | { |
257 | - theFunctionItemInfo->add_variable(var, substVar, name, isGlobal); |
258 | + theFunctionItemInfo->add_variable(var, substVar); |
259 | } |
260 | |
261 | |
262 | - void function_item_expr::set_function(user_function* udf, csize arity) |
263 | +void function_item_expr::set_function(user_function* udf, csize arity) |
264 | { |
265 | theFunctionItemInfo->theFunction = udf; |
266 | theFunctionItemInfo->theArity = arity; |
267 | @@ -163,9 +159,7 @@ |
268 | { |
269 | store::Item_t name; |
270 | std::stringstream ss; |
271 | - ss << "inline function("; |
272 | - ss << loc; |
273 | - ss << ")"; |
274 | + ss << "inline-function(" << loc << ")"; |
275 | GENV_ITEMFACTORY->createQName(name, "", "", ss.str()); |
276 | return name; |
277 | } |
278 | |
279 | === modified file 'src/compiler/expression/function_item_expr.h' |
280 | --- src/compiler/expression/function_item_expr.h 2013-04-16 20:06:08 +0000 |
281 | +++ src/compiler/expression/function_item_expr.h 2013-04-24 02:27:27 +0000 |
282 | @@ -29,7 +29,7 @@ |
283 | namespace zorba { |
284 | |
285 | /******************************************************************************* |
286 | - [133] ArgumentPlaceholder ::= "?" |
287 | + ArgumentPlaceholder ::= "?" |
288 | ********************************************************************************/ |
289 | class argument_placeholder_expr : public expr |
290 | { |
291 | @@ -115,6 +115,10 @@ |
292 | |
293 | InlineFunction ::= "function" "(" ParamList? ")" ("as" SequenceType)? EnclosedExpr |
294 | |
295 | + theFunctionItemInfo: |
296 | + -------------------- |
297 | + See class definition in src/runtime/hof/function_item.h |
298 | + |
299 | ********************************************************************************/ |
300 | class function_item_expr: public expr |
301 | { |
302 | @@ -149,25 +153,16 @@ |
303 | public: |
304 | FunctionItemInfo* get_dynamic_fn_info() { return theFunctionItemInfo; } |
305 | |
306 | - void add_variable( |
307 | - expr* var, |
308 | - var_expr* substVar, |
309 | - const store::Item_t& name, |
310 | - int isGlobal); |
311 | - |
312 | - const std::vector<var_expr*>& get_subst_vars() const |
313 | - { |
314 | - return theFunctionItemInfo->theSubstVarsValues; |
315 | - } |
316 | - |
317 | - const std::vector<store::Item_t>& get_scoped_vars_names() const |
318 | - { |
319 | - return theFunctionItemInfo->theScopedVarsNames; |
320 | - } |
321 | - |
322 | - const std::vector<int>& get_is_global_var() const |
323 | - { |
324 | - return theFunctionItemInfo->theIsGlobalVar; |
325 | + void add_variable(expr* var, var_expr* substVar); |
326 | + |
327 | + const std::vector<var_expr*>& get_in_scope_vars() const |
328 | + { |
329 | + return theFunctionItemInfo->theInScopeVars; |
330 | + } |
331 | + |
332 | + const std::vector<store::Item_t>& get_in_scope_var_names() const |
333 | + { |
334 | + return theFunctionItemInfo->theInScopeVarNames; |
335 | } |
336 | |
337 | void set_function(user_function* udf, csize arity); |
338 | @@ -189,8 +184,6 @@ |
339 | std::ostream& put(std::ostream& os) const; |
340 | |
341 | public: |
342 | - // Given a location, will create an inline function name string such |
343 | - // as "inline function(loc)" |
344 | static store::Item_t create_inline_fname(const QueryLoc& loc); |
345 | }; |
346 | |
347 | |
348 | === modified file 'src/compiler/expression/var_expr.cpp' |
349 | --- src/compiler/expression/var_expr.cpp 2013-03-04 21:00:58 +0000 |
350 | +++ src/compiler/expression/var_expr.cpp 2013-04-24 02:27:27 +0000 |
351 | @@ -53,7 +53,6 @@ |
352 | case count_var: return "CNT"; break; |
353 | case score_var: return "SCORE"; break; |
354 | case prolog_var: return "PROLOG"; break; |
355 | - case hof_var: return "HOF"; break; |
356 | case local_var: return "LOCAL"; break; |
357 | case catch_var: return "CATCH"; break; |
358 | case copy_var: return "COPY"; break; |
359 | @@ -316,7 +315,7 @@ |
360 | ********************************************************************************/ |
361 | void var_expr::remove_set_expr(expr* e) |
362 | { |
363 | - assert(theVarKind == local_var || theVarKind == prolog_var || theVarKind == hof_var); |
364 | + assert(theVarKind == local_var || theVarKind == prolog_var); |
365 | |
366 | bool found = false; |
367 | VarSetExprs::iterator ite = theSetExprs.begin(); |
368 | |
369 | === modified file 'src/compiler/expression/var_expr.h' |
370 | --- src/compiler/expression/var_expr.h 2013-03-04 21:00:58 +0000 |
371 | +++ src/compiler/expression/var_expr.h 2013-04-24 02:27:27 +0000 |
372 | @@ -152,8 +152,6 @@ |
373 | |
374 | prolog_var, |
375 | |
376 | - hof_var, // used by HoF functions, behaves similarly to prolog vars |
377 | - |
378 | local_var, |
379 | |
380 | arg_var |
381 | |
382 | === modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp' |
383 | --- src/compiler/rewriter/rules/nodeid_rules.cpp 2013-03-15 08:22:41 +0000 |
384 | +++ src/compiler/rewriter/rules/nodeid_rules.cpp 2013-04-24 02:27:27 +0000 |
385 | @@ -1177,7 +1177,6 @@ |
386 | |
387 | case var_expr::prolog_var: |
388 | case var_expr::local_var: |
389 | - case var_expr::hof_var: |
390 | { |
391 | if (!e->isVisited(1)) |
392 | { |
393 | |
394 | === modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp' |
395 | --- src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-03-15 08:22:41 +0000 |
396 | +++ src/compiler/rewriter/tools/dataflow_annotations.cpp 2013-04-24 02:27:27 +0000 |
397 | @@ -801,7 +801,6 @@ |
398 | |
399 | case var_expr::prolog_var: |
400 | case var_expr::local_var: |
401 | - case var_expr::hof_var: |
402 | { |
403 | VarSourcesMap::iterator ite = theVarSourcesMap.find(e); |
404 | |
405 | @@ -1238,7 +1237,6 @@ |
406 | |
407 | case var_expr::prolog_var: |
408 | case var_expr::local_var: |
409 | - case var_expr::hof_var: |
410 | { |
411 | VarSourcesMap::iterator ite = theVarSourcesMap.find(e); |
412 | |
413 | |
414 | === modified file 'src/compiler/translator/translator.cpp' |
415 | --- src/compiler/translator/translator.cpp 2013-04-23 13:20:31 +0000 |
416 | +++ src/compiler/translator/translator.cpp 2013-04-24 02:27:27 +0000 |
417 | @@ -1516,6 +1516,7 @@ |
418 | |
419 | xqtref_t cardType = tm->create_any_item_type(paramType->get_quantifier()); |
420 | |
421 | + // hof ???? |
422 | argExpr = wrap_in_type_match(argExpr, |
423 | cardType, |
424 | loc, |
425 | @@ -1541,8 +1542,10 @@ |
426 | The coersion expr is a flwor that looks like this: |
427 | |
428 | for $fi in argExpr |
429 | - return function($p1 as t1, ... $pn as tn) { $fi(p1, ..., pn) } |
430 | + return function($p1 as t1, ... $pn as tn) as rt { $fi(p1, ..., pn) } |
431 | |
432 | + where t1, ..., tn are the param types of the target function type and rt is |
433 | + the return type of .the target function type. |
434 | ********************************************************************************/ |
435 | expr* wrap_in_coercion( |
436 | xqtref_t targetType, |
437 | @@ -1556,19 +1559,21 @@ |
438 | |
439 | push_scope(); |
440 | |
441 | + // for $fi in argExpr |
442 | flwor_expr* coersionFlwor = CREATE(flwor)(theRootSctx, theUDF, loc, false); |
443 | for_clause* fiClause = wrap_in_forclause(argExpr, NULL); |
444 | var_expr* fiVar = fiClause->get_var(); |
445 | coersionFlwor->add_clause(fiClause); |
446 | |
447 | + // Create the inline-function expr and make it the return expr of the flwor |
448 | function_item_expr* inlineFuncExpr = |
449 | CREATE(function_item)(theRootSctx, theUDF, loc, true, true); |
450 | |
451 | coersionFlwor->set_return_expr(inlineFuncExpr); |
452 | |
453 | - var_expr* fiSubstVar = bind_var(loc, fiVar->get_name(), var_expr::hof_var); |
454 | + var_expr* fiSubstVar = bind_var(loc, fiVar->get_name(), var_expr::local_var); |
455 | |
456 | - inlineFuncExpr->add_variable(fiVar, fiSubstVar, fiVar->get_name(), 0); |
457 | + inlineFuncExpr->add_variable(fiVar, fiSubstVar); |
458 | |
459 | // Create the inline udf obj. |
460 | user_function_t inlineUDF = |
461 | @@ -1584,13 +1589,12 @@ |
462 | std::vector<expr*> arguments; // Arguments to the dynamic function call |
463 | csize numParams = funcType->get_number_params(); |
464 | |
465 | - for(csize i = 0; i < numParams; ++i) |
466 | + for (csize i = 0; i < numParams; ++i) |
467 | { |
468 | xqtref_t paramType = funcType->operator[](i); |
469 | |
470 | var_expr* argVar = create_temp_var(loc, var_expr::arg_var); |
471 | argVar->set_param_pos(i); |
472 | - argVar->set_type(paramType); |
473 | argVars.push_back(argVar); |
474 | |
475 | expr* arg = CREATE(wrapper)(theRootSctx, theUDF, loc, argVar); |
476 | @@ -1606,6 +1610,7 @@ |
477 | fiSubstVar), |
478 | arguments); |
479 | |
480 | + // What if return type is function(...) hof ???? |
481 | if (returnType->isBuiltinAtomicAny()) |
482 | { |
483 | body = wrap_in_type_promotion(body, returnType, PROMOTE_TYPE_PROMOTION); |
484 | @@ -4236,8 +4241,6 @@ |
485 | |
486 | // Wrap the UDF body to the type-related expr that enforce the declared |
487 | // return type. |
488 | - returnType = udf->getSignature().returnType(); |
489 | - |
490 | if (returnType->isBuiltinAtomicAny()) |
491 | { |
492 | body = wrap_in_type_promotion(body, |
493 | @@ -11140,8 +11143,7 @@ |
494 | |
495 | |
496 | /******************************************************************************* |
497 | - The function will process a FunctionDecl to handle all the special function |
498 | - cases. |
499 | + |
500 | ********************************************************************************/ |
501 | expr* generate_fncall( |
502 | const QName* qname, |
503 | @@ -11455,6 +11457,7 @@ |
504 | } |
505 | case FunctionConsts::FN_FUNCTION_LOOKUP_2: |
506 | { |
507 | + // hof ???? What if focus is not defined ? |
508 | arguments.push_back(DOT_REF); |
509 | arguments.push_back(DOT_POS_REF); |
510 | arguments.push_back(DOT_SIZE_REF); |
511 | @@ -11895,6 +11898,7 @@ |
512 | expr* sourceExpr = pop_nodestack(); |
513 | ZORBA_ASSERT(sourceExpr != 0); |
514 | |
515 | + // special case: partial function invocation |
516 | if (v.normalizeArgs() && sourceExpr->get_expr_kind() == function_item_expr_kind) |
517 | { |
518 | function_item_expr* fiExpr = static_cast<function_item_expr*>(sourceExpr); |
519 | @@ -11914,7 +11918,6 @@ |
520 | |
521 | expr* flworVarExpr = CREATE(wrapper)(theRootSctx, theUDF, loc, fc->get_var()); |
522 | |
523 | -#ifdef ZORBA_WITH_JSON |
524 | TypeManager* tm = sourceExpr->get_type_manager(); |
525 | xqtref_t srcType = sourceExpr->get_return_type(); |
526 | |
527 | @@ -11956,7 +11959,6 @@ |
528 | flworExpr->set_return_expr(accessorExpr); |
529 | } |
530 | else |
531 | -#endif |
532 | { |
533 | // This is needed to make sure that the flwor is not thrown away by the optimizer |
534 | // when the FunctionItem expression is an empty sequence. |
535 | @@ -12068,9 +12070,7 @@ |
536 | |
537 | if (f->isBuiltin() && |
538 | fn_ns != static_context::W3C_FN_NS && |
539 | -#ifdef ZORBA_WITH_JSON |
540 | fn_ns != static_context::JSONIQ_FN_NS && |
541 | -#endif |
542 | fn_ns != XQUERY_MATH_FN_NS && |
543 | fn_ns != theModuleNamespace) |
544 | { |
545 | @@ -12108,37 +12108,59 @@ |
546 | { |
547 | case FunctionConsts::FN_POSITION_0: |
548 | { |
549 | - expr* posVar = NULL; |
550 | - if (lookup_var(getDotPosVarName(), loc, false)) |
551 | - posVar = DOT_POS_REF; |
552 | - |
553 | - push_scope(); |
554 | - |
555 | - var_expr* substVar = bind_var(loc, getDotPosVarName(), var_expr::hof_var); |
556 | - |
557 | - fiExpr->add_variable(posVar, substVar, substVar->get_name(), false); |
558 | - |
559 | - body = generate_fn_body(f, foArgs, loc); |
560 | - |
561 | - pop_scope(); |
562 | + var_expr* posVar = lookup_var(getDotPosVarName(), loc, false); |
563 | + |
564 | + if (posVar && posVar->get_kind() != var_expr::prolog_var) |
565 | + { |
566 | + expr* posVarRef = DOT_POS_REF; |
567 | + |
568 | + push_scope(); |
569 | + |
570 | + var_expr* substVar = bind_var(loc, getDotPosVarName(), var_expr::local_var); |
571 | + |
572 | + // Must set the id of the substVar if we are coming here from a |
573 | + // FunctionLookupIterator. |
574 | + substVar->set_unique_id(posVar->get_unique_id()); |
575 | + |
576 | + fiExpr->add_variable(posVarRef, substVar); |
577 | + |
578 | + body = generate_fn_body(f, foArgs, loc); |
579 | + |
580 | + pop_scope(); |
581 | + } |
582 | + else |
583 | + { |
584 | + body = generate_fn_body(f, foArgs, loc); |
585 | + } |
586 | |
587 | break; |
588 | } |
589 | case FunctionConsts::FN_LAST_0: |
590 | { |
591 | - expr* sizeVar = NULL; |
592 | - if (lookup_var(getLastIdxVarName(), loc, false)) |
593 | - sizeVar = DOT_SIZE_REF; |
594 | - |
595 | - push_scope(); |
596 | - |
597 | - var_expr* substVar = bind_var(loc, getLastIdxVarName(), var_expr::hof_var); |
598 | - |
599 | - fiExpr->add_variable(sizeVar, substVar, substVar->get_name(), false); |
600 | - |
601 | - body = generate_fn_body(f, foArgs, loc); |
602 | - |
603 | - pop_scope(); |
604 | + var_expr* sizeVar = lookup_var(getLastIdxVarName(), loc, false); |
605 | + |
606 | + if (sizeVar && sizeVar->get_kind() != var_expr::prolog_var) |
607 | + { |
608 | + expr* sizeVarRef = DOT_SIZE_REF; |
609 | + |
610 | + push_scope(); |
611 | + |
612 | + var_expr* substVar = bind_var(loc, getLastIdxVarName(), var_expr::local_var); |
613 | + |
614 | + // Must set the id of the substVar if we are coming here from a |
615 | + // FunctionLookupIterator. |
616 | + substVar->set_unique_id(sizeVar->get_unique_id()); |
617 | + |
618 | + fiExpr->add_variable(sizeVarRef, substVar); |
619 | + |
620 | + body = generate_fn_body(f, foArgs, loc); |
621 | + |
622 | + pop_scope(); |
623 | + } |
624 | + else |
625 | + { |
626 | + body = generate_fn_body(f, foArgs, loc); |
627 | + } |
628 | |
629 | break; |
630 | } |
631 | @@ -12163,79 +12185,93 @@ |
632 | case FunctionConsts::FN_ID_1: |
633 | case FunctionConsts::FN_ELEMENT_WITH_ID_1: |
634 | { |
635 | - expr* dotVarRef = NULL; |
636 | var_expr* dotVar = lookup_var(getDotVarName(), loc, false); |
637 | |
638 | - if (dotVar) |
639 | - dotVarRef = DOT_REF; |
640 | - |
641 | - push_scope(); |
642 | - |
643 | - var_expr* substVar = bind_var(loc, getDotVarName(), var_expr::hof_var); |
644 | - |
645 | - if (dotVar) |
646 | + if (dotVar && dotVar->get_kind() != var_expr::prolog_var) |
647 | + { |
648 | + expr* dotVarRef = DOT_REF; |
649 | + |
650 | + push_scope(); |
651 | + |
652 | + var_expr* substVar = bind_var(loc, getDotVarName(), var_expr::local_var); |
653 | + |
654 | + // Must set the id of the substVar if we are coming here from a |
655 | + // FunctionLookupIterator. |
656 | substVar->set_unique_id(dotVar->get_unique_id()); |
657 | |
658 | - fiExpr->add_variable(dotVarRef, substVar, substVar->get_name(), false); |
659 | - |
660 | - body = generate_fn_body(f, foArgs, loc); |
661 | - |
662 | - pop_scope(); |
663 | + fiExpr->add_variable(dotVarRef, substVar); |
664 | + |
665 | + body = generate_fn_body(f, foArgs, loc); |
666 | + |
667 | + pop_scope(); |
668 | + } |
669 | + else |
670 | + { |
671 | + body = generate_fn_body(f, foArgs, loc); |
672 | + } |
673 | |
674 | break; |
675 | } |
676 | case FunctionConsts::FN_FUNCTION_LOOKUP_2: |
677 | { |
678 | - expr* ctxItemVRef = NULL; |
679 | - expr* ctxPosVRef = NULL; |
680 | - expr* ctxSizeVRef = NULL; |
681 | + bool varAdded = false; |
682 | |
683 | var_expr* ctxItemVar = lookup_var(getDotVarName(), loc, false); |
684 | var_expr* ctxPosVar = lookup_var(getDotPosVarName(), loc, false); |
685 | var_expr* ctxSizeVar = lookup_var(getLastIdxVarName(), loc, false); |
686 | |
687 | - if (ctxItemVar) |
688 | - ctxItemVRef = DOT_REF; |
689 | - |
690 | - if (ctxPosVar) |
691 | - ctxPosVRef = DOT_POS_REF; |
692 | - |
693 | - if (ctxSizeVar) |
694 | - ctxSizeVRef = DOT_SIZE_REF; |
695 | - |
696 | - push_scope(); |
697 | - |
698 | - var_expr* substItemVar = bind_var(loc, getDotVarName(), var_expr::hof_var); |
699 | - var_expr* substPosVar = bind_var(loc, getDotPosVarName(), var_expr::hof_var); |
700 | - var_expr* substSizeVar = bind_var(loc, getLastIdxVarName(), var_expr::hof_var); |
701 | - |
702 | - if (ctxItemVar) |
703 | - substItemVar->set_unique_id(ctxItemVar->get_unique_id()); |
704 | - |
705 | - if (ctxPosVar) |
706 | - substPosVar->set_unique_id(ctxPosVar->get_unique_id()); |
707 | - |
708 | - if (ctxSizeVar) |
709 | - substSizeVar->set_unique_id(ctxSizeVar->get_unique_id()); |
710 | - |
711 | - fiExpr->add_variable(ctxItemVRef, |
712 | - substItemVar, |
713 | - substItemVar->get_name(), |
714 | - ctxItemVar->get_kind() == var_expr::prolog_var ? 1 : 0); |
715 | - |
716 | - fiExpr->add_variable(ctxPosVRef, |
717 | - substPosVar, |
718 | - substPosVar->get_name(), |
719 | - ctxPosVar->get_kind() == var_expr::prolog_var ? 1 : 0); |
720 | - |
721 | - fiExpr->add_variable(ctxSizeVRef, |
722 | - substSizeVar, |
723 | - substSizeVar->get_name(), |
724 | - ctxSizeVar->get_kind() == var_expr::prolog_var ? 1 : 0); |
725 | + if (ctxItemVar && ctxItemVar->get_kind() != var_expr::prolog_var) |
726 | + { |
727 | + expr* ctxVRef = DOT_REF; |
728 | + |
729 | + push_scope(); |
730 | + varAdded = true; |
731 | + |
732 | + var_expr* substVar = bind_var(loc, getDotVarName(), var_expr::local_var); |
733 | + |
734 | + substVar->set_unique_id(ctxItemVar->get_unique_id()); |
735 | + |
736 | + fiExpr->add_variable(ctxVRef, substVar); |
737 | + } |
738 | + |
739 | + if (ctxPosVar && ctxPosVar->get_kind() != var_expr::prolog_var) |
740 | + { |
741 | + expr* ctxVRef = DOT_POS_REF; |
742 | + |
743 | + if (!varAdded) |
744 | + { |
745 | + push_scope(); |
746 | + varAdded = true; |
747 | + } |
748 | + |
749 | + var_expr* substVar = bind_var(loc, getDotPosVarName(), var_expr::local_var); |
750 | + |
751 | + substVar->set_unique_id(ctxPosVar->get_unique_id()); |
752 | + |
753 | + fiExpr->add_variable(ctxVRef, substVar); |
754 | + } |
755 | + |
756 | + if (ctxSizeVar && ctxSizeVar->get_kind() != var_expr::prolog_var) |
757 | + { |
758 | + expr* ctxVRef = DOT_SIZE_REF; |
759 | + |
760 | + if (!varAdded) |
761 | + { |
762 | + push_scope(); |
763 | + varAdded = true; |
764 | + } |
765 | + |
766 | + var_expr* substVar = bind_var(loc, getLastIdxVarName(), var_expr::local_var); |
767 | + |
768 | + substVar->set_unique_id(ctxSizeVar->get_unique_id()); |
769 | + |
770 | + fiExpr->add_variable(ctxVRef, substVar); |
771 | + } |
772 | |
773 | body = generate_fn_body(f, foArgs, loc); |
774 | |
775 | - pop_scope(); |
776 | + if (varAdded) |
777 | + pop_scope(); |
778 | |
779 | break; |
780 | } |
781 | @@ -12248,7 +12284,7 @@ |
782 | |
783 | udf->setArgVars(udfArgs); |
784 | udf->setBody(body); |
785 | - udf->setOptimized(true); // TODO: this should not be set here |
786 | + udf->setOptimized(true); // hof ???? |
787 | } // if builtin function |
788 | else |
789 | { |
790 | @@ -12290,9 +12326,9 @@ |
791 | // Handle function parameters. Translation of the params, if any, results to |
792 | // a flwor expr with one let binding for each function parameter: |
793 | // |
794 | - // let $x1 as T1 := _x1 |
795 | + // let $x1 := _x1 |
796 | // ..... |
797 | - // let $xN as TN := _xN |
798 | + // let $xN := _xN |
799 | // |
800 | // where each _xi is an arg var. |
801 | rchandle<ParamList> params = v.getParamList(); |
802 | @@ -12315,35 +12351,24 @@ |
803 | var_expr* varExpr = (*ite)->getVar(); |
804 | var_expr::var_kind kind = varExpr->get_kind(); |
805 | |
806 | - if (kind == var_expr::local_var) |
807 | - { |
808 | + if (kind == var_expr::prolog_var) |
809 | continue; |
810 | - } |
811 | - |
812 | - store::Item_t qname = varExpr->get_name(); |
813 | |
814 | var_expr* subst_var; |
815 | - if (kind != var_expr::prolog_var) |
816 | - { |
817 | - try |
818 | - { |
819 | - subst_var = bind_var(loc, qname, var_expr::hof_var); |
820 | - } |
821 | - catch(XQueryException& e) |
822 | - { |
823 | - if (e.diagnostic() == err::XQST0049) |
824 | - continue; |
825 | - else |
826 | - throw; |
827 | - } |
828 | - |
829 | - fiExpr->add_variable(varExpr, subst_var, varExpr->get_name(), 0); |
830 | - } |
831 | - else |
832 | - { |
833 | - subst_var = varExpr; |
834 | - fiExpr->add_variable(NULL, subst_var, varExpr->get_name(), 1); |
835 | - } |
836 | + |
837 | + try |
838 | + { |
839 | + subst_var = bind_var(loc, varExpr->get_name(), var_expr::local_var); |
840 | + } |
841 | + catch(XQueryException& e) |
842 | + { |
843 | + if (e.diagnostic() == err::XQST0049) |
844 | + continue; |
845 | + else |
846 | + throw; |
847 | + } |
848 | + |
849 | + fiExpr->add_variable(varExpr, subst_var); |
850 | } |
851 | |
852 | if (flwor->num_clauses() > 0) |
853 | @@ -12395,7 +12420,7 @@ |
854 | } |
855 | } |
856 | |
857 | - create_inline_function(body, flwor, paramTypes, returnType, loc); |
858 | + generate_inline_function(body, flwor, paramTypes, returnType, loc); |
859 | |
860 | // pop the scope. |
861 | pop_scope(); |
862 | @@ -12405,7 +12430,7 @@ |
863 | /******************************************************************************* |
864 | |
865 | ********************************************************************************/ |
866 | -void create_inline_function( |
867 | +void generate_inline_function( |
868 | expr* body, |
869 | flwor_expr* flwor, |
870 | const std::vector<xqtref_t>& paramTypes, |
871 | @@ -12414,7 +12439,7 @@ |
872 | { |
873 | std::vector<var_expr*> argVars; |
874 | |
875 | - // Wrap the body in appropriate type op. |
876 | + // Wrap the body in appropriate type op. hof ???? |
877 | if (returnType->isBuiltinAtomicAny()) |
878 | { |
879 | body = wrap_in_type_promotion(body, returnType, PROMOTE_TYPE_PROMOTION); |
880 | @@ -12480,14 +12505,14 @@ |
881 | udf->setBody(body); |
882 | udf->setScriptingKind(body->get_scripting_detail()); |
883 | udf->setArgVars(argVars); |
884 | - udf->setOptimized(true); // TODO: this should not be set here |
885 | + udf->setOptimized(true); // hof ???? |
886 | |
887 | // Get the function_item_expr and set its function to the udf created above. |
888 | function_item_expr* fiExpr = dynamic_cast<function_item_expr*>(theNodeStack.top()); |
889 | assert(fiExpr != NULL); |
890 | fiExpr->set_function(udf, udf->numArgs()); |
891 | |
892 | - if (theCCB->theConfig.translate_cb != NULL && theCCB->theConfig.optimize_cb == NULL) |
893 | + if (theCCB->theConfig.translate_cb != NULL) |
894 | theCCB->theConfig.translate_cb(udf->getBody(), |
895 | udf->getName()->getStringValue().c_str()); |
896 | } |
897 | @@ -12557,11 +12582,6 @@ |
898 | void* begin_visit(const JSONArrayConstructor& v) |
899 | { |
900 | TRACE_VISIT(); |
901 | - |
902 | -#ifndef ZORBA_WITH_JSON |
903 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
904 | -#endif |
905 | - |
906 | return no_state; |
907 | } |
908 | |
909 | @@ -12569,7 +12589,6 @@ |
910 | { |
911 | TRACE_VISIT_OUT(); |
912 | |
913 | -#ifdef ZORBA_WITH_JSON |
914 | expr* contentExpr = NULL; |
915 | |
916 | if (v.get_expr() != NULL) |
917 | @@ -12577,8 +12596,7 @@ |
918 | contentExpr = pop_nodestack(); |
919 | } |
920 | |
921 | - push_nodestack(theExprManager->create_json_array_expr(theRootSctx, theUDF, loc, contentExpr)); |
922 | -#endif |
923 | + push_nodestack(CREATE(json_array)(theRootSctx, theUDF, loc, contentExpr)); |
924 | } |
925 | |
926 | |
927 | @@ -12592,9 +12610,6 @@ |
928 | void* begin_visit(const JSONObjectConstructor& v) |
929 | { |
930 | TRACE_VISIT(); |
931 | -#ifndef ZORBA_WITH_JSON |
932 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
933 | -#endif |
934 | return no_state; |
935 | } |
936 | |
937 | @@ -12602,7 +12617,6 @@ |
938 | { |
939 | TRACE_VISIT_OUT(); |
940 | |
941 | -#ifdef ZORBA_WITH_JSON |
942 | expr* contentExpr = NULL; |
943 | |
944 | if (v.get_expr() != NULL) |
945 | @@ -12626,7 +12640,6 @@ |
946 | v.get_accumulate()); |
947 | |
948 | push_nodestack(jo); |
949 | -#endif |
950 | } |
951 | |
952 | |
953 | @@ -12638,9 +12651,6 @@ |
954 | void* begin_visit(const JSONDirectObjectConstructor& v) |
955 | { |
956 | TRACE_VISIT(); |
957 | -#ifndef ZORBA_WITH_JSON |
958 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
959 | -#endif |
960 | return no_state; |
961 | } |
962 | |
963 | @@ -12648,7 +12658,6 @@ |
964 | { |
965 | TRACE_VISIT_OUT(); |
966 | |
967 | -#ifdef ZORBA_WITH_JSON |
968 | csize numPairs = v.numPairs(); |
969 | std::vector<expr*> names(numPairs); |
970 | std::vector<expr*> values(numPairs); |
971 | @@ -12663,7 +12672,6 @@ |
972 | create_json_direct_object_expr(theRootSctx, theUDF, loc, names, values); |
973 | |
974 | push_nodestack(jo); |
975 | -#endif |
976 | } |
977 | |
978 | |
979 | @@ -12696,11 +12704,6 @@ |
980 | void* begin_visit(const JSONPairConstructor& v) |
981 | { |
982 | TRACE_VISIT (); |
983 | -#ifndef ZORBA_WITH_JSON |
984 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
985 | -#else |
986 | -#endif |
987 | - |
988 | return no_state; |
989 | } |
990 | |
991 | @@ -12708,7 +12711,6 @@ |
992 | { |
993 | TRACE_VISIT_OUT(); |
994 | |
995 | -#ifdef ZORBA_WITH_JSON |
996 | expr* nameExpr = pop_nodestack(); |
997 | expr* valueExpr = pop_nodestack(); |
998 | |
999 | @@ -12729,7 +12731,6 @@ |
1000 | |
1001 | push_nodestack(valueExpr); |
1002 | push_nodestack(nameExpr); |
1003 | -#endif |
1004 | } |
1005 | |
1006 | |
1007 | @@ -13132,7 +13133,7 @@ |
1008 | void begin_check_boundary_whitespace() |
1009 | { |
1010 | if (theSctx->boundary_space_mode() == StaticContextConsts::strip_space) |
1011 | -{ |
1012 | + { |
1013 | theIsWSBoundaryStack.push(true); |
1014 | thePossibleWSContentStack.push(0); |
1015 | } |
1016 | @@ -13159,7 +13160,8 @@ |
1017 | { |
1018 | thePossibleWSContentStack.push(0); |
1019 | theIsWSBoundaryStack.push(true); |
1020 | - if (lPrev != 0) { |
1021 | + if (lPrev != 0) |
1022 | + { |
1023 | lPrev->setIsStripped(true); |
1024 | } |
1025 | } |
1026 | @@ -13171,18 +13173,23 @@ |
1027 | else |
1028 | { |
1029 | bool lCouldBe = false; |
1030 | - if (lPrevIsBoundary) { |
1031 | + if (lPrevIsBoundary) |
1032 | + { |
1033 | zstring content = v.get_elem_content().str(); |
1034 | utf8::trim_whitespace(content); |
1035 | |
1036 | // Filtering out of whitespaces |
1037 | - if (content.empty()) { |
1038 | + if (content.empty()) |
1039 | + { |
1040 | lCouldBe = true; |
1041 | } |
1042 | } |
1043 | - if (lCouldBe) { |
1044 | + if (lCouldBe) |
1045 | + { |
1046 | thePossibleWSContentStack.push(&v); |
1047 | - } else { |
1048 | + } |
1049 | + else |
1050 | + { |
1051 | thePossibleWSContentStack.push(0); |
1052 | } |
1053 | theIsWSBoundaryStack.push(false); |
1054 | @@ -13190,15 +13197,17 @@ |
1055 | } |
1056 | } |
1057 | |
1058 | -/** |
1059 | - * Deletes the entries in theIsWSBoundaryStack and thePossibleWSContentStack. If thePossibleWSContentStack |
1060 | - * contains an item, this item is boundary whitespace because end of content is a boundary. |
1061 | - */ |
1062 | + |
1063 | +/******************************************************************************* |
1064 | + Deletes the entries in theIsWSBoundaryStack and thePossibleWSContentStack. If |
1065 | + thePossibleWSContentStack contains an item, this item is boundary whitespace |
1066 | + because end of content is a boundary. |
1067 | +********************************************************************************/ |
1068 | void end_check_boundary_whitespace() |
1069 | { |
1070 | if (theSctx->boundary_space_mode() == StaticContextConsts::strip_space) |
1071 | { |
1072 | - const DirElemContent* lPrev = translator_ns::pop_stack (thePossibleWSContentStack); |
1073 | + const DirElemContent* lPrev = translator_ns::pop_stack(thePossibleWSContentStack); |
1074 | if (lPrev != 0) |
1075 | { |
1076 | lPrev->setIsStripped(true); |
1077 | @@ -13263,8 +13272,7 @@ |
1078 | } |
1079 | else if (args.size() > 1) |
1080 | { |
1081 | - fo_expr* expr_list = theExprManager-> |
1082 | - create_fo_expr(theRootSctx, theUDF, loc, op_concatenate, args); |
1083 | + fo_expr* expr_list = CREATE(fo)(theRootSctx, theUDF, loc, op_concatenate, args); |
1084 | |
1085 | normalize_fo(expr_list); |
1086 | |
1087 | @@ -13401,7 +13409,7 @@ |
1088 | curRef++; |
1089 | } |
1090 | |
1091 | - expr* lConstExpr = theExprManager->create_const_expr(theRootSctx, theUDF, loc, content); |
1092 | + expr* lConstExpr = CREATE(const)(theRootSctx, theUDF, loc, content); |
1093 | push_nodestack(lConstExpr); |
1094 | break; |
1095 | } |
1096 | @@ -13410,8 +13418,8 @@ |
1097 | // we always create a text node here because if we are in an attribute, we atomice |
1098 | // the text node into its string value |
1099 | zstring content("{"); |
1100 | - expr* lConstExpr = theExprManager->create_const_expr(theRootSctx, theUDF, loc, content); |
1101 | - push_nodestack ( lConstExpr ); |
1102 | + expr* lConstExpr = CREATE(const)(theRootSctx, theUDF, loc, content); |
1103 | + push_nodestack (lConstExpr); |
1104 | break; |
1105 | } |
1106 | case ParseConstants::cont_escape_rbrace: |
1107 | @@ -13420,7 +13428,7 @@ |
1108 | // the text node into its string value |
1109 | zstring content("}"); |
1110 | expr* lConstExpr = CREATE(const)(theRootSctx, theUDF, loc, content); |
1111 | - push_nodestack ( lConstExpr ); |
1112 | + push_nodestack (lConstExpr); |
1113 | break; |
1114 | } |
1115 | case ParseConstants::cont_expr: |
1116 | @@ -13475,10 +13483,10 @@ |
1117 | if (target_upper == "XML") |
1118 | RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_PiTarget))); |
1119 | |
1120 | - expr* target = theExprManager->create_const_expr(theRootSctx, theUDF, loc, target_str); |
1121 | - expr* content = theExprManager->create_const_expr(theRootSctx, theUDF, loc, v.get_pi_content().str()); |
1122 | + expr* target = CREATE(const)(theRootSctx, theUDF, loc, target_str); |
1123 | + expr* content = CREATE(const)(theRootSctx, theUDF, loc, v.get_pi_content().str()); |
1124 | |
1125 | - push_nodestack(theExprManager->create_pi_expr(theRootSctx, theUDF, loc, target, content)); |
1126 | + push_nodestack(CREATE(pi)(theRootSctx, theUDF, loc, target, content)); |
1127 | } |
1128 | |
1129 | |
1130 | @@ -13880,18 +13888,13 @@ |
1131 | void* begin_visit(const StructuredItemType& v) |
1132 | { |
1133 | TRACE_VISIT(); |
1134 | -#ifndef ZORBA_WITH_JSON |
1135 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1136 | -#endif |
1137 | return no_state; |
1138 | } |
1139 | |
1140 | void end_visit(const StructuredItemType& v, void* /*visit_state*/) |
1141 | { |
1142 | TRACE_VISIT_OUT(); |
1143 | -#ifdef ZORBA_WITH_JSON |
1144 | theTypeStack.push(GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_ONE); |
1145 | -#endif |
1146 | } |
1147 | |
1148 | |
1149 | @@ -13910,16 +13913,13 @@ |
1150 | void* begin_visit(const JSON_Test& v) |
1151 | { |
1152 | TRACE_VISIT(); |
1153 | -#ifndef ZORBA_WITH_JSON |
1154 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1155 | -#endif |
1156 | return no_state; |
1157 | } |
1158 | |
1159 | void end_visit(const JSON_Test& v, void* /*visit_state*/) |
1160 | { |
1161 | TRACE_VISIT_OUT(); |
1162 | -#ifdef ZORBA_WITH_JSON |
1163 | + |
1164 | RootTypeManager& rtm = GENV_TYPESYSTEM; |
1165 | |
1166 | switch (v.get_kind()) |
1167 | @@ -13943,7 +13943,6 @@ |
1168 | default: |
1169 | ZORBA_ASSERT(false); |
1170 | } |
1171 | -#endif /* ZORBA_WITH_JSON */ |
1172 | } |
1173 | |
1174 | |
1175 | @@ -14462,6 +14461,7 @@ |
1176 | theTypeStack.push(GENV_TYPESYSTEM.ANY_FUNCTION_TYPE_STAR); |
1177 | } |
1178 | |
1179 | + |
1180 | void* begin_visit(const TypeList& v) |
1181 | { |
1182 | TRACE_VISIT (); |
1183 | @@ -14473,12 +14473,14 @@ |
1184 | TRACE_VISIT_OUT(); |
1185 | } |
1186 | |
1187 | + |
1188 | void* begin_visit(const TypedFunctionTest& v) |
1189 | { |
1190 | TRACE_VISIT(); |
1191 | return no_state; |
1192 | } |
1193 | |
1194 | + |
1195 | void end_visit(const TypedFunctionTest& v, void* /*visit_state*/) |
1196 | { |
1197 | TRACE_VISIT_OUT (); |
1198 | @@ -14533,9 +14535,6 @@ |
1199 | void* begin_visit(const JSONObjectInsertExpr& v) |
1200 | { |
1201 | TRACE_VISIT(); |
1202 | -#ifndef ZORBA_WITH_JSON |
1203 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1204 | -#endif |
1205 | return no_state; |
1206 | } |
1207 | |
1208 | @@ -14544,7 +14543,6 @@ |
1209 | { |
1210 | TRACE_VISIT_OUT(); |
1211 | |
1212 | -#ifdef ZORBA_WITH_JSON |
1213 | RootTypeManager& rtm = GENV_TYPESYSTEM; |
1214 | |
1215 | expr* targetExpr = pop_nodestack(); |
1216 | @@ -14573,7 +14571,6 @@ |
1217 | args); |
1218 | |
1219 | push_nodestack(updExpr); |
1220 | -#endif |
1221 | } |
1222 | |
1223 | |
1224 | @@ -14584,9 +14581,6 @@ |
1225 | void* begin_visit(const JSONArrayInsertExpr& v) |
1226 | { |
1227 | TRACE_VISIT(); |
1228 | -#ifndef ZORBA_WITH_JSON |
1229 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1230 | -#endif |
1231 | return no_state; |
1232 | } |
1233 | |
1234 | @@ -14595,7 +14589,6 @@ |
1235 | { |
1236 | TRACE_VISIT_OUT(); |
1237 | |
1238 | -#ifdef ZORBA_WITH_JSON |
1239 | RootTypeManager& rtm = GENV_TYPESYSTEM; |
1240 | |
1241 | expr* posExpr = pop_nodestack(); |
1242 | @@ -14626,7 +14619,6 @@ |
1243 | normalize_fo(updExpr); |
1244 | |
1245 | push_nodestack(updExpr); |
1246 | -#endif |
1247 | } |
1248 | |
1249 | |
1250 | @@ -14636,9 +14628,6 @@ |
1251 | void* begin_visit(const JSONArrayAppendExpr& v) |
1252 | { |
1253 | TRACE_VISIT(); |
1254 | -#ifndef ZORBA_WITH_JSON |
1255 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1256 | -#endif |
1257 | return no_state; |
1258 | } |
1259 | |
1260 | @@ -14647,7 +14636,6 @@ |
1261 | { |
1262 | TRACE_VISIT_OUT(); |
1263 | |
1264 | -#ifdef ZORBA_WITH_JSON |
1265 | expr* targetExpr = pop_nodestack(); |
1266 | expr* contentExpr = pop_nodestack(); |
1267 | |
1268 | @@ -14667,7 +14655,6 @@ |
1269 | normalize_fo(updExpr); |
1270 | |
1271 | push_nodestack(updExpr); |
1272 | -#endif |
1273 | } |
1274 | |
1275 | |
1276 | @@ -14687,9 +14674,6 @@ |
1277 | void* begin_visit(const JSONDeleteExpr& v) |
1278 | { |
1279 | TRACE_VISIT(); |
1280 | -#ifndef ZORBA_WITH_JSON |
1281 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1282 | -#endif |
1283 | return no_state; |
1284 | } |
1285 | |
1286 | @@ -14698,7 +14682,6 @@ |
1287 | { |
1288 | TRACE_VISIT_OUT(); |
1289 | |
1290 | -#ifdef ZORBA_WITH_JSON |
1291 | expr* selExpr = pop_nodestack(); |
1292 | expr* targetExpr = pop_nodestack(); |
1293 | |
1294 | @@ -14721,7 +14704,6 @@ |
1295 | selExpr); |
1296 | |
1297 | push_nodestack(updExpr); |
1298 | -#endif |
1299 | } |
1300 | |
1301 | |
1302 | @@ -14731,9 +14713,6 @@ |
1303 | void* begin_visit(const JSONReplaceExpr& v) |
1304 | { |
1305 | TRACE_VISIT(); |
1306 | -#ifndef ZORBA_WITH_JSON |
1307 | - RAISE_ERROR_NO_PARAMS(err::XPST0003, loc); |
1308 | -#endif |
1309 | return no_state; |
1310 | } |
1311 | |
1312 | @@ -14742,7 +14721,6 @@ |
1313 | { |
1314 | TRACE_VISIT_OUT(); |
1315 | |
1316 | -#ifdef ZORBA_WITH_JSON |
1317 | expr* valueExpr = pop_nodestack(); |
1318 | expr* selExpr = pop_nodestack(); |
1319 | expr* targetExpr = pop_nodestack(); |
1320 | @@ -14772,7 +14750,6 @@ |
1321 | args); |
1322 | |
1323 | push_nodestack(updExpr); |
1324 | -#endif |
1325 | } |
1326 | |
1327 | |
1328 | |
1329 | === modified file 'src/functions/udf.cpp' |
1330 | --- src/functions/udf.cpp 2013-03-17 13:55:28 +0000 |
1331 | +++ src/functions/udf.cpp 2013-04-24 02:27:27 +0000 |
1332 | @@ -111,7 +111,7 @@ |
1333 | if (ar.is_serializing_out()) |
1334 | { |
1335 | uint32_t planStateSize; |
1336 | - getPlan(planStateSize); |
1337 | + getPlan(planStateSize, 1); |
1338 | ZORBA_ASSERT(thePlan != NULL); |
1339 | |
1340 | computeResultCaching(theCCB->theXQueryDiagnostics); |
1341 | @@ -149,7 +149,7 @@ |
1342 | } |
1343 | |
1344 | invalidatePlan(); |
1345 | - getPlan(planStateSize); |
1346 | + getPlan(planStateSize, 1); |
1347 | ZORBA_ASSERT(thePlan != NULL); |
1348 | } |
1349 | } |
1350 | @@ -522,7 +522,7 @@ |
1351 | /******************************************************************************* |
1352 | |
1353 | ********************************************************************************/ |
1354 | -PlanIter_t user_function::getPlan(uint32_t& planStateSize) |
1355 | +PlanIter_t user_function::getPlan(uint32_t& planStateSize, ulong nextVarId) |
1356 | { |
1357 | if (thePlan == NULL) |
1358 | { |
1359 | @@ -539,11 +539,10 @@ |
1360 | argVarToRefsMap.put((uint64_t)&*theArgVars[i], &theArgVarsRefs[i]); |
1361 | } |
1362 | |
1363 | - ulong nextVarId = 1; |
1364 | const store::Item* lName = getName(); |
1365 | //lName may be null of inlined functions |
1366 | thePlan = zorba::codegen((lName == 0 ? |
1367 | - "inline function" : |
1368 | + "inline-function" : |
1369 | lName->getStringValue().c_str()), |
1370 | &*theBodyExpr, |
1371 | theCCB, |
1372 | |
1373 | === modified file 'src/functions/udf.h' |
1374 | --- src/functions/udf.h 2013-04-10 21:01:35 +0000 |
1375 | +++ src/functions/udf.h 2013-04-24 02:27:27 +0000 |
1376 | @@ -118,7 +118,7 @@ |
1377 | |
1378 | unsigned short theScriptingKind; |
1379 | |
1380 | - expr* theBodyExpr; |
1381 | + expr * theBodyExpr; |
1382 | std::vector<var_expr*> theArgVars; |
1383 | |
1384 | std::vector<unsigned char> theIgnoresSortedNodes; |
1385 | @@ -201,7 +201,7 @@ |
1386 | |
1387 | void optimize(); |
1388 | |
1389 | - PlanIter_t getPlan(uint32_t& planStateSize); |
1390 | + PlanIter_t getPlan(uint32_t& planStateSize, ulong nextVarId); |
1391 | |
1392 | void invalidatePlan(); |
1393 | |
1394 | |
1395 | === modified file 'src/runtime/core/fncall_iterator.cpp' |
1396 | --- src/runtime/core/fncall_iterator.cpp 2013-04-15 20:40:36 +0000 |
1397 | +++ src/runtime/core/fncall_iterator.cpp 2013-04-24 02:27:27 +0000 |
1398 | @@ -93,11 +93,12 @@ |
1399 | ********************************************************************************/ |
1400 | UDFunctionCallIteratorState::UDFunctionCallIteratorState() |
1401 | : |
1402 | + theLocalDCtx(NULL), |
1403 | + theIsLocalDCtxOwner(true), |
1404 | thePlan(NULL), |
1405 | thePlanState(NULL), |
1406 | + thePlanOpen(false), |
1407 | thePlanStateSize(0), |
1408 | - theLocalDCtx(NULL), |
1409 | - thePlanOpen(false), |
1410 | theCache(0) |
1411 | { |
1412 | } |
1413 | @@ -114,7 +115,7 @@ |
1414 | if (thePlanState != NULL) |
1415 | delete thePlanState; |
1416 | |
1417 | - if (theLocalDCtx != NULL) |
1418 | + if (theLocalDCtx != NULL && theIsLocalDCtxOwner) |
1419 | delete theLocalDCtx; |
1420 | } |
1421 | |
1422 | @@ -125,30 +126,35 @@ |
1423 | void UDFunctionCallIteratorState::open( |
1424 | PlanState& planState, |
1425 | user_function* udf, |
1426 | - bool theIsDynamic, |
1427 | - store::ItemHandle<FunctionItem>& theFunctionItem) |
1428 | + bool isDynamic, |
1429 | + store::ItemHandle<FunctionItem>& functionItem) |
1430 | { |
1431 | - thePlan = udf->getPlan(thePlanStateSize).getp(); |
1432 | - |
1433 | - thePlanStateSize = thePlan->getStateSizeOfSubtree(); |
1434 | - |
1435 | // Must allocate new dctx because the udf may be a recursive udf with local |
1436 | // block vars, all of which have the same dynamic-context id, but they are |
1437 | // distinct vars. |
1438 | |
1439 | - if (theIsDynamic) |
1440 | + if (isDynamic && functionItem->getDctx() != NULL) |
1441 | { |
1442 | - if (theFunctionItem->getDctx() == NULL) |
1443 | - theFunctionItem->setDctx(new dynamic_context(planState.theGlobalDynCtx)); |
1444 | - |
1445 | - theLocalDCtx = new dynamic_context(theFunctionItem->getDctx()); |
1446 | + thePlan = udf->getPlan(thePlanStateSize, functionItem->getMaxInScopeVarId()).getp(); |
1447 | + |
1448 | + thePlanStateSize = thePlan->getStateSizeOfSubtree(); |
1449 | + |
1450 | + theLocalDCtx = functionItem->getDctx(); |
1451 | + |
1452 | + theIsLocalDCtxOwner = false; |
1453 | } |
1454 | else |
1455 | { |
1456 | + thePlan = udf->getPlan(thePlanStateSize, 1).getp(); |
1457 | + |
1458 | + thePlanStateSize = thePlan->getStateSizeOfSubtree(); |
1459 | + |
1460 | theLocalDCtx = new dynamic_context(planState.theGlobalDynCtx); |
1461 | + |
1462 | + theIsLocalDCtxOwner = true; |
1463 | } |
1464 | |
1465 | - thePlanState = new PlanState(theIsDynamic ? theFunctionItem->getDctx() : planState.theGlobalDynCtx, |
1466 | + thePlanState = new PlanState(planState.theGlobalDynCtx, |
1467 | theLocalDCtx, |
1468 | thePlanStateSize, |
1469 | planState.theStackDepth + 1, |
1470 | |
1471 | === modified file 'src/runtime/core/fncall_iterator.h' |
1472 | --- src/runtime/core/fncall_iterator.h 2013-04-15 11:53:46 +0000 |
1473 | +++ src/runtime/core/fncall_iterator.h 2013-04-24 02:27:27 +0000 |
1474 | @@ -37,6 +37,13 @@ |
1475 | |
1476 | |
1477 | /******************************************************************************* |
1478 | + |
1479 | + theLocalDCtx: |
1480 | + ------------- |
1481 | + The dynamic context for this udf call. It is where the values of the udf's |
1482 | + local block-variables are stored. It is created during |
1483 | + UDFunctionCallIterator::openImpl(). |
1484 | + |
1485 | thePlan: |
1486 | -------- |
1487 | The runtime plan for the function body. This is created during |
1488 | @@ -52,20 +59,14 @@ |
1489 | initialized the 1st time that UDFunctionCallIterator::nextImpl() is called |
1490 | (at that time open() is invoked on thePlan). |
1491 | |
1492 | + thePlanOpen: |
1493 | + ------------ |
1494 | + Whether thePlan has been opened already or not. |
1495 | + |
1496 | thePlanStateSize: |
1497 | ----------------- |
1498 | The size of the plan state block. |
1499 | |
1500 | - theLocalDCtx: |
1501 | - ------------- |
1502 | - The dynamic context for this udf call. It is where the values of the udf's |
1503 | - local block-variables are stored. It is created during |
1504 | - UDFunctionCallIterator::openImpl(), |
1505 | - |
1506 | - thePlanOpen: |
1507 | - ------------ |
1508 | - Whether thePlan has been opened already or not. |
1509 | - |
1510 | theArgWrappers: |
1511 | --------------- |
1512 | For each argument of this function call, theArgWrappers stores a plan iterator |
1513 | @@ -94,11 +95,12 @@ |
1514 | class UDFunctionCallIteratorState : public PlanIteratorState |
1515 | { |
1516 | public: |
1517 | + dynamic_context * theLocalDCtx; |
1518 | + bool theIsLocalDCtxOwner; |
1519 | PlanIter_t thePlan; |
1520 | PlanState * thePlanState; |
1521 | + bool thePlanOpen; |
1522 | uint32_t thePlanStateSize; |
1523 | - dynamic_context * theLocalDCtx; |
1524 | - bool thePlanOpen; |
1525 | std::vector<store::Iterator_t> theArgWrappers; |
1526 | store::Index * theCache; |
1527 | std::vector<store::TempSeq_t> theArgValues; |
1528 | @@ -118,6 +120,7 @@ |
1529 | |
1530 | |
1531 | /******************************************************************************* |
1532 | + |
1533 | theUDF: |
1534 | ------- |
1535 | Pointer to the udf object. |
1536 | @@ -127,7 +130,6 @@ |
1537 | True if this is a UDFunctionCallIterator that is allocated on the fly during |
1538 | DynamicFnCallIterator::nextImpl(). |
1539 | |
1540 | - |
1541 | theFunctionItem: |
1542 | ---------------- |
1543 | |
1544 | |
1545 | === modified file 'src/runtime/hof/fn_hof_functions_impl.cpp' |
1546 | --- src/runtime/hof/fn_hof_functions_impl.cpp 2013-04-16 20:06:08 +0000 |
1547 | +++ src/runtime/hof/fn_hof_functions_impl.cpp 2013-04-24 02:27:27 +0000 |
1548 | @@ -119,9 +119,8 @@ |
1549 | factory->createQName(ctxItemName, "", "", static_context::DOT_VAR_NAME); |
1550 | |
1551 | var_expr* ve = ccb->theEM-> |
1552 | - create_var_expr(impSctx, NULL, loc, var_expr::prolog_var, ctxItemName); |
1553 | + create_var_expr(impSctx, NULL, loc, var_expr::local_var, ctxItemName); |
1554 | |
1555 | - ve->set_external(true); |
1556 | ve->set_unique_id(dynamic_context::IDVAR_CONTEXT_ITEM); |
1557 | |
1558 | impSctx->bind_var(ve, loc); |
1559 | @@ -135,9 +134,8 @@ |
1560 | factory->createQName(ctxPosName, "", "", static_context::DOT_POS_VAR_NAME); |
1561 | |
1562 | var_expr* ve = ccb->theEM-> |
1563 | - create_var_expr(impSctx, NULL, loc, var_expr::prolog_var, ctxPosName); |
1564 | + create_var_expr(impSctx, NULL, loc, var_expr::local_var, ctxPosName); |
1565 | |
1566 | - ve->set_external(true); |
1567 | ve->set_unique_id(dynamic_context::IDVAR_CONTEXT_ITEM_POSITION); |
1568 | |
1569 | impSctx->bind_var(ve, loc); |
1570 | @@ -151,9 +149,8 @@ |
1571 | factory->createQName(ctxSizeName, "", "", static_context::DOT_SIZE_VAR_NAME); |
1572 | |
1573 | var_expr* ve = ccb->theEM-> |
1574 | - create_var_expr(impSctx, NULL, loc, var_expr::prolog_var, ctxSizeName); |
1575 | + create_var_expr(impSctx, NULL, loc, var_expr::local_var, ctxSizeName); |
1576 | |
1577 | - ve->set_external(true); |
1578 | ve->set_unique_id(dynamic_context::IDVAR_CONTEXT_ITEM_SIZE); |
1579 | |
1580 | impSctx->bind_var(ve, loc); |
1581 | @@ -164,12 +161,19 @@ |
1582 | expr* fiExpr = |
1583 | Translator::translate_literal_function(qname, arity, ccb, impSctx, loc); |
1584 | |
1585 | - FunctionItemInfo_t dynFnInfo = |
1586 | + FunctionItemInfo_t fiInfo = |
1587 | static_cast<function_item_expr*>(fiExpr)->get_dynamic_fn_info(); |
1588 | |
1589 | - dynFnInfo->theCCB = ccb; |
1590 | + fiInfo->theCCB = ccb; |
1591 | |
1592 | - result = new FunctionItem(dynFnInfo, fiDctx.release()); |
1593 | + if (fiInfo->numInScopeVars() > 0) |
1594 | + { |
1595 | + result = new FunctionItem(fiInfo, fiDctx.release()); |
1596 | + } |
1597 | + else |
1598 | + { |
1599 | + result = new FunctionItem(fiInfo, NULL); |
1600 | + } |
1601 | } |
1602 | catch (const ZorbaException& e) |
1603 | { |
1604 | |
1605 | === modified file 'src/runtime/hof/function_item.cpp' |
1606 | --- src/runtime/hof/function_item.cpp 2013-04-16 20:06:08 +0000 |
1607 | +++ src/runtime/hof/function_item.cpp 2013-04-24 02:27:27 +0000 |
1608 | @@ -48,6 +48,13 @@ |
1609 | SERIALIZABLE_CLASS_VERSIONS(FunctionItem) |
1610 | |
1611 | |
1612 | +//////////////////////////////////////////////////////////////////////////////// |
1613 | +// // |
1614 | +// FunctionItem // |
1615 | +// // |
1616 | +//////////////////////////////////////////////////////////////////////////////// |
1617 | + |
1618 | + |
1619 | /******************************************************************************* |
1620 | |
1621 | ********************************************************************************/ |
1622 | @@ -55,7 +62,7 @@ |
1623 | static_context* closureSctx, |
1624 | const QueryLoc& loc, |
1625 | function* func, |
1626 | - store::Item_t qname, |
1627 | + const store::Item_t& qname, |
1628 | csize arity, |
1629 | bool isInline, |
1630 | bool isCoercion) |
1631 | @@ -126,31 +133,28 @@ |
1632 | // ar & theScopedVarsValues; |
1633 | // ar & theSubstVarsValues; |
1634 | |
1635 | - ar & theScopedVarsNames; |
1636 | - ar & theIsGlobalVar; |
1637 | - ar & theVarId; |
1638 | + ar & theInScopeVarNames; |
1639 | + ar & theInScopeVarIds; |
1640 | |
1641 | - ar & theScopedVarsIterators; |
1642 | + ar & theInScopeVarIterators; |
1643 | |
1644 | if (ar.is_serializing_out()) |
1645 | { |
1646 | uint32_t planStateSize; |
1647 | - (void)static_cast<user_function*>(theFunction.getp())->getPlan(planStateSize); |
1648 | + (void)static_cast<user_function*>(theFunction.getp())->getPlan(planStateSize, 1); |
1649 | } |
1650 | } |
1651 | |
1652 | |
1653 | -void FunctionItemInfo::add_variable( |
1654 | - expr* var, |
1655 | - var_expr* substVar, |
1656 | - const store::Item_t& name, |
1657 | - int isGlobal) |
1658 | +/******************************************************************************* |
1659 | + |
1660 | +********************************************************************************/ |
1661 | +void FunctionItemInfo::add_variable(expr* var, var_expr* substVar) |
1662 | { |
1663 | - theScopedVarsValues.push_back(var); |
1664 | - theSubstVarsValues.push_back(substVar); |
1665 | - theScopedVarsNames.push_back(name); |
1666 | - theIsGlobalVar.push_back(isGlobal); |
1667 | - theVarId.push_back(substVar->get_unique_id()); |
1668 | + theInScopeVarValues.push_back(var); |
1669 | + theInScopeVars.push_back(substVar); |
1670 | + theInScopeVarNames.push_back(substVar->get_name()); |
1671 | + theInScopeVarIds.push_back(substVar->get_unique_id()); |
1672 | } |
1673 | |
1674 | |
1675 | @@ -163,18 +167,25 @@ |
1676 | { |
1677 | } |
1678 | |
1679 | - |
1680 | -FunctionItem::FunctionItem( |
1681 | - const FunctionItemInfo_t& dynamicFunctionInfo, |
1682 | - dynamic_context* dctx) |
1683 | +//////////////////////////////////////////////////////////////////////////////// |
1684 | +// // |
1685 | +// FunctionItem // |
1686 | +// // |
1687 | +//////////////////////////////////////////////////////////////////////////////// |
1688 | + |
1689 | + |
1690 | +/******************************************************************************* |
1691 | + |
1692 | +********************************************************************************/ |
1693 | +FunctionItem::FunctionItem(const FunctionItemInfo_t& fiInfo, dynamic_context* dctx) |
1694 | : |
1695 | store::Item(store::Item::FUNCTION), |
1696 | - theFunctionItemInfo(dynamicFunctionInfo), |
1697 | - theArity(dynamicFunctionInfo->theArity), |
1698 | + theFunctionItemInfo(fiInfo), |
1699 | + theArity(fiInfo->theArity), |
1700 | theClosureDctx(dctx) |
1701 | { |
1702 | assert(theFunctionItemInfo->theFunction->isUdf()); |
1703 | - theArgumentsValues.resize(theFunctionItemInfo->theArity); |
1704 | + theArgValues.resize(theArity); |
1705 | |
1706 | #if 0 |
1707 | if (theFunctionItemInfo->theFunction->getName() != NULL) |
1708 | @@ -188,6 +199,9 @@ |
1709 | } |
1710 | |
1711 | |
1712 | +/******************************************************************************* |
1713 | + |
1714 | +********************************************************************************/ |
1715 | FunctionItem::~FunctionItem() |
1716 | { |
1717 | #if 0 |
1718 | @@ -202,81 +216,107 @@ |
1719 | } |
1720 | |
1721 | |
1722 | +/******************************************************************************* |
1723 | + |
1724 | +********************************************************************************/ |
1725 | void FunctionItem::serialize(::zorba::serialization::Archiver& ar) |
1726 | { |
1727 | ar & theFunctionItemInfo; |
1728 | ar & theArity; |
1729 | - ar & theArgumentsValues; |
1730 | + ar & theArgValues; |
1731 | } |
1732 | |
1733 | |
1734 | +/******************************************************************************* |
1735 | + |
1736 | +********************************************************************************/ |
1737 | const store::Item_t FunctionItem::getFunctionName() const |
1738 | { |
1739 | return theFunctionItemInfo->theQName; |
1740 | } |
1741 | |
1742 | |
1743 | -csize FunctionItem::getArity() const |
1744 | -{ |
1745 | - return theArity; |
1746 | -} |
1747 | - |
1748 | - |
1749 | +/******************************************************************************* |
1750 | + Returns the arity of the function before any partial application |
1751 | +********************************************************************************/ |
1752 | csize FunctionItem::getStartArity() const |
1753 | { |
1754 | return theFunctionItemInfo->theArity; |
1755 | } |
1756 | |
1757 | |
1758 | +/******************************************************************************* |
1759 | + |
1760 | +********************************************************************************/ |
1761 | const signature& FunctionItem::getSignature() const |
1762 | { |
1763 | return theFunctionItemInfo->theFunction->getSignature(); |
1764 | } |
1765 | |
1766 | |
1767 | -const std::vector<PlanIter_t>& FunctionItem::getArgumentsValues() const |
1768 | -{ |
1769 | - return theArgumentsValues; |
1770 | -} |
1771 | - |
1772 | - |
1773 | -bool FunctionItem::isArgumentApplied(unsigned int pos) const |
1774 | -{ |
1775 | - assert(pos < theArgumentsValues.size()); |
1776 | - return (theArgumentsValues[pos].getp() != NULL); |
1777 | -} |
1778 | - |
1779 | - |
1780 | -void FunctionItem::setArgumentValue(unsigned int pos, const PlanIter_t& value) |
1781 | +/******************************************************************************* |
1782 | + This function will return true if the pos-th argument of the function |
1783 | + has been partially applied, i.e. theArgumentsValues[pos] is not NULL |
1784 | +********************************************************************************/ |
1785 | +bool FunctionItem::isArgumentApplied(csize pos) const |
1786 | +{ |
1787 | + assert(pos < theArgValues.size()); |
1788 | + return (theArgValues[pos].getp() != NULL); |
1789 | +} |
1790 | + |
1791 | + |
1792 | +/******************************************************************************* |
1793 | + |
1794 | +********************************************************************************/ |
1795 | +void FunctionItem::setArgumentValue(csize pos, const PlanIter_t& value) |
1796 | { |
1797 | theArity--; |
1798 | |
1799 | // find the pos-th NULL value and fill it |
1800 | - for (unsigned int i=0; i<theArgumentsValues.size(); i++) |
1801 | - if (theArgumentsValues[i] == NULL) |
1802 | + for (csize i = 0; i < theArgValues.size(); ++i) |
1803 | + { |
1804 | + if (theArgValues[i] == NULL) |
1805 | { |
1806 | if (pos == 0) |
1807 | { |
1808 | - theArgumentsValues[i] = value; |
1809 | + theArgValues[i] = value; |
1810 | return; |
1811 | } |
1812 | else |
1813 | + { |
1814 | pos--; |
1815 | + } |
1816 | } |
1817 | + } |
1818 | |
1819 | assert(false); |
1820 | } |
1821 | |
1822 | |
1823 | +/******************************************************************************* |
1824 | + |
1825 | +********************************************************************************/ |
1826 | +ulong FunctionItem::getMaxInScopeVarId() const |
1827 | +{ |
1828 | + return theFunctionItemInfo-> |
1829 | + theInScopeVarIds[theFunctionItemInfo->theInScopeVarIds.size()-1]; |
1830 | +} |
1831 | + |
1832 | + |
1833 | +/******************************************************************************* |
1834 | + The getImplementation function assumes the dynChildren vector comes from a |
1835 | + DynamicFnCallIterator, and as such, the first element of dynChildren is |
1836 | + the function item itself, so it will be skipped. |
1837 | +********************************************************************************/ |
1838 | PlanIter_t FunctionItem::getImplementation( |
1839 | const std::vector<PlanIter_t>& dynChildren, |
1840 | CompilerCB* ccb) |
1841 | { |
1842 | std::vector<PlanIter_t> args; |
1843 | - args.resize(theArgumentsValues.size()); |
1844 | + args.resize(theArgValues.size()); |
1845 | |
1846 | std::vector<PlanIter_t>::iterator argsIte = args.begin(); |
1847 | - std::vector<PlanIter_t>::iterator ite = theArgumentsValues.begin(); |
1848 | + std::vector<PlanIter_t>::iterator ite = theArgValues.begin(); |
1849 | std::vector<PlanIter_t>::const_iterator ite2 = dynChildren.begin(); |
1850 | ++ite2; // skip the first child because it's the function item |
1851 | |
1852 | @@ -313,10 +353,14 @@ |
1853 | |
1854 | udfIter->setDynamic(); |
1855 | udfIter->setFunctionItem(this); |
1856 | + |
1857 | return udfCallIterator; |
1858 | } |
1859 | |
1860 | |
1861 | +/******************************************************************************* |
1862 | + |
1863 | +********************************************************************************/ |
1864 | zstring FunctionItem::show() const |
1865 | { |
1866 | std::ostringstream lRes; |
1867 | |
1868 | === modified file 'src/runtime/hof/function_item.h' |
1869 | --- src/runtime/hof/function_item.h 2013-04-16 20:50:28 +0000 |
1870 | +++ src/runtime/hof/function_item.h 2013-04-24 02:27:27 +0000 |
1871 | @@ -109,20 +109,26 @@ |
1872 | CompilerCB * theCCB; |
1873 | |
1874 | QueryLoc theLoc; |
1875 | - static_context* theClosureSctx; |
1876 | + |
1877 | + static_context * theClosureSctx; |
1878 | + |
1879 | function_t theFunction; |
1880 | + |
1881 | store::Item_t theQName; |
1882 | + |
1883 | csize theArity; |
1884 | + |
1885 | bool theIsInline; |
1886 | + |
1887 | bool theIsCoercion; |
1888 | |
1889 | - std::vector<expr*> theScopedVarsValues; |
1890 | - std::vector<var_expr*> theSubstVarsValues; |
1891 | - std::vector<store::Item_t> theScopedVarsNames; |
1892 | - std::vector<int> theIsGlobalVar; |
1893 | - std::vector<ulong> theVarId; |
1894 | - |
1895 | - std::vector<PlanIter_t> theScopedVarsIterators; |
1896 | + std::vector<var_expr*> theInScopeVars; |
1897 | + std::vector<expr*> theInScopeVarValues; |
1898 | + |
1899 | + std::vector<store::Item_t> theInScopeVarNames; |
1900 | + std::vector<ulong> theInScopeVarIds; |
1901 | + |
1902 | + std::vector<PlanIter_t> theInScopeVarIterators; |
1903 | |
1904 | store::NsBindings theLocalBindings; |
1905 | |
1906 | @@ -136,42 +142,52 @@ |
1907 | static_context* closureSctx, |
1908 | const QueryLoc& loc, |
1909 | function* func, |
1910 | - store::Item_t qname, |
1911 | + const store::Item_t& qname, |
1912 | csize arity, |
1913 | bool isInline, |
1914 | bool isCoercion); |
1915 | |
1916 | virtual ~FunctionItemInfo(); |
1917 | |
1918 | - void add_variable( |
1919 | - expr* var, |
1920 | - var_expr* substVar, |
1921 | - const store::Item_t& name, |
1922 | - int isGlobal); |
1923 | + csize numInScopeVars() const { return theInScopeVars.size(); } |
1924 | + |
1925 | + void add_variable(expr* var, var_expr* substVar); |
1926 | }; |
1927 | |
1928 | |
1929 | /******************************************************************************* |
1930 | - A FunctionItem is created during codegen, when a function_item_expr is reached. |
1931 | - |
1932 | - theSctx : The static context of the function_item_expr. |
1933 | - theExpr : The associated function_item_expr. |
1934 | - theVariableValues : Vector of var iterators representing the values of the |
1935 | - in-scope FLWOR variables for inline function items. |
1936 | + A FunctionItem is created during FunctionItemIterator::nextImpl(). |
1937 | + |
1938 | + theFunctionItemInfo: |
1939 | + -------------------- |
1940 | + The associated function-item info. |
1941 | + |
1942 | + theArity: |
1943 | + --------- |
1944 | + The arity of the function item will decrease when a partial application is used. |
1945 | + |
1946 | + theClosureDctx: |
1947 | + --------------- |
1948 | + The dynamic context obj to be used as the local dctx of the function, when the |
1949 | + function item is dynamically invoked. This dctx is allocated during |
1950 | + FunctionItemIterator::nextImpl(). At that time it is also populated with the |
1951 | + values of the outer variables. |
1952 | + |
1953 | + theArgValues: |
1954 | + ------------- |
1955 | + |
1956 | ********************************************************************************/ |
1957 | class FunctionItem : public store::Item, public zorba::serialization::SerializeBaseClass |
1958 | { |
1959 | protected: |
1960 | FunctionItemInfo_t theFunctionItemInfo; |
1961 | |
1962 | - csize theArity; // The arity of the function |
1963 | - // item will decrease when a |
1964 | - // partial application is used. |
1965 | - |
1966 | - std::vector<PlanIter_t> theArgumentsValues; |
1967 | + csize theArity; |
1968 | |
1969 | std::auto_ptr<dynamic_context> theClosureDctx; |
1970 | |
1971 | + std::vector<PlanIter_t> theArgValues; |
1972 | + |
1973 | SYNC_CODE(mutable RCLock theRCLock;) |
1974 | |
1975 | public: |
1976 | @@ -180,48 +196,40 @@ |
1977 | void serialize(::zorba::serialization::Archiver& ar); |
1978 | |
1979 | public: |
1980 | - FunctionItem( |
1981 | - const FunctionItemInfo_t& dynamicFunctionInfo, |
1982 | - dynamic_context* dctx); |
1983 | + FunctionItem(const FunctionItemInfo_t& fiInfo, dynamic_context* dctx); |
1984 | |
1985 | ~FunctionItem(); |
1986 | |
1987 | SYNC_CODE(RCLock* getRCLock() const { return &theRCLock; }) |
1988 | |
1989 | + bool isInline() const { return theFunctionItemInfo->theIsInline; } |
1990 | + |
1991 | + bool isCoercion() const { return theFunctionItemInfo->theIsCoercion; } |
1992 | + |
1993 | + const store::Item_t getFunctionName() const; |
1994 | + |
1995 | + csize getArity() const { return theArity; } |
1996 | + |
1997 | + csize getStartArity() const; |
1998 | + |
1999 | + const signature& getSignature() const; |
2000 | + |
2001 | dynamic_context* getDctx() const { return theClosureDctx.get(); } |
2002 | |
2003 | void setDctx(dynamic_context* dctx) { theClosureDctx.reset(dctx); } |
2004 | |
2005 | - const std::vector<PlanIter_t>& getArgumentsValues() const; |
2006 | - |
2007 | - void setArgumentValue(unsigned int pos, const PlanIter_t& value); |
2008 | - |
2009 | - // This function will return true if the pos-th argument of the function |
2010 | - // has been partially applied, i.e. theArgumentsValues[pos] is not NULL |
2011 | - bool isArgumentApplied(unsigned int pos) const; |
2012 | - |
2013 | - // The getImplementation function assumes the dynChildren vector comes from a |
2014 | - // DynamicFnCallIterator, and as such, the first element of dynChildren is |
2015 | - // the function item itself, so it will be skipped. |
2016 | - // The last element(s) of dynChildren might contain DOT vars iterators. They |
2017 | - // will be picked up automatically if needed. |
2018 | + ulong getMaxInScopeVarId() const; |
2019 | + |
2020 | + const std::vector<PlanIter_t>& getArgValues() const { return theArgValues; } |
2021 | + |
2022 | + void setArgumentValue(csize pos, const PlanIter_t& value); |
2023 | + |
2024 | + bool isArgumentApplied(csize pos) const; |
2025 | + |
2026 | PlanIter_t getImplementation( |
2027 | - const std::vector<PlanIter_t>& dynChildren, |
2028 | + const std::vector<PlanIter_t>& argValues, |
2029 | CompilerCB* ccb); |
2030 | - |
2031 | - const store::Item_t getFunctionName() const; |
2032 | - |
2033 | - csize getArity() const; |
2034 | - |
2035 | - // returns the arity of the function before any partial application |
2036 | - csize getStartArity() const; |
2037 | - |
2038 | - const signature& getSignature() const; |
2039 | - |
2040 | - bool isInline() const { return theFunctionItemInfo->theIsInline; } |
2041 | - |
2042 | - bool isCoercion() const { return theFunctionItemInfo->theIsCoercion; } |
2043 | - |
2044 | + |
2045 | zstring show() const; |
2046 | }; |
2047 | |
2048 | |
2049 | === modified file 'src/runtime/hof/function_item_iter.cpp' |
2050 | --- src/runtime/hof/function_item_iter.cpp 2013-04-10 21:01:35 +0000 |
2051 | +++ src/runtime/hof/function_item_iter.cpp 2013-04-24 02:27:27 +0000 |
2052 | @@ -42,7 +42,10 @@ |
2053 | const QueryLoc& loc, |
2054 | FunctionItemInfo* fnInfo) |
2055 | : |
2056 | - NaryBaseIterator<FunctionItemIterator, PlanIteratorState>(sctx, loc, fnInfo->theScopedVarsIterators), |
2057 | + NaryBaseIterator<FunctionItemIterator, |
2058 | + PlanIteratorState>(sctx, |
2059 | + loc, |
2060 | + fnInfo->theInScopeVarIterators), |
2061 | theFunctionItemInfo(fnInfo) |
2062 | { |
2063 | } |
2064 | @@ -63,20 +66,24 @@ |
2065 | |
2066 | bool FunctionItemIterator::nextImpl(store::Item_t& result, PlanState& planState) const |
2067 | { |
2068 | + csize numOuterVars; |
2069 | PlanIteratorState* state; |
2070 | DEFAULT_STACK_INIT(PlanIteratorState, state, planState); |
2071 | |
2072 | - // This portion is taken from the eval iterator |
2073 | + numOuterVars = theFunctionItemInfo->theInScopeVarNames.size(); |
2074 | + |
2075 | + if (numOuterVars > 0) |
2076 | { |
2077 | - // Create the dynamic context for the eval query |
2078 | std::auto_ptr<dynamic_context> evalDctx; |
2079 | evalDctx.reset(new dynamic_context(planState.theGlobalDynCtx)); |
2080 | |
2081 | - // Import the outer environment. |
2082 | - importOuterEnv(planState, |
2083 | - theFunctionItemInfo->theCCB, |
2084 | - theFunctionItemInfo->theClosureSctx, |
2085 | - evalDctx.get()); |
2086 | + for (csize i = 0; i < numOuterVars; ++i) |
2087 | + { |
2088 | + // hof ???? pre-allocate the wrappers. |
2089 | + store::Iterator_t iter = new PlanIteratorWrapper(theChildren[i], planState); |
2090 | + |
2091 | + evalDctx->add_variable(theFunctionItemInfo->theInScopeVarIds[i], iter); |
2092 | + } |
2093 | |
2094 | if (theFunctionItemInfo->theIsCoercion) |
2095 | { |
2096 | @@ -89,102 +96,16 @@ |
2097 | |
2098 | result = new FunctionItem(theFunctionItemInfo, evalDctx.release()); |
2099 | } |
2100 | + else |
2101 | + { |
2102 | + result = new FunctionItem(theFunctionItemInfo, NULL); |
2103 | + } |
2104 | |
2105 | STACK_PUSH(result != NULL, state); |
2106 | STACK_END(state); |
2107 | } |
2108 | |
2109 | |
2110 | -/******************************************************************************** |
2111 | - |
2112 | - These functions are copied from the EvalIterator -- maybe they could be shared. |
2113 | - |
2114 | -********************************************************************************/ |
2115 | - |
2116 | -/****************************************************************************//** |
2117 | - This method imports a static and dynamic environment from the quter query into |
2118 | - the eval query. In particular: |
2119 | - |
2120 | - (a) imports into the importSctx all the outer vars of the eval query |
2121 | - (b) imports into the importSctx all the ns bindings of the outer query at the |
2122 | - place where the eval call appears at |
2123 | - (c) Copies all the var values from the outer-query global dctx into the eval- |
2124 | - query dctx. |
2125 | - (d) For each of the non-global outer vars, places its value into the eval dctx. |
2126 | - The var value is represented as a PlanIteratorWrapper over the subplan that |
2127 | - evaluates the domain expr of the eval var. |
2128 | - (e) Computes the max var id of all the var values set in steps (c) and (d). |
2129 | - This max varid will be passed to the compiler of the eval query so that |
2130 | - the varids that will be generated for the eval query will not conflict with |
2131 | - the varids of the outer vars and the outer-query global vars. |
2132 | -********************************************************************************/ |
2133 | -void FunctionItemIterator::importOuterEnv( |
2134 | - PlanState& planState, |
2135 | - CompilerCB* evalCCB, |
2136 | - static_context* importSctx, |
2137 | - dynamic_context* evalDctx) const |
2138 | -{ |
2139 | - // Copy all the var values from the outer-query global dctx into the eval-query |
2140 | - // dctx. This is need to handle the following scenario: (a) $x is an outer-query |
2141 | - // global var that is not among the outer vars of the eval query (because $x was |
2142 | - // hidden at the point where the eval call is made inside the outer query), and |
2143 | - // (b) foo() is a function decalred in the outer query that accessed $x and is |
2144 | - // invoked by the eval query. The copying must be done using the same positions |
2145 | - // (i.e., var ids) in the eval dctx as in the outer-query dctx. |
2146 | - |
2147 | - dynamic_context* outerDctx = evalDctx->getParent(); |
2148 | - |
2149 | - const std::vector<dynamic_context::VarValue>& outerGlobalValues = |
2150 | - outerDctx->get_variables(); |
2151 | - |
2152 | - csize numOuterGlobalVars = outerGlobalValues.size(); |
2153 | - |
2154 | - for (csize i = 0; i < numOuterGlobalVars; ++i) |
2155 | - { |
2156 | - const dynamic_context::VarValue& outerVar = outerGlobalValues[i]; |
2157 | - |
2158 | - if (!outerVar.isSet()) |
2159 | - continue; |
2160 | - |
2161 | - ulong outerVarId = static_cast<ulong>(i); |
2162 | - |
2163 | - store::Item_t itemValue; |
2164 | - store::TempSeq_t seqValue; |
2165 | - |
2166 | - if (outerVar.hasItemValue()) |
2167 | - { |
2168 | - store::Item_t value = outerVar.theValue.item; |
2169 | - evalDctx->add_variable(outerVarId, value); |
2170 | - } |
2171 | - else |
2172 | - { |
2173 | - store::Iterator_t iteValue = outerVar.theValue.temp_seq->getIterator(); |
2174 | - evalDctx->add_variable(outerVarId, iteValue); |
2175 | - } |
2176 | - } |
2177 | - |
2178 | - // Import the outer vars. Specifically, for each outer var: |
2179 | - // (a) create a declaration inside the importSctx. |
2180 | - // (b) Set its var id |
2181 | - // (c) If it is not a global one, set its value within the eval dctx. |
2182 | - csize curChild = -1; |
2183 | - |
2184 | - csize numOuterVars = theFunctionItemInfo->theScopedVarsNames.size(); |
2185 | - |
2186 | - for (csize i = 0; i < numOuterVars; ++i) |
2187 | - { |
2188 | - if (!theFunctionItemInfo->theIsGlobalVar[i]) |
2189 | - { |
2190 | - ++curChild; |
2191 | - |
2192 | - store::Iterator_t iter = new PlanIteratorWrapper(theChildren[curChild], planState); |
2193 | - |
2194 | - evalDctx->add_variable(theFunctionItemInfo->theVarId[i], iter); |
2195 | - } |
2196 | - } |
2197 | -} |
2198 | - |
2199 | - |
2200 | NARY_ACCEPT(FunctionItemIterator) |
2201 | |
2202 | |
2203 | |
2204 | === modified file 'src/runtime/hof/function_item_iter.h' |
2205 | --- src/runtime/hof/function_item_iter.h 2013-03-27 07:55:14 +0000 |
2206 | +++ src/runtime/hof/function_item_iter.h 2013-04-24 02:27:27 +0000 |
2207 | @@ -29,7 +29,8 @@ |
2208 | |
2209 | |
2210 | /******************************************************************************* |
2211 | - An iterator that creates and returns dynamic function items |
2212 | + An iterator that creates and returns a function item. The children of the |
2213 | + iterator are the subplans that compute the values of the outer variables. |
2214 | ********************************************************************************/ |
2215 | class FunctionItemIterator : public NaryBaseIterator<FunctionItemIterator, |
2216 | PlanIteratorState> |
2217 | @@ -59,13 +60,6 @@ |
2218 | void accept(PlanIterVisitor& v) const; |
2219 | |
2220 | bool nextImpl(store::Item_t& result, PlanState& planState) const; |
2221 | - |
2222 | -protected: |
2223 | - void importOuterEnv( |
2224 | - PlanState& planState, |
2225 | - CompilerCB* evalCCB, |
2226 | - static_context* importSctx, |
2227 | - dynamic_context* evalDctx) const; |
2228 | }; |
2229 | |
2230 | |
2231 | |
2232 | === modified file 'test/fots/CMakeLists.txt' |
2233 | --- test/fots/CMakeLists.txt 2013-04-23 20:25:27 +0000 |
2234 | +++ test/fots/CMakeLists.txt 2013-04-24 02:27:27 +0000 |
2235 | @@ -342,7 +342,6 @@ |
2236 | EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-029 21568) |
2237 | EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-031 21568) |
2238 | EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof113 0) |
2239 | -EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof131 0) |
2240 | EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof139 1160559) |
2241 | EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof140 0) |
2242 | EXPECTED_FOTS_FAILURE (prod-InstanceofExpr cbcl-instance-of-001 0) |
2243 | @@ -433,8 +432,6 @@ |
2244 | EXPECTED_FOTS_FAILURE (xs-token cbcl-token-004 0) |
2245 | EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-009 0) |
2246 | EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-062 0) |
2247 | -EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-402 0) |
2248 | -EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-404 0) |
2249 | EXPECTED_FOTS_FAILURE (fn-function-lookup fn-function-lookup-494 0) |
2250 | EXPECTED_FOTS_FAILURE (fn-map-pairs fn-map-pairs-026 0) |
2251 | EXPECTED_FOTS_FAILURE (misc-HigherOrderFunctions xqhof12 0) |
2252 | |
2253 | === modified file 'test/fots_driver/fots-driver.xq' |
2254 | --- test/fots_driver/fots-driver.xq 2013-04-17 23:25:47 +0000 |
2255 | +++ test/fots_driver/fots-driver.xq 2013-04-24 02:27:27 +0000 |
2256 | @@ -272,7 +272,7 @@ |
2257 | : http://dev.w3.org/2011/QT3-test-suite/guide/reporting.html: |
2258 | : |
2259 | : 'pass' The test-case was run and the assertion(s) was(were) satisfied. |
2260 | - : 'fail' The test-case was run and the assertion(s) was(were) satisfied. |
2261 | + : 'fail' The test-case was run and the assertion(s) was(were) not satisfied. |
2262 | : 'wrongError' The test-case was run; the expected results permitted an error |
2263 | : to be reported; the actual result was an error, but not with |
2264 | : the expected error code. |
2265 | @@ -436,7 +436,7 @@ |
2266 | : http://dev.w3.org/2011/QT3-test-suite/guide/reporting.html: |
2267 | : |
2268 | : 'pass' The test-case was run and the assertion(s) was(were) satisfied. |
2269 | - : 'fail' The test-case was run and the assertion(s) was(were) satisfied. |
2270 | + : 'fail' The test-case was run and the assertion(s) was(were) not satisfied. |
2271 | : 'wrongError' The test-case was run; the expected results permitted an error |
2272 | : to be reported; the actual result was an error, but not with |
2273 | : the expected error code. |
2274 | @@ -948,9 +948,9 @@ |
2275 | setting a COLLATION or COLLECTION but they still PASS even if this setting |
2276 | is not done. That is why we first run the test case. |
2277 | :) |
2278 | - else if(exists($prerequisitesError)) then |
2279 | + else if (exists($prerequisitesError)) then |
2280 | feedback:not-run($case, $prerequisitesError) |
2281 | - else if($expFailureTC/@finalStatus = "disputed") then |
2282 | + else if ($expFailureTC/@finalStatus = "disputed") then |
2283 | feedback:disputed($case, |
2284 | concat("For details please see https://www.w3.org/Bugs/Public/show_bug.cgi?id=", |
2285 | $expFailureTC/@bug)) |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ hof-next- 2013-04- 24T02-30- 54.19Z/ log.html
Log at: http://