[Libreoffice-commits] core.git: sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 14 14:50:51 UTC 2018
sc/inc/formulacell.hxx | 24 +++---
sc/source/core/data/formulacell.cxx | 132 ++++++++++++++++++------------------
2 files changed, 78 insertions(+), 78 deletions(-)
New commits:
commit 1fb3d85aa855f57c3a4b32819d0acd9a378bd97c
Author: Dennis Francis <dennis.francis at collabora.co.uk>
AuthorDate: Thu Nov 8 10:38:07 2018 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Wed Nov 14 15:50:26 2018 +0100
Reorder ScFormulaCell members
When evaluating/getting result from a formulacell(which
has been evaluated before), first bDirty/bTableOpDirty
are accessed from MaybeInterpret()/NeedsInterpret(), then
aResult is accessed, so it makes sense to put the first
7 bools(with bDirty/bTableOpDirty) in the beginning, then
aResult, then rest of bools and other remaining members. The
expectation is that when bDirty is accessed in NeedsInterpret(),
the relevant contents of aResult is also fetched to cache
and remains there till aResult is needed.
Change-Id: Ide0d1e809ca045ef347520f26c4d3ab9faa994bb
Reviewed-on: https://gerrit.libreoffice.org/63065
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 9434ed8087de..f5b4da63b65c 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -108,25 +108,14 @@ class SC_DLLPUBLIC ScFormulaCell : public SvtListener
{
private:
ScFormulaCellGroupRef mxGroup; // Group of formulae we're part of
- ScFormulaResult aResult;
- formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
- ScTokenArray* pCode; // The (new) token array
- ScDocument* pDocument;
- ScFormulaCell* pPrevious;
- ScFormulaCell* pNext;
- ScFormulaCell* pPreviousTrack;
- ScFormulaCell* pNextTrack;
- sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered
- SvNumFormatType nFormatType;
- ScMatrixMode cMatrixFlag;
bool bDirty : 1; // Must be (re)calculated
+ bool bTableOpDirty : 1; // Dirty flag for TableOp
bool bChanged : 1; // Whether something changed regarding display/representation
bool bRunning : 1; // Already interpreting right now
bool bCompile : 1; // Must be (re)compiled
bool bSubTotal : 1; // Cell is part of or contains a SubTotal
bool bIsIterCell : 1; // Cell is part of a circular reference
bool bInChangeTrack : 1; // Cell is in ChangeTrack
- bool bTableOpDirty : 1; // Dirty flag for TableOp
bool bNeedListening : 1; // Listeners need to be re-established after UpdateReference
bool mbNeedsNumberFormat : 1; // set the calculated number format as hard number format
bool mbAllowNumberFormatChange : 1; /* allow setting further calculated
@@ -134,6 +123,17 @@ private:
bool mbPostponedDirty : 1; // if cell needs to be set dirty later
bool mbIsExtRef : 1; // has references in ScExternalRefManager; never cleared after set
bool mbSeenInPath : 1; // For detecting cycle involving formula groups and singleton formulacells
+ ScMatrixMode cMatrixFlag : 8;
+ sal_uInt16 nSeenInIteration : 16; // Iteration cycle in which the cell was last encountered
+ SvNumFormatType nFormatType : 16;
+ ScFormulaResult aResult;
+ formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
+ ScTokenArray* pCode; // The (new) token array
+ ScDocument* pDocument;
+ ScFormulaCell* pPrevious;
+ ScFormulaCell* pNext;
+ ScFormulaCell* pPreviousTrack;
+ ScFormulaCell* pNextTrack;
/**
* Update reference in response to cell copy-n-paste.
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 4965ea3f0e3f..7b0f9e47b3fe 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -601,30 +601,30 @@ void ScFormulaCellGroup::endAllGroupListening( ScDocument& rDoc )
}
ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) :
- eTempGrammar(formula::FormulaGrammar::GRAM_DEFAULT),
- pCode(new ScTokenArray),
- pDocument(pDoc),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType(SvNumFormatType::NUMBER),
- cMatrixFlag(ScMatrixMode::NONE),
bDirty(false),
+ bTableOpDirty(false),
bChanged(false),
bRunning(false),
bCompile(false),
bSubTotal(false),
bIsIterCell(false),
bInChangeTrack(false),
- bTableOpDirty(false),
bNeedListening(false),
mbNeedsNumberFormat(false),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag(ScMatrixMode::NONE),
+ nSeenInIteration(0),
+ nFormatType(SvNumFormatType::NUMBER),
+ eTempGrammar(formula::FormulaGrammar::GRAM_DEFAULT),
+ pCode(new ScTokenArray),
+ pDocument(pDoc),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
}
@@ -633,30 +633,30 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const OUString& rFormula,
const FormulaGrammar::Grammar eGrammar,
ScMatrixMode cMatInd ) :
- eTempGrammar( eGrammar),
- pCode( nullptr ),
- pDocument( pDoc ),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType ( SvNumFormatType::NUMBER ),
- cMatrixFlag ( cMatInd ),
bDirty( true ), // -> Because of the use of the Auto Pilot Function was: cMatInd != 0
+ bTableOpDirty( false ),
bChanged( false ),
bRunning( false ),
bCompile( false ),
bSubTotal( false ),
bIsIterCell( false ),
bInChangeTrack( false ),
- bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag ( cMatInd ),
+ nSeenInIteration(0),
+ nFormatType ( SvNumFormatType::NUMBER ),
+ eTempGrammar( eGrammar),
+ pCode( nullptr ),
+ pDocument( pDoc ),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
Compile( rFormula, true, eGrammar ); // bNoListening, Insert does that
@@ -668,30 +668,30 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, ScTokenArray* pArray,
const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
- eTempGrammar( eGrammar),
- pCode(pArray),
- pDocument( pDoc ),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType ( SvNumFormatType::NUMBER ),
- cMatrixFlag ( cMatInd ),
bDirty( true ),
+ bTableOpDirty( false ),
bChanged( false ),
bRunning( false ),
bCompile( false ),
bSubTotal( false ),
bIsIterCell( false ),
bInChangeTrack( false ),
- bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag ( cMatInd ),
+ nSeenInIteration(0),
+ nFormatType ( SvNumFormatType::NUMBER ),
+ eTempGrammar( eGrammar),
+ pCode(pArray),
+ pDocument( pDoc ),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
assert(pArray); // Never pass a NULL pointer here.
@@ -720,30 +720,30 @@ ScFormulaCell::ScFormulaCell(
ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray,
const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
- eTempGrammar( eGrammar),
- pCode(new ScTokenArray(rArray)), // also implicitly does Finalize() on the array
- pDocument( pDoc ),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType ( SvNumFormatType::NUMBER ),
- cMatrixFlag ( cMatInd ),
bDirty( true ),
+ bTableOpDirty( false ),
bChanged( false ),
bRunning( false ),
bCompile( false ),
bSubTotal( false ),
bIsIterCell( false ),
bInChangeTrack( false ),
- bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag ( cMatInd ),
+ nSeenInIteration(0),
+ nFormatType ( SvNumFormatType::NUMBER ),
+ eTempGrammar( eGrammar),
+ pCode(new ScTokenArray(rArray)), // also implicitly does Finalize() on the array
+ pDocument( pDoc ),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
// RPN array generation
@@ -769,30 +769,30 @@ ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, const ScFormulaCellGroupRef& xGroup,
const FormulaGrammar::Grammar eGrammar, ScMatrixMode cInd ) :
mxGroup(xGroup),
- eTempGrammar( eGrammar),
- pCode(xGroup->mpCode ? xGroup->mpCode : new ScTokenArray),
- pDocument( pDoc ),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType(xGroup->mnFormatType),
- cMatrixFlag ( cInd ),
bDirty(true),
+ bTableOpDirty( false ),
bChanged( false ),
bRunning( false ),
bCompile( false ),
bSubTotal(xGroup->mbSubTotal),
bIsIterCell( false ),
bInChangeTrack( false ),
- bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( false ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag ( cInd ),
+ nSeenInIteration(0),
+ nFormatType(xGroup->mnFormatType),
+ eTempGrammar( eGrammar),
+ pCode(xGroup->mpCode ? xGroup->mpCode : new ScTokenArray),
+ pDocument( pDoc ),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
if (bSubTotal)
@@ -801,30 +801,30 @@ ScFormulaCell::ScFormulaCell(
ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, ScCloneFlags nCloneFlags) :
SvtListener(),
- aResult( rCell.aResult ),
- eTempGrammar( rCell.eTempGrammar),
- pDocument( &rDoc ),
- pPrevious(nullptr),
- pNext(nullptr),
- pPreviousTrack(nullptr),
- pNextTrack(nullptr),
- nSeenInIteration(0),
- nFormatType( rCell.nFormatType ),
- cMatrixFlag ( rCell.cMatrixFlag ),
bDirty( rCell.bDirty ),
+ bTableOpDirty( false ),
bChanged( rCell.bChanged ),
bRunning( false ),
bCompile( rCell.bCompile ),
bSubTotal( rCell.bSubTotal ),
bIsIterCell( false ),
bInChangeTrack( false ),
- bTableOpDirty( false ),
bNeedListening( false ),
mbNeedsNumberFormat( rCell.mbNeedsNumberFormat ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),
mbSeenInPath(false),
+ cMatrixFlag ( rCell.cMatrixFlag ),
+ nSeenInIteration(0),
+ nFormatType( rCell.nFormatType ),
+ aResult( rCell.aResult ),
+ eTempGrammar( rCell.eTempGrammar),
+ pDocument( &rDoc ),
+ pPrevious(nullptr),
+ pNext(nullptr),
+ pPreviousTrack(nullptr),
+ pNextTrack(nullptr),
aPos(rPos)
{
pCode = rCell.pCode->Clone();
More information about the Libreoffice-commits
mailing list