[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/inc sc/source
sc/inc/formulacell.hxx |5 +- sc/inc/formulagroup.hxx |4 - sc/inc/types.hxx | 11 +++- sc/source/core/data/formulacell.cxx | 22 +++-- sc/source/core/opencl/formulagroupcl.cxx | 74 ++- sc/source/core/opencl/opbase.hxx |6 +- sc/source/core/tool/clkernelthread.cxx | 15 ++ sc/source/core/tool/formulagroup.cxx |4 - 8 files changed, 77 insertions(+), 64 deletions(-) New commits: commit f41da077c76ee8a70fbcf4fe62e0bfb1fabc1a1c Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Fri Mar 7 11:13:08 2014 -0500 Initialize OpenCL device on the main thread when pre-compiling kernels. Else it would cause extremely hard-to-debug random crashes when interpreting formulas with OpenCL. And let's re-enable kernel pre-compilation with this fix. Change-Id: Ib104bfdc3f56a02c052c837eb4bf3ecc95d562e0 (cherry picked from commit 6e24c789572aba5b6ee95e894f6d778777b1df58) Reviewed-on: https://gerrit.libreoffice.org/8498 Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 9407fbd..aff135a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -54,7 +54,7 @@ #include boost/scoped_ptr.hpp -#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0 +#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 1 using namespace formula; diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx index ea3c7d0..6c5afc0 100644 --- a/sc/source/core/tool/clkernelthread.cxx +++ b/sc/source/core/tool/clkernelthread.cxx @@ -69,6 +69,11 @@ 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() commit 6048ced1ec27ad64c13791274b66ccb55e4d8dc9 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Mar 5 21:39:10 2014 -0500 Various fixes (memory leak crash) in the OpenCL interpreter code. Pre-compiling of OpenCL kernel is disabled with this change. (cherry picked from commit b981c089a9194f33b46272e3f4efa117241ea533) (cherry picked from commit e253d46af3b47afd0006084bec89b02473ee457a) (cherry picked from commit 0d7f89b021f1354a0fa607862296b11c9fd8a4dd) (cherry picked from commit 5325137783825c498ed4236080ed7fe51cdec09a) (cherry picked from commit 20ed6886ade81ee015a22b2eb3aeff64691971bf) (cherry picked from commit 7a0ed3a406bd14bb2b52c383282daf4777ba76e0) Conflicts: sc/source/core/data/formulacell.cxx Change-Id: Iae97f4f877c329f443c7d222c6a2016678af2387 Reviewed-on: https://gerrit.libreoffice.org/8496 Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 7361b66..2cfdbb9 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -64,7 +64,9 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable short mnFormatType; bool mbInvariant:1; bool mbSubTotal:1; -sc::GroupCalcState meCalcState; + +sal_uInt8 meCalcState; +sal_uInt8 meKernelState; ScFormulaCellGroup(); ~ScFormulaCellGroup(); @@ -74,6 +76,7 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable void setCode( const ScTokenArray rCode ); void compileCode( ScDocument rDoc, const ScAddress rPos, formula::FormulaGrammar::Grammar eGram ); +void compileOpenCLKernel(); static int snCount; static rtl::Referencesc::CLBuildKernelThread sxCompilationThread; diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx index a3f1891..bb0e0b4 100644 --- a/sc/inc/formulagroup.hxx +++ b/sc/inc/formulagroup.hxx @@ -107,7 +107,7 @@ class SC_DLLPUBLIC FormulaGroupInterpreter virtual ScMatrixRef inverseMatrix(const ScMatrix rMat) = 0; virtual CompiledFormula* createCompiledFormula(ScDocument rDoc, const ScAddress rTopPos, - ScFormulaCellGroupRef xGroup, + ScFormulaCellGroup rGroup, ScTokenArray rCode) = 0; virtual bool interpret(ScDocument rDoc, const ScAddress rTopPos, ScFormulaCellGroupRef xGroup, ScTokenArray rCode) = 0; }; @@ -122,7 +122,7 @@ public: virtual ScMatrixRef inverseMatrix(const ScMatrix
[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/inc sc/source
sc/inc/column.hxx|1 sc/inc/document.hxx |2 + sc/inc/table.hxx |2 + sc/source/core/data/column2.cxx | 33 +++--- sc/source/core/data/document.cxx | 28 ++ sc/source/core/data/table2.cxx | 24 +++ sc/source/ui/view/cellsh.cxx | 49 --- 7 files changed, 98 insertions(+), 41 deletions(-) New commits: commit 839eccc8ae5aa5dde055f84471246f2a3ef04929 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Nov 28 00:29:59 2013 +0100 iterating through all cells is not a good idea, fdo#71934 Change-Id: I370f641f0fffed8835a32c577c2f2e841ba419aa diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index c08236b..ba16644 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -506,6 +506,7 @@ public: size_t GetNoteCount() const; SCROW GetNotePosition( size_t nIndex ) const; void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const; +void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vectorsc::NoteEntry rNotes ) const; SCROW GetCellNotesMaxRow() const; SCROW GetCellNotesMinRow() const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b9e3dc3..0546ef0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -909,6 +909,7 @@ public: SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const; SC_DLLPUBLIC void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const; +void GetNotesInRange( const ScRangeList rRange, std::vectorsc::NoteEntry rNotes ) const; bool ContainsNotesInRange( const ScRangeList rRange ) const; SC_DLLPUBLIC voidSetDrawPageSize(SCTAB nTab); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 5938dcb..e273da8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -382,6 +382,7 @@ public: SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const; void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const; +void GetNotesInRange( const ScRange rRange, std::vectorsc::NoteEntry rNotes ) const; bool ContainsNotesInRange( const ScRange rRange ) const; bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const; diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 24cd615..8759c51 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1262,9 +1262,13 @@ class NoteEntryCollector std::vectorsc::NoteEntry mrNotes; SCTAB mnTab; SCCOL mnCol; +SCROW mnStartRow; +SCROW mnEndRow; public: -NoteEntryCollector( std::vectorsc::NoteEntry rNotes, SCTAB nTab, SCCOL nCol ) : -mrNotes(rNotes), mnTab(nTab), mnCol(nCol) {} +NoteEntryCollector( std::vectorsc::NoteEntry rNotes, SCTAB nTab, SCCOL nCol, +SCROW nStartRow = 0, SCROW nEndRow = MAXROW) : +mrNotes(rNotes), mnTab(nTab), mnCol(nCol), +mnStartRow(nStartRow), mnEndRow(nEndRow) {} void operator() (const sc::CellNoteStoreType::value_type node) const { @@ -1275,7 +1279,14 @@ public: sc::cellnote_block::const_iterator it = sc::cellnote_block::begin(*node.data); sc::cellnote_block::const_iterator itEnd = sc::cellnote_block::end(*node.data); size_t nOffset = 0; -for (; it != itEnd; ++it, ++nOffset) +if(nTopRow size_t(mnStartRow)) +{ +std::advance(it, mnStartRow - nTopRow); +nOffset = mnStartRow - nTopRow; +} + +for (; it != itEnd nTopRow + nOffset = size_t(mnEndRow); +++it, ++nOffset) { ScAddress aPos(mnCol, nTopRow + nOffset, mnTab); mrNotes.push_back(sc::NoteEntry(aPos, *it)); @@ -1290,6 +1301,22 @@ void ScColumn::GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const std::for_each(maCellNotes.begin(), maCellNotes.end(), NoteEntryCollector(rNotes, nTab, nCol)); } +void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW nEndRow, +std::vectorsc::NoteEntry rNotes ) const +{ +std::pairsc::CellNoteStoreType::const_iterator,size_t aPos = maCellNotes.position(nStartRow); +sc::CellNoteStoreType::const_iterator it = aPos.first; +if (it == maCellNotes.end()) +// Invalid row number. +return; + +std::pairsc::CellNoteStoreType::const_iterator,size_t aEndPos = +maCellNotes.position(nEndRow); +sc::CellNoteStoreType::const_iterator itEnd = aEndPos.first; + +std::for_each(it, itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow)); +} + SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const { // Given a range of rows, find a top or bottom empty segment. diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 708300e..931994a 100644 --- a/sc/source/core/data/document.cxx +++
[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/inc sc/source
sc/inc/queryparam.hxx |1 sc/source/core/data/dociter.cxx | 62 +- sc/source/core/data/table3.cxx| 42 sc/source/core/tool/queryparam.cxx|5 +- sc/source/filter/oox/workbookfragment.cxx |2 5 files changed, 107 insertions(+), 5 deletions(-) New commits: commit a0fea02736c8ecfa091676a066bf02503be1f7c4 Author: Eike Rathke er...@redhat.com Date: Thu Nov 28 01:04:27 2013 +0100 macro MULTI_THREAD_SHEET_PARSING is not used [-Werror=unused-macros] Change-Id: I1988e28f1feb64bb10c7941b02d9a76770871449 diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 5eea78b..485642c 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -54,8 +54,6 @@ #include queue #include boost/scoped_ptr.hpp -#define MULTI_THREAD_SHEET_PARSING 0 - #include oox/ole/vbaproject.hxx namespace oox { commit 799ac18af53342597a5d3f14702de2204536c14b Author: Eike Rathke er...@redhat.com Date: Wed Nov 27 23:43:09 2013 +0100 resolved fdo#71589 reimplemented horizontal range lookup Regression introduced with ebdd9c300718bce454ef56a31d5d8fb699fc1822 (first eaea417bfdf8d06df2b7f2e42c904c32ce77e871) that removed the bMixedComparison member from ScQueryParam under the false assumption that is was only used to emulate a legacy Excel behavior. In fact it was also needed to do the at least horizontal range lookup in sorted mixed data, though didn't evaluate exactly the same conditions as Excel and defined in ODFF. Reimplemented a similar behavior for the new code structures but this time also checking for the additional condtion that a query ByString does not return the last numeric result and vice versa, which previously was missing. Change-Id: I46061777879ba5301bfcaca2d50cf87a994f93f2 (cherry picked from commit f0701470858f57a855ba57c0c2283e52953db327) diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx index ff89d3e..a0e94f8 100644 --- a/sc/inc/queryparam.hxx +++ b/sc/inc/queryparam.hxx @@ -42,6 +42,7 @@ struct ScQueryParamBase boolbCaseSens; boolbRegExp; boolbDuplicate; +boolmbRangeLookup; /// for spreadsheet functions like MATCH, LOOKUP, HLOOKUP, VLOOKUP virtual ~ScQueryParamBase(); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 3277d36..565565f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1245,6 +1245,17 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL nFoundCol, SCROW nFoundRow, bool bSearchForEqualAfterMismatch, bool bIgnoreMismatchOnLeadingStringsP ) { +// Set and automatically reset mpParam-mbRangeLookup when returning. We +// could use comphelper::FlagRestorationGuard, but really, that one is +// overengineered for this simple purpose here. +struct BoolResetter +{ +bool mr; +bool mb; +BoolResetter( bool r, bool b ) : mr(r), mb(r) { r = b; } +~BoolResetter() { mr = mb; } +} aRangeLookupResetter( mpParam-mbRangeLookup, true); + nFoundCol = MAXCOL+1; nFoundRow = MAXROW+1; SetStopOnMismatch( true ); // assume sorted keys @@ -1253,7 +1264,22 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL nFoundCol, bool bRegExp = mpParam-bRegExp mpParam-GetEntry(0).GetQueryItem().meType == ScQueryEntry::ByString; bool bBinary = !bRegExp mpParam-bByRow (mpParam-GetEntry(0).eOp == SC_LESS_EQUAL || mpParam-GetEntry(0).eOp == SC_GREATER_EQUAL); -if (bBinary ? (BinarySearch() ? GetThis() : 0) : GetFirst()) +bool bFound = false; +if (bBinary) +{ +if (BinarySearch()) +{ +// BinarySearch() already positions correctly and only needs real +// query comparisons afterwards, skip the verification check below. +mpParam-mbRangeLookup = false; +bFound = GetThis(); +} +} +else +{ +bFound = GetFirst(); +} +if (bFound) { // First equal entry or last smaller than (greater than) entry. PositionType aPosSave; @@ -1272,9 +1298,43 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL nFoundCol, { // Step back to last in range and adjust position markers for // GetNumberFormat() or similar. +SCCOL nColDiff = nCol - nFoundCol; nCol = nFoundCol; nRow = nFoundRow; maCurPos = aPosSave; +if (mpParam-mbRangeLookup) +{ +// Verify that the found entry does not only fulfill the range +// lookup but also the real query, i.e. not numeric was found +// if query is