← Back to team overview

zorba-coders team mailing list archive

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

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Commit message:
Fixed optimizer bug: elimination of positional variable sometimes caused elimination of whole FOR clause.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/157629

Fixed optimizer bug: elimination of positional variable sometimes causedelimination of whole FOR clause.
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/157629
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
--- src/compiler/rewriter/rules/flwor_rules.cpp	2013-02-26 09:53:26 +0000
+++ src/compiler/rewriter/rules/flwor_rules.cpp	2013-04-08 11:40:32 +0000
@@ -319,7 +319,7 @@
 
           subst_vars(rCtx, pvar, constExpr, 2);
           fc->set_pos_var(NULL);
-          folded = true;
+          modified = true;
         }
 
         if (safe_to_fold_var(i, numRefs))
@@ -360,13 +360,13 @@
 
       if (c->get_kind() == flwor_clause::for_clause)
         theFlwor->compute_return_type(false, NULL);
+    }
 
-      if (Properties::instance()->printIntermediateOpt())
-      {
-        std::cout << rCtx.theMessage << std::endl
-                  << "After folding var : " << var << " :" << std::endl;
-        rCtx.getRoot()->put(std::cout) << std::endl;
-      }
+    if (modified && Properties::instance()->printIntermediateOpt())
+    {
+      std::cout << rCtx.theMessage << std::endl
+                << "After folding var : " << var << " :" << std::endl;
+      rCtx.getRoot()->put(std::cout) << std::endl;
     }
   } // for each clause
 

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-04-06 07:55:55 +0000
+++ test/fots/CMakeLists.txt	2013-04-08 11:40:32 +0000
@@ -420,8 +420,6 @@
 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy50 0)
 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy51 0)
 EXPECTED_FOTS_FAILURE (prod-OrderByClause orderBy59 0)
-EXPECTED_FOTS_FAILURE (prod-PathExpr PathExpr-1 0)
-EXPECTED_FOTS_FAILURE (prod-PathExpr PathExpr-2 0)
 EXPECTED_FOTS_FAILURE (prod-PathExpr PathExpr-5p 0)
 EXPECTED_FOTS_FAILURE (prod-PathExpr PathExpr-7p 0)
 EXPECTED_FOTS_FAILURE (prod-PathExpr PathExpr-8p 0)


Follow ups