[Libreoffice-commits] core.git: Branch 'feature/fixes10' - sc/inc sc/Library_sc.mk sc/source unusedcode.easy
Tor Lillqvist
tml at collabora.com
Fri Oct 2 04:54:18 PDT 2015
sc/Library_sc.mk | 1
sc/inc/clkernelthread.hxx | 58 ------------------
sc/inc/formulacell.hxx | 11 ---
sc/inc/types.hxx | 1
sc/source/core/data/formulacell.cxx | 67 ---------------------
sc/source/core/opencl/formulagroupcl.cxx | 28 --------
sc/source/core/tool/clkernelthread.cxx | 97 -------------------------------
unusedcode.easy | 4 -
8 files changed, 267 deletions(-)
New commits:
commit e77ce0f9ff33a523602c2630ac4f72024ee06e18
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 c017dbe..670281c 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 f38e7da..6bf869a 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