Omit the unnecessary AggInfo.mnReg field.

FossilOrigin-Name: d79c58ef08b917bacc0f24d210d8eb23f659f955c219b4757af42eee8f17099b
This commit is contained in:
drh 2022-11-22 14:31:13 +00:00
parent 42b78237cd
commit 89e5dfac01
4 changed files with 24 additions and 19 deletions

View File

@ -1,5 +1,5 @@
C Factor\sout\sthe\sallocation\sof\sregisters\sfor\saggregates\sinto\sa\sseparate\nsubroutine.
D 2022-11-22T14:10:22.456
C Omit\sthe\sunnecessary\sAggInfo.mnReg\sfield.
D 2022-11-22T14:31:13.165
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -641,12 +641,12 @@ F src/printf.c e99ee9741e79ae3873458146f59644276657340385ade4e76a5f5d1c25793764
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 32d4f232ee178a4a57595061f26b10d6c51c3530cc3e721311c586201f41337a
F src/select.c 27822fc0fe69d316448294c44c638bd1aad9b980ad62f0a7bb501555245eeb26
F src/shell.c.in 16740a86346ba9823f92528ec588f2b74f68166dac965dabd19883ace230f11d
F src/sqlite.h.in 100fc660c2f19961b8ed8437b9d53d687de2f8eb2b96437ec6da216adcb643ca
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
F src/sqliteInt.h 62ff4e899d1a10e7fe60617f9d58ad49f20de4ad30ee02b68dc403ece984b617
F src/sqliteInt.h a16a36f7b2a77b66f8ed0a460aad9f0a5f2897026a51d656cb3556461d1f6be3
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@ -2059,8 +2059,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P cba837eae93f6b842d4e78ef00661a4f09deb99c53f12b3e8f46763749602597
R 8ec59d9575fc141fe0aff25c195ea672
P 4475799d5b41e93eabc32fac502ac2de240642b3b64739216e32e9af92ee191d
R 5936ef480bfa81b2caa13a6a172023d0
U drh
Z dd7dd4863c6318a4016da919a253840a
Z 8bcded315dd8c6f4a10b877ff07bc1b3
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
4475799d5b41e93eabc32fac502ac2de240642b3b64739216e32e9af92ee191d
d79c58ef08b917bacc0f24d210d8eb23f659f955c219b4757af42eee8f17099b

View File

@ -6211,9 +6211,7 @@ void sqlite3SelectPrep(
static void assignAggregateRegisters(Parse *pParse, AggInfo *pAggInfo){
int i, m;
assert( pAggInfo!=0 );
assert( pAggInfo->mnReg==0 );
m = pParse->nMem;
pAggInfo->mnReg = m+1;
for(i=0; i<pAggInfo->nColumn; i++) pAggInfo->aCol[i].iMem = ++m;
for(i=0; i<pAggInfo->nFunc; i++) pAggInfo->aFunc[i].iMem = ++m;
pParse->nMem = m;
@ -6230,26 +6228,34 @@ static void assignAggregateRegisters(Parse *pParse, AggInfo *pAggInfo){
static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
Vdbe *v = pParse->pVdbe;
int i;
int iFirstReg;
struct AggInfo_func *pFunc;
int nReg = pAggInfo->nFunc + pAggInfo->nColumn;
assert( pParse->db->pParse==pParse );
assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 );
assert( pAggInfo->mnReg>0 ); /* assignAggregateRegisters() has been run */
if( nReg==0 ) return;
if( pParse->nErr ) return;
if( pAggInfo->nColumn==0 ){
iFirstReg = pAggInfo->aFunc[0].iMem;
}else{
iFirstReg = pAggInfo->aCol[0].iMem;
}
#ifdef SQLITE_DEBUG
/* Verify that all AggInfo registers are within the range specified by
** AggInfo.mnReg..(AggInfo.mnReg+nReg-1) */
/* Verify that all AggInfo register numbers have been assigned and that
** they are all sequential. */
assert( iFirstReg>0 );
for(i=0; i<pAggInfo->nColumn; i++){
assert( pAggInfo->aCol[i].iMem>=pAggInfo->mnReg
&& pAggInfo->aCol[i].iMem<pAggInfo->mnReg+nReg );
assert( pAggInfo->aCol[i].iMem>=iFirstReg );
assert( i==0 || pAggInfo->aCol[i].iMem==pAggInfo->aCol[i-1].iMem+1 );
}
for(i=0; i<pAggInfo->nFunc; i++){
assert( pAggInfo->aFunc[i].iMem>=pAggInfo->mnReg
&& pAggInfo->aFunc[i].iMem<pAggInfo->mnReg+nReg );
assert( pAggInfo->aFunc[i].iMem>=iFirstReg );
assert( i>0 || pAggInfo->nColumn==0
|| pAggInfo->aFunc[i].iMem==pAggInfo->aCol[pAggInfo->nColumn-1].iMem+1 );
assert( i==0 || pAggInfo->aFunc[i].iMem==pAggInfo->aFunc[i-1].iMem+1 );
}
#endif
sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mnReg+nReg-1);
sqlite3VdbeAddOp3(v, OP_Null, 0, iFirstReg, iFirstReg+nReg-1);
for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
if( pFunc->iDistinct>=0 ){
Expr *pE = pFunc->pFExpr;

View File

@ -2719,7 +2719,6 @@ struct AggInfo {
int sortingIdx; /* Cursor number of the sorting index */
int sortingIdxPTab; /* Cursor number of pseudo-table */
int nSortingColumn; /* Number of columns in the sorting index */
int mnReg; /* First in a range of regsiters for aCol and aFunc */
ExprList *pGroupBy; /* The group by clause */
struct AggInfo_col { /* For each column used in source tables */
Table *pTab; /* Source table */