← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/no-copy into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/no-copy into lp:zorba.

Commit message:
Fixed bug #1021492 (while computeing the "sources" of a prolog var, skip any var-setting exprs that appear in non-used (and non-optimized) functions). 

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/no-copy/+merge/128764

Fixed bug #1021492 (while computeing the "sources" of a prolog var, skip any var-setting exprs that appear in non-used (and non-optimized) functions). 
-- 
https://code.launchpad.net/~zorba-coders/zorba/no-copy/+merge/128764
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp'
--- src/compiler/rewriter/tools/dataflow_annotations.cpp	2012-10-09 14:22:18 +0000
+++ src/compiler/rewriter/tools/dataflow_annotations.cpp	2012-10-09 16:37:25 +0000
@@ -943,6 +943,9 @@
         {
           expr* setExpr = *ite2;
 
+          if (setExpr->get_udf() != NULL && !setExpr->get_udf()->isOptimized())
+            continue;
+
           if (setExpr->get_expr_kind() == var_decl_expr_kind)
           {
             findNodeSourcesRec(static_cast<var_decl_expr*>(setExpr)->get_init_expr(),

=== added file 'test/rbkt/ExpQueryResults/zorba/no-copy/eval12.xml.res'
--- test/rbkt/ExpQueryResults/zorba/no-copy/eval12.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/no-copy/eval12.xml.res	2012-10-09 16:37:25 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root><a><b><c/></b></a></root><root><a><b><c/></b></a></root><a><b><c/></b></a><b><c/></b>

=== added file 'test/rbkt/Queries/zorba/no-copy/eval12.xq'
--- test/rbkt/Queries/zorba/no-copy/eval12.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/no-copy/eval12.xq	2012-10-09 16:37:25 +0000
@@ -0,0 +1,39 @@
+
+declare namespace opt = "http://www.zorba-xquery.com/options/optimizer";;
+
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare option opt:enable "for-serialization-only";
+
+
+declare function local:dummy($n as node())
+{
+};
+
+
+declare function local:foo($n as node()) as node()*
+{
+  local:dummy($n),
+  $n/ancestor::node()
+};
+
+
+declare function local:constr($n as node()) as node()*
+{
+  local:dummy($n),
+  <root>{$n}</root>
+};
+
+
+declare variable $doc :=
+<a>
+  <b>
+    <c/>
+  </b>
+</a>
+;
+
+
+local:constr($doc)
+,
+refl:eval("local:foo(local:constr($doc)//c)")

=== added file 'test/rbkt/Queries/zorba/no-copy/eval15.xq'
--- test/rbkt/Queries/zorba/no-copy/eval15.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/no-copy/eval15.xq	2012-10-09 16:37:25 +0000
@@ -0,0 +1,43 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace an = "http://www.zorba-xquery.com/annotations";;
+
+
+declare variable $local:account  := ();
+
+
+declare function local:get-by-id($id as xs:string)
+{
+  ()
+};
+
+ 
+declare %an:sequential function local:validate() as xs:boolean 
+{
+  variable $uid := "user";
+  
+  if (true())
+  then 
+    let $account := local:get-by-id($uid)
+    return 
+      if (true())
+      then
+        if (true())
+        then 
+        {
+          $local:account := $account;
+          true()
+        } 
+        else ()
+      else ()
+  else ()
+};
+
+
+declare function local:index() 
+{
+  ()
+};
+
+
+refl:eval("local:index()")


Follow ups