Kaydet (Commit) 1fb3d85a authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Dennis Francis

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: 's avatarDennis Francis <dennis.francis@collabora.com>
üst 7374b8ac
......@@ -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.
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment