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

Commit message:
More aggressive eliminationof unused LET variables

Requested reviews:
  Markos Zaharioudakis (markos-za)

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

More aggressive eliminationof unused LET variables
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/185014
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-08-21 10:25:42 +0000
+++ ChangeLog	2013-09-11 10:39:49 +0000
@@ -36,6 +36,7 @@
   * Optimized implementation of function caching and removed the restriction
     on the return type.
   * No node ordering/distinct required for self axis.
+  * More aggressive eliminationof unused LET variables
 
 Bug Fixes/Other Changes:
   * Fixed bug #1117952 (Improve XML error output format)

=== modified file 'src/compiler/expression/expr_base.h'
--- src/compiler/expression/expr_base.h	2013-05-29 04:17:01 +0000
+++ src/compiler/expression/expr_base.h	2013-09-11 10:39:49 +0000
@@ -234,6 +234,8 @@
 
   unsigned short get_scripting_detail() const { return theScriptingKind; }
 
+  void set_scripting_detail(unsigned short k) { theScriptingKind = k; }
+
   bool is_updating() const;
 
   bool is_sequential() const;
@@ -246,8 +248,6 @@
 
   void set_not_exiting();
 
-  void adjustSequential();
-
   void checkScriptingKind() const;
 
   void compute_return_type(bool deep, bool* modified);

=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
--- src/compiler/rewriter/rules/flwor_rules.cpp	2013-08-09 10:23:10 +0000
+++ src/compiler/rewriter/rules/flwor_rules.cpp	2013-09-11 10:39:49 +0000
@@ -566,7 +566,8 @@
 
   if (safe && numRefs == 0)
   {
-    if (varDomExpr->isNonDiscardable() || !isSafeVar)
+    if (varDomExpr->get_function_kind() == FunctionConsts::OP_CREATE_INTERNAL_INDEX_2 ||
+        !isSafeVar)
     {
       return false;
     }

=== modified file 'src/compiler/xqddf/value_index.cpp'
--- src/compiler/xqddf/value_index.cpp	2013-05-31 01:47:24 +0000
+++ src/compiler/xqddf/value_index.cpp	2013-09-11 10:39:49 +0000
@@ -569,7 +569,7 @@
 
     expr* keyClone = theKeyExprs[i]->clone(udf, subst);
 
-    keyClone->setNonDiscardable(ANNOTATION_TRUE_FIXED);
+    keyClone->set_scripting_detail(SEQUENTIAL_FUNC_EXPR);
 
     const QueryLoc& keyloc = keyClone->get_loc();
 

=== modified file 'src/functions/func_index_ddl.h'
--- src/functions/func_index_ddl.h	2013-02-07 17:24:36 +0000
+++ src/functions/func_index_ddl.h	2013-09-11 10:39:49 +0000
@@ -45,10 +45,15 @@
   {
   }
 
-  unsigned short getScriptingKind() const { return SIMPLE_EXPR; }
-
   bool accessesDynCtx() const { return true; }
 
+  unsigned short getScriptingKind() const 
+  {
+    // Although the index creation will be applied immediately, we should
+    // NOT mark this function as sequential.
+    return SIMPLE_EXPR;
+  }
+
   bool mustCopyInputNodes(expr* fo, csize input) const { return false; }
 
   BoolAnnotationValue ignoresSortedNodes(expr* fo, csize input) const 

=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter	2013-02-07 17:24:36 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter	2013-09-11 10:39:49 +0000
@@ -19,40 +19,6 @@
       <SingletonIterator value="xs:QName(,,tests)"/>
     </ElementIterator>
   </CtxVarDeclareIterator>
-  <flwor::FLWORIterator>
-    <LetVariable name="test_old" materialize="true">
-      <flwor::FLWORIterator>
-        <ForVariable name="$$context-item">
-          <CtxVarIterator varid="4" varname="tests" varkind="global"/>
-        </ForVariable>
-        <WhereClause>
-          <FnBooleanIterator>
-            <TypedValueCompareIterator_STRING>
-              <PromoteIterator type="xs:anyAtomicType">
-                <FnDataIterator>
-                  <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
-                    <ForVarIterator varname="$$context-item"/>
-                  </ChildAxisIterator>
-                </FnDataIterator>
-              </PromoteIterator>
-              <PromoteIterator type="xs:anyAtomicType">
-                <FnDataIterator>
-                  <ChildAxisIterator test kind="match_text_test" qname="*" typename="*" nill allowed="0">
-                    <CtxVarIterator varid="4" varname="tests" varkind="global"/>
-                  </ChildAxisIterator>
-                </FnDataIterator>
-              </PromoteIterator>
-            </TypedValueCompareIterator_STRING>
-          </FnBooleanIterator>
-        </WhereClause>
-        <ReturnClause>
-          <ForVarIterator varname="$$context-item"/>
-        </ReturnClause>
-      </flwor::FLWORIterator>
-    </LetVariable>
-    <ReturnClause>
-      <SingletonIterator value="xs:integer(1)"/>
-    </ReturnClause>
-  </flwor::FLWORIterator>
+  <SingletonIterator value="xs:integer(1)"/>
 </SequentialIterator>
 

=== modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/hoist01.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/hoist01.iter	2013-03-04 21:00:58 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/hoist01.iter	2013-09-11 10:39:49 +0000
@@ -9,42 +9,6 @@
 </OrIterator>
 
 Iterator tree for const-folded expr:
-<HoistIterator>
-  <FnBooleanIterator>
-    <IfThenElseIterator>
-      <FnBooleanIterator>
-        <FnConcatIterator/>
-      </FnBooleanIterator>
-      <FnConcatIterator/>
-      <FnConcatIterator/>
-    </IfThenElseIterator>
-  </FnBooleanIterator>
-</HoistIterator>
-
-Iterator tree for const-folded expr:
-<HoistIterator>
-  <FnBooleanIterator>
-    <IfThenElseIterator>
-      <FnBooleanIterator>
-        <FnConcatIterator/>
-      </FnBooleanIterator>
-      <FnConcatIterator/>
-      <FnConcatIterator/>
-    </IfThenElseIterator>
-  </FnBooleanIterator>
-</HoistIterator>
-
-Iterator tree for const-folded expr:
-<UnhoistIterator>
-  <SingletonIterator value="xs:boolean(false)"/>
-</UnhoistIterator>
-
-Iterator tree for const-folded expr:
-<UnhoistIterator>
-  <SingletonIterator value="xs:boolean(false)"/>
-</UnhoistIterator>
-
-Iterator tree for const-folded expr:
 <UDFunctionCallIterator function="testlib:searchUser">
   <SingletonIterator value="xs:integer(0)"/>
 </UDFunctionCallIterator>

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to