[Libreoffice-commits] core.git: Branch 'feature/fixes11' - 2 commits - sc/inc sc/Library_sc.mk sc/source unusedcode.easy

Tor Lillqvist tml at collabora.com
Fri Oct 9 04:28:12 PDT 2015


 sc/Library_sc.mk                          |    1 
 sc/inc/clkernelthread.hxx                 |   58 -----------------
 sc/inc/columnspanset.hxx                  |   56 ++++++++++++++---
 sc/inc/formulacell.hxx                    |   11 ---
 sc/inc/types.hxx                          |    1 
 sc/source/core/data/columnspanset.cxx     |   45 -------------
 sc/source/core/data/document.cxx          |    6 -
 sc/source/core/data/formulacell.cxx       |   67 --------------------
 sc/source/core/data/table3.cxx            |   12 +--
 sc/source/core/opencl/formulagroupcl.cxx  |   28 --------
 sc/source/core/tool/clkernelthread.cxx    |   97 ------------------------------
 sc/source/core/tool/grouparealistener.cxx |    6 -
 sc/source/core/tool/interpr6.cxx          |   12 +--
 sc/source/ui/docshell/externalrefmgr.cxx  |    6 -
 sc/source/ui/undo/undobase.cxx            |    6 -
 unusedcode.easy                           |    4 -
 16 files changed, 70 insertions(+), 346 deletions(-)

New commits:
commit dea3163a958f00eb45679b0cf7c548d64894bcda
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Oct 2 17:04:54 2015 +0300

    Replace derivation from ColumnAction with template
    
    Will see if it gives a performance improvement.
    
    Change-Id: Ib45c2879cf3e974e05c83e2323be57557da58ffd

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 797b425..7e5123c 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -11,12 +11,13 @@
 #define INCLUDED_SC_INC_COLUMNSPANSET_HXX
 
 #include "address.hxx"
+#include "document.hxx"
+#include "table.hxx"
 
 #include <vector>
 #include <mdds/flat_segment_tree.hpp>
 #include <boost/noncopyable.hpp>
 
-class ScDocument;
 class ScColumn;
 class ScMarkData;
 class ScRange;
@@ -78,14 +79,6 @@ public:
         virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) = 0;
     };
 
-    class ColumnAction
-    {
-    public:
-        virtual ~ColumnAction() = 0;
-        virtual void startColumn(ScColumn* pCol) = 0;
-        virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) = 0;
-    };
-
     ColumnSpanSet(bool bInit);
     ~ColumnSpanSet();
 
@@ -102,7 +95,50 @@ public:
     void scan(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal);
 
     void executeAction(Action& ac) const;
-    void executeColumnAction(ScDocument& rDoc, ColumnAction& ac) const;
+
+    template<typename ColumnAction>
+    void executeColumnAction(ScDocument& rDoc, ColumnAction& ac) const
+    {
+        for (size_t nTab = 0; nTab < maDoc.size(); ++nTab)
+        {
+            if (!maDoc[nTab])
+                continue;
+
+            const TableType& rTab = *maDoc[nTab];
+            for (size_t nCol = 0; nCol < rTab.size(); ++nCol)
+            {
+                if (!rTab[nCol])
+                    continue;
+
+                ScTable* pTab = rDoc.FetchTable(nTab);
+                if (!pTab)
+                    continue;
+
+                if (!ValidCol(nCol))
+                {
+                    // End the loop.
+                    nCol = rTab.size();
+                    continue;
+                }
+
+                ScColumn& rColumn = pTab->aCol[nCol];
+                ac.startColumn(&rColumn);
+                ColumnType& rCol = *rTab[nCol];
+                ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
+                SCROW nRow1, nRow2;
+                nRow1 = it->first;
+                bool bVal = it->second;
+                for (++it; it != itEnd; ++it)
+                {
+                    nRow2 = it->first-1;
+                    ac.execute(nRow1, nRow2, bVal);
+
+                    nRow1 = nRow2+1; // for the next iteration.
+                    bVal = it->second;
+                }
+            }
+        }
+    }
 
     void swap( ColumnSpanSet& r );
 };
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index 25f6b5b..a444c54 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -54,8 +54,6 @@ ColumnSpanSet::ColumnType::ColumnType(SCROW nStart, SCROW nEnd, bool bInit) :
 ColumnSpanSet::Action::~Action() {}
 void ColumnSpanSet::Action::startColumn(SCTAB /*nTab*/, SCCOL /*nCol*/) {}
 
-ColumnSpanSet::ColumnAction::~ColumnAction() {}
-
 ColumnSpanSet::ColumnSpanSet(bool bInit) : mbInit(bInit) {}
 
 ColumnSpanSet::~ColumnSpanSet()
@@ -184,49 +182,6 @@ void ColumnSpanSet::executeAction(Action& ac) const
     }
 }
 
-void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) const
-{
-    for (size_t nTab = 0; nTab < maDoc.size(); ++nTab)
-    {
-        if (!maDoc[nTab])
-            continue;
-
-        const TableType& rTab = *maDoc[nTab];
-        for (size_t nCol = 0; nCol < rTab.size(); ++nCol)
-        {
-            if (!rTab[nCol])
-                continue;
-
-            ScTable* pTab = rDoc.FetchTable(nTab);
-            if (!pTab)
-                continue;
-
-            if (!ValidCol(nCol))
-            {
-                // End the loop.
-                nCol = rTab.size();
-                continue;
-            }
-
-            ScColumn& rColumn = pTab->aCol[nCol];
-            ac.startColumn(&rColumn);
-            ColumnType& rCol = *rTab[nCol];
-            ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
-            SCROW nRow1, nRow2;
-            nRow1 = it->first;
-            bool bVal = it->second;
-            for (++it; it != itEnd; ++it)
-            {
-                nRow2 = it->first-1;
-                ac.execute(nRow1, nRow2, bVal);
-
-                nRow1 = nRow2+1; // for the next iteration.
-                bVal = it->second;
-            }
-        }
-    }
-}
-
 void ColumnSpanSet::swap( ColumnSpanSet& r )
 {
     maDoc.swap(r.maDoc);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bb6431a..694c048 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2644,7 +2644,7 @@ void ScDocument::CopyNonFilteredFromClip(
 
 namespace {
 
-class BroadcastAction : public sc::ColumnSpanSet::ColumnAction
+class BroadcastAction
 {
     ScDocument& mrDoc;
     ScColumn* mpCol;
@@ -2652,12 +2652,12 @@ class BroadcastAction : public sc::ColumnSpanSet::ColumnAction
 public:
     BroadcastAction( ScDocument& rDoc ) : mrDoc(rDoc), mpCol(NULL) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         mpCol = pCol;
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         if (!bVal)
             return;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1c5a551..99c01fe 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -844,7 +844,7 @@ void expandRowRange( ScRange& rRange, SCROW nTop, SCROW nBottom )
         rRange.aEnd.SetRow(nBottom);
 }
 
-class FormulaCellCollectAction : public sc::ColumnSpanSet::ColumnAction
+class FormulaCellCollectAction
 {
     std::vector<ScFormulaCell*>& mrCells;
     ScColumn* mpCol;
@@ -853,12 +853,12 @@ public:
     FormulaCellCollectAction( std::vector<ScFormulaCell*>& rCells ) :
         mrCells(rCells), mpCol(NULL) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         mpCol = pCol;
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         assert(mpCol);
 
@@ -869,7 +869,7 @@ public:
     }
 };
 
-class ListenerStartAction : public sc::ColumnSpanSet::ColumnAction
+class ListenerStartAction
 {
     ScColumn* mpCol;
 
@@ -884,12 +884,12 @@ public:
         maStartCxt(rDoc, mpPosSet),
         maEndCxt(rDoc, mpPosSet) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         mpCol = pCol;
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         assert(mpCol);
 
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index ac9ea7f..50f64806 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -34,7 +34,7 @@ public:
     }
 };
 
-class CollectCellAction : public sc::ColumnSpanSet::ColumnAction
+class CollectCellAction
 {
     const FormulaGroupAreaListener& mrAreaListener;
     ScAddress maPos;
@@ -44,13 +44,13 @@ public:
     CollectCellAction( const FormulaGroupAreaListener& rAreaListener ) :
         mrAreaListener(rAreaListener) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         maPos.SetTab(pCol->GetTab());
         maPos.SetCol(pCol->GetCol());
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         if (!bVal)
             return;
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index e02abbc..694a403 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -278,7 +278,7 @@ public:
     size_t getCount() const { return mnCount; }
 };
 
-class FuncCount : public sc::ColumnSpanSet::ColumnAction
+class FuncCount
 {
     sc::ColumnBlockConstPosition maPos;
     ScColumn* mpCol;
@@ -288,13 +288,13 @@ class FuncCount : public sc::ColumnSpanSet::ColumnAction
 public:
     FuncCount() : mpCol(0), mnCount(0), mnNumFmt(0) {}
 
-    virtual void startColumn(ScColumn* pCol) SAL_OVERRIDE
+    void startColumn(ScColumn* pCol)
     {
         mpCol = pCol;
         mpCol->InitBlockPosition(maPos);
     }
 
-    virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) SAL_OVERRIDE
+    void execute(SCROW nRow1, SCROW nRow2, bool bVal)
     {
         if (!bVal)
             return;
@@ -309,7 +309,7 @@ public:
     sal_uInt32 getNumberFormat() const { return mnNumFmt; }
 };
 
-class FuncSum : public sc::ColumnSpanSet::ColumnAction
+class FuncSum
 {
     sc::ColumnBlockConstPosition maPos;
     ScColumn* mpCol;
@@ -320,13 +320,13 @@ class FuncSum : public sc::ColumnSpanSet::ColumnAction
 public:
     FuncSum() : mpCol(0), mfSum(0.0), mnError(0), mnNumFmt(0) {}
 
-    virtual void startColumn(ScColumn* pCol) SAL_OVERRIDE
+    void startColumn(ScColumn* pCol)
     {
         mpCol = pCol;
         mpCol->InitBlockPosition(maPos);
     }
 
-    virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) SAL_OVERRIDE
+    void execute(SCROW nRow1, SCROW nRow2, bool bVal)
     {
         if (!bVal)
             return;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 36a3882..fdd911f 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2669,7 +2669,7 @@ void ScExternalRefManager::clearCache(sal_uInt16 nFileId)
 
 namespace {
 
-class RefCacheFiller : public sc::ColumnSpanSet::ColumnAction
+class RefCacheFiller
 {
     svl::SharedStringPool& mrStrPool;
 
@@ -2683,7 +2683,7 @@ public:
     RefCacheFiller( svl::SharedStringPool& rStrPool, ScExternalRefCache& rRefCache, sal_uInt16 nFileId ) :
         mrStrPool(rStrPool), mrRefCache(rRefCache), mnFileId(nFileId), mpCurCol(NULL) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         mpCurCol = pCol;
         if (!mpCurCol)
@@ -2693,7 +2693,7 @@ public:
         mpRefTab = mrRefCache.getCacheTable(mnFileId, mpCurCol->GetTab());
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         if (!mpCurCol || !bVal)
             return;
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index a383eed..0af2b33 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -152,7 +152,7 @@ void ScSimpleUndo::BroadcastChanges( const ScRange& rRange )
 
 namespace {
 
-class SpanBroadcaster : public sc::ColumnSpanSet::ColumnAction
+class SpanBroadcaster
 {
     ScDocument& mrDoc;
     SCTAB mnCurTab;
@@ -161,13 +161,13 @@ class SpanBroadcaster : public sc::ColumnSpanSet::ColumnAction
 public:
     SpanBroadcaster( ScDocument& rDoc ) : mrDoc(rDoc), mnCurTab(-1), mnCurCol(-1) {}
 
-    virtual void startColumn( ScColumn* pCol ) SAL_OVERRIDE
+    void startColumn( ScColumn* pCol )
     {
         mnCurTab = pCol->GetTab();
         mnCurCol = pCol->GetCol();
     }
 
-    virtual void execute( SCROW nRow1, SCROW nRow2, bool bVal ) SAL_OVERRIDE
+    void execute( SCROW nRow1, SCROW nRow2, bool bVal )
     {
         if (!bVal)
             return;
commit f5a95cb119c4d3b6cf5d906c4d31afe31166bb32
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Oct 2 14:24:24 2015 +0300

    ENABLE_THREADED_OPENCL_KERNEL_COMPILATION has been zero for a long time
    
    And I doubt we will try to turn it on again, so remove dead code.
    
    Change-Id: Ia426a9d8fe12d32300df0f4dd838b7c58ecccc11

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index d2fd5cd..69a4f86c 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -214,7 +214,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/core/tool/chartpos \
     sc/source/core/tool/chgtrack \
     sc/source/core/tool/chgviset \
-    sc/source/core/tool/clkernelthread \
     sc/source/core/tool/compare \
     sc/source/core/tool/compiler \
     sc/source/core/tool/consoli  \
diff --git a/sc/inc/clkernelthread.hxx b/sc/inc/clkernelthread.hxx
deleted file mode 100644
index 358da11..0000000
--- a/sc/inc/clkernelthread.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_SC_INC_CLKERNELTHREAD_HXX
-#define INCLUDED_SC_INC_CLKERNELTHREAD_HXX
-
-#include <queue>
-
-#include <osl/conditn.hxx>
-#include <salhelper/thread.hxx>
-
-#include <boost/noncopyable.hpp>
-
-#include "scdllapi.h"
-#include "formulacell.hxx"
-
-namespace sc {
-
-struct CLBuildKernelWorkItem
-{
-    enum { COMPILE, FINISH } meWhatToDo;
-    ScFormulaCellGroupRef mxGroup;
-};
-
-class SC_DLLPUBLIC CLBuildKernelThread : public salhelper::Thread, boost::noncopyable
-{
-public:
-    CLBuildKernelThread();
-    virtual ~CLBuildKernelThread();
-
-    void finish();
-
-    void push(CLBuildKernelWorkItem item);
-
-    osl::Condition maCompilationDoneCondition;
-
-protected:
-    virtual void execute() SAL_OVERRIDE;
-
-private:
-    osl::Mutex maQueueMutex;
-    osl::Condition maQueueCondition;
-    std::queue<CLBuildKernelWorkItem> maQueue;
-    static void produce();
-    static void consume();
-};
-
-}
-
-#endif // INCLUDED_SC_INC_CLKERNELTHREAD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 66f4c9b..4e15bd7 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -34,11 +34,8 @@
 
 #include "formularesult.hxx"
 
-#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0
-
 namespace sc {
 
-class CLBuildKernelThread;
 class CompiledFormula;
 class StartListeningContext;
 class EndListeningContext;
@@ -78,9 +75,6 @@ public:
 
     ScFormulaCellGroup();
     ~ScFormulaCellGroup();
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    void scheduleCompilation();
-#endif
 
     void setCode( const ScTokenArray& rCode );
     void setCode( ScTokenArray* pCode );
@@ -92,11 +86,6 @@ public:
         ScFormulaCell** ppTopCell, const ScRange& rRange, bool bStartFixed, bool bEndFixed );
 
     void endAllGroupListening( ScDocument& rDoc );
-
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    static int snCount;
-    static rtl::Reference<sc::CLBuildKernelThread> sxCompilationThread;
-#endif
 };
 
 inline void intrusive_ptr_add_ref(const ScFormulaCellGroup *p)
diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx
index 77934f0..ed944b0 100644
--- a/sc/inc/types.hxx
+++ b/sc/inc/types.hxx
@@ -78,7 +78,6 @@ enum GroupCalcState
 enum OpenCLKernelState
 {
     OpenCLKernelNone = 0,
-    OpenCLKernelCompilationScheduled,
     OpenCLKernelBinaryCreated
 };
 
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 1bb5e4c..58a6719 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -44,7 +44,6 @@
 #include "editutil.hxx"
 #include "chgtrack.hxx"
 #include "tokenarray.hxx"
-#include "clkernelthread.hxx"
 
 #include <formula/errorcodes.hxx>
 #include <formula/vectortoken.hxx>
@@ -422,28 +421,6 @@ typedef boost::ptr_map<AreaListenerKey, sc::FormulaGroupAreaListener> AreaListen
 
 }
 
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-//  The mutex to synchronize access to the OpenCL compilation thread.
-static osl::Mutex& getOpenCLCompilationThreadMutex()
-{
-    static osl::Mutex* pMutex = NULL;
-    if( !pMutex )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if( !pMutex )
-        {
-            static osl::Mutex aMutex;
-            pMutex = &aMutex;
-        }
-    }
-
-    return *pMutex;
-}
-
-int ScFormulaCellGroup::snCount = 0;
-rtl::Reference<sc::CLBuildKernelThread> ScFormulaCellGroup::sxCompilationThread;
-#endif
-
 struct ScFormulaCellGroup::Impl
 {
     AreaListenersType maAreaListeners;
@@ -463,53 +440,16 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
     meKernelState(sc::OpenCLKernelNone)
 {
     SAL_INFO( "sc.core.formulacell", "ScFormulaCellGroup ctor this " << this);
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    if (officecfg::Office::Common::Misc::UseOpenCL::get())
-    {
-        osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
-        if (snCount++ == 0)
-        {
-            assert(!sxCompilationThread.is());
-            sxCompilationThread.set(new sc::CLBuildKernelThread);
-            sxCompilationThread->launch();
-        }
-    }
-#endif
 }
 
 ScFormulaCellGroup::~ScFormulaCellGroup()
 {
     SAL_INFO( "sc.core.formulacell", "ScFormulaCellGroup dtor this " << this);
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    if (officecfg::Office::Common::Misc::UseOpenCL::get())
-    {
-        osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
-        if (--snCount == 0 && sxCompilationThread.is())
-            {
-                assert(sxCompilationThread.is());
-                sxCompilationThread->finish();
-                sxCompilationThread->join();
-                SAL_INFO("sc.opencl", "OpenCL kernel compilation thread has finished");
-                sxCompilationThread.clear();
-            }
-    }
-#endif
     delete mpCode;
     delete mpCompiledFormula;
     delete mpImpl;
 }
 
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-void ScFormulaCellGroup::scheduleCompilation()
-{
-    meKernelState = sc::OpenCLKernelCompilationScheduled;
-    sc::CLBuildKernelWorkItem aWorkItem;
-    aWorkItem.meWhatToDo = sc::CLBuildKernelWorkItem::COMPILE;
-    aWorkItem.mxGroup = this;
-    sxCompilationThread->push(aWorkItem);
-}
-#endif
-
 void ScFormulaCellGroup::setCode( const ScTokenArray& rCode )
 {
     delete mpCode;
@@ -2357,9 +2297,6 @@ bool ScFormulaCell::IsMultilineResult()
 
 bool ScFormulaCell::NeedsInterpret() const
 {
-    if (mxGroup && mxGroup->meKernelState == sc::OpenCLKernelCompilationScheduled)
-        return false;
-
     if (!IsDirtyOrInTableOpDirty())
         return false;
 
@@ -3626,10 +3563,6 @@ ScFormulaCellGroupRef ScFormulaCell::CreateCellGroup( SCROW nLen, bool bInvarian
     mxGroup->mbInvariant = bInvariant;
     mxGroup->mnLength = nLen;
     mxGroup->mpCode = pCode; // Move this to the shared location.
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    if (mxGroup->sxCompilationThread.is())
-        mxGroup->scheduleCompilation();
-#endif
     return mxGroup;
 }
 
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index e5324cd..e413c8c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -9,7 +9,6 @@
 
 #include "formulagroup.hxx"
 #include "formulagroupcl.hxx"
-#include "clkernelthread.hxx"
 #include "grouptokenconverter.hxx"
 #include "document.hxx"
 #include "formulacell.hxx"
@@ -4181,13 +4180,6 @@ public:
         mpKernel = pKernel;
     }
 
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    void setUnmanagedKernel( DynamicKernel* pKernel )
-    {
-        mpKernel = pKernel;
-    }
-#endif
-
     CLInterpreterResult launchKernel()
     {
         if (!isValid())
@@ -4229,27 +4221,7 @@ CLInterpreterContext createCLInterpreterContext( const ScCalcConfig& rConfig,
 {
     CLInterpreterContext aCxt(xGroup->mnLength);
 
-#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
-    if (rGroup.meKernelState == sc::OpenCLKernelCompilationScheduled ||
-        rGroup.meKernelState == sc::OpenCLKernelBinaryCreated)
-    {
-        if (rGroup.meKernelState == sc::OpenCLKernelCompilationScheduled)
-        {
-            ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.wait();
-            ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.reset();
-        }
-
-        // Kernel instance is managed by the formula group.
-        aCxt.setUnmanagedKernel(static_cast<DynamicKernel*>(xGroup->mpCompiledFormula));
-    }
-    else
-    {
-        assert(xGroup->meCalcState == sc::GroupCalcRunning);
-        aCxt.setManagedKernel(static_cast<DynamicKernel*>(DynamicKernel::create(rConfig, rCode, xGroup->mnLength)));
-    }
-#else
     aCxt.setManagedKernel(static_cast<DynamicKernel*>(DynamicKernel::create(rConfig, rCode, xGroup->mnLength)));
-#endif
 
     return aCxt;
 }
diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx
deleted file mode 100644
index 6c5afc0..0000000
--- a/sc/source/core/tool/clkernelthread.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <sal/log.hxx>
-
-#include "formulagroup.hxx"
-#include "grouptokenconverter.hxx"
-
-#include "clkernelthread.hxx"
-
-using namespace std;
-
-namespace sc {
-
-CLBuildKernelThread::CLBuildKernelThread() :
-    salhelper::Thread("opencl-build-kernel-thread")
-{
-}
-
-CLBuildKernelThread::~CLBuildKernelThread()
-{
-}
-
-void CLBuildKernelThread::execute()
-{
-    SAL_INFO("sc.opencl.thread", "running");
-
-    bool done = false;
-    while (!done)
-    {
-        SAL_INFO("sc.opencl.thread", "waiting for condition");
-        maQueueCondition.wait();
-        SAL_INFO("sc.opencl.thread", "got condition");
-        osl::ResettableMutexGuard aGuard(maQueueMutex);
-        maQueueCondition.reset();
-        while (!maQueue.empty())
-        {
-            CLBuildKernelWorkItem aWorkItem = maQueue.front();
-            maQueue.pop();
-            aGuard.clear();
-
-            switch (aWorkItem.meWhatToDo)
-            {
-            case CLBuildKernelWorkItem::COMPILE:
-                SAL_INFO("sc.opencl.thread", "told to compile group " << aWorkItem.mxGroup << " (state " << aWorkItem.mxGroup->meCalcState << ") to binary");
-                aWorkItem.mxGroup->compileOpenCLKernel();
-                SAL_INFO("sc.opencl.thread", "group " << aWorkItem.mxGroup << " compilation done");
-                maCompilationDoneCondition.set();
-                break;
-            case CLBuildKernelWorkItem::FINISH:
-                SAL_INFO("sc.opencl.thread", "told to finish");
-                done = true;
-                break;
-            }
-
-            aGuard.reset();
-        }
-    }
-}
-
-void CLBuildKernelThread::push(CLBuildKernelWorkItem item)
-{
-    osl::MutexGuard guard(maQueueMutex);
-    maQueue.push(item);
-    maQueueCondition.set();
-
-    // This is only to ensure that the OpenCL parameters are initialized on
-    // the main thread before spawning a worker thread for kernel
-    // pre-compilation.
-    sc::FormulaGroupInterpreter::getStatic();
-}
-
-void CLBuildKernelThread::produce()
-{
-}
-
-void CLBuildKernelThread::consume()
-{
-}
-
-void CLBuildKernelThread::finish()
-{
-    SAL_INFO("sc.opencl", "telling thread to finish");
-    CLBuildKernelWorkItem aWorkItem;
-    aWorkItem.meWhatToDo = CLBuildKernelWorkItem::FINISH;
-    push(aWorkItem);
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index b3008e6..99f8e56 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -87,10 +87,6 @@ dbaui::OTableRowView::SetUpdatable(bool)
 oglcanvas::CanvasHelper::drawPoint(com::sun::star::rendering::XCanvas const*, com::sun::star::geometry::RealPoint2D const&, com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState const&)
 oglcanvas::TextLayout::draw(com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState const&, com::sun::star::uno::Reference<com::sun::star::rendering::XGraphicDevice> const&) const
 oox::drawingml::TextListStyle::dump() const
-sc::CLBuildKernelThread::CLBuildKernelThread()
-sc::CLBuildKernelThread::consume()
-sc::CLBuildKernelThread::finish()
-sc::CLBuildKernelThread::produce()
 sc::CellValues::transferTo(ScColumn&, int)
 sc::ColumnSpanSet::swap(sc::ColumnSpanSet&)
 sc::FormulaGroupAreaListener::getGroupLength() const


More information about the Libreoffice-commits mailing list