[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 3 commits - sc/source

Eike Rathke erack at redhat.com
Mon Dec 18 11:51:38 UTC 2017


 sc/source/core/data/grouptokenconverter.cxx |   20 ++++++++++++++++++++
 sc/source/core/tool/token.cxx               |   21 ++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit ee7c13e134bfa620535714721085c1c0856a84df
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Dec 16 22:52:09 2017 +0100

    Type svIndex does not necessarily mean range name, tdf#114251 related
    
    Change-Id: I5e7930b7f93ee44fb0d6b4c86f261afde8ed2ccc
    Reviewed-on: https://gerrit.libreoffice.org/46615
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit ecac94f3a6872538c19827603b52f1ed7e671a4c)
    Reviewed-on: https://gerrit.libreoffice.org/46639

diff --git a/sc/source/core/data/grouptokenconverter.cxx b/sc/source/core/data/grouptokenconverter.cxx
index 898c01675d56..89823fee5238 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -254,6 +254,13 @@ bool ScGroupTokenConverter::convert( const ScTokenArray& rCode, sc::FormulaLogge
             break;
             case svIndex:
             {
+                if (p->GetOpCode() != ocName)
+                {
+                    // May be DB-range or TableRef
+                    mrGroupTokens.AddToken(*p);
+                    break;
+                }
+
                 // Named range.
                 ScRangeName* pNames = mrDoc.GetRangeName();
                 if (!pNames)
commit 21575d3bd1caa615687f44982ad2092e9c9290f1
Author: Eike Rathke <erack at redhat.com>
Date:   Sun Dec 17 17:34:15 2017 +0100

    Related: tdf#114251 disable vectorization of svDoubleRef
    
    It doesn't work, not knowing how to handle implicit intersections
    not only produces huge unnecessary matrix operations but also
    delivers wrong results.
    
    Unit test will follow as a separate commit.
    
    Change-Id: I14982d4a53d6af57196da998e53d426502c22fec
    Reviewed-on: https://gerrit.libreoffice.org/46647
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 67444cbe5dae6e24db776ab712017ad063319276)
    Reviewed-on: https://gerrit.libreoffice.org/46649
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/core/data/grouptokenconverter.cxx b/sc/source/core/data/grouptokenconverter.cxx
index 98ba8cdfa9b1..898c01675d56 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -165,6 +165,18 @@ bool ScGroupTokenConverter::convert( const ScTokenArray& rCode, sc::FormulaLogge
             break;
             case svDoubleRef:
             {
+                /* FIXME: this simply does not work, it doesn't know
+                 * a) the context of implicit intersection, for which creating
+                      two arrays dows not only result in huge unnecessary matrix
+                      operations but also produces wrong results, e.g. =B:B/C:C
+                 * b) when to keep a reference as a reference depending on the
+                      expected parameter type, e.g. INDEX(), OFFSET() and
+                      others (though that *may* be disabled by OpCode already).
+                 * Until both are solved keep the reference. */
+                mrGroupTokens.AddToken(*p);
+                break;
+
+#if 0
                 ScComplexRefData aRef = *p->GetDoubleRef();
                 ScRange aAbs = aRef.toAbs(mrPos);
 
@@ -237,6 +249,7 @@ bool ScGroupTokenConverter::convert( const ScTokenArray& rCode, sc::FormulaLogge
                     //ensure that backing storage exists for our lifetime
                     mxFormulaGroupContext = mrDoc.GetFormulaGroupContext();
                 }
+#endif
             }
             break;
             case svIndex:
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 6e7996c87828..aee7f56d8e8f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1612,10 +1612,11 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
                 // Don't change the state.
             break;
             case svSingleRef:
-            case svDoubleRef:
                 // Depends on the reference state.
                 meVectorState = FormulaVectorCheckReference;
             break;
+            case svDoubleRef:
+                // Does not work yet, see ScGroupTokenConverter::convert()
             case svError:
             case svEmptyCell:
             case svExternal:
commit 22cfc4385ed2e272013fc300f593ab9fae61f3b2
Author: Eike Rathke <erack at redhat.com>
Date:   Sun Dec 17 00:46:07 2017 +0100

    Related: tdf#114251 disable ocName named expressions for vectorization
    
    Recursive checking of their token arrays would be needed.
    
    This solves the slowness in the non-threading case of tdf#114251
    because no arrays are generated for the named ranges, which is
    rather a lucky workaround than a solution.
    
    The wrong handling of range references in general (array where
    scalar is expected, no implicit intersection) still persists.
    
    Change-Id: I57385bd95efa584108d93d724921285c97a91a45
    Reviewed-on: https://gerrit.libreoffice.org/46623
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 3193e78aba75c5b38d2683d9fd8593820048e8b9)
    Reviewed-on: https://gerrit.libreoffice.org/46644
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index fe1682bd74e7..6e7996c87828 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1664,6 +1664,24 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
         mbOpenCLEnabled = false;
         CheckForThreading(eOp);
     }
+    else
+    {
+        // All the rest, special commands, separators, error codes, ...
+        switch (eOp)
+        {
+            case ocName:
+                // Named expression would need "recursive" handling of its
+                // token array for vector state in
+                // ScFormulaCell::InterpretFormulaGroup() and below.
+                SAL_INFO("sc.opencl", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp) << " disables vectorisation for formula group");
+                meVectorState = FormulaVectorDisabledByOpCode;
+                mbOpenCLEnabled = false;
+                CheckForThreading(eOp);
+            break;
+            default:
+                ;   // nothing
+        }
+    }
 }
 
 bool ScTokenArray::ImplGetReference( ScRange& rRange, const ScAddress& rPos, bool bValidOnly ) const


More information about the Libreoffice-commits mailing list