Add missing VdbeCoverage() and VdbeCoverageNeverTaken() macros to window.c.
FossilOrigin-Name: 4383cb68a1241768ddb3f180f8cbb9ea1638f8806210b10aac1384b8a7ecdca2
This commit is contained in:
parent
f02cdd379a
commit
01e1229063
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Avoid\sredundant\sORDER\sBY\soperations\swhen\srewriting\sSELECT\sstatements\sthat\ncontain\swindow\sfunctions.
|
||||
D 2018-06-27T19:48:50.544
|
||||
C Add\smissing\sVdbeCoverage()\sand\sVdbeCoverageNeverTaken()\smacros\sto\swindow.c.
|
||||
D 2018-06-27T20:24:59.489
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
|
||||
@ -584,7 +584,7 @@ F src/where.c 0bcbf9e191ca07f9ea2008aa80e70ded46bcdffd26560c83397da501f00aece6
|
||||
F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4
|
||||
F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96
|
||||
F src/whereexpr.c 19cf35cdd9bf6d5589d8a5c960d99259761136187a2319a6e14d11cf1abe14c2
|
||||
F src/window.c 14c64e0717cab5764c7ace19f9c72be123639c051f7017b47ef6cf74528daaa8
|
||||
F src/window.c 4403ae36b9645f105ad8ae16d986929c6db5f3bc7d3d3db43f5fa51c6bbfcbe8
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
|
||||
@ -1743,7 +1743,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d9f814b4437eae4c49ba8abec7b58ef9dbb49d4ba8d1c95e08a2e717ef3839ee
|
||||
R cc5ef730994398d66ba6df8a9035456a
|
||||
P 336de43a47e206fe7629072e5b8c80d4ede17ead8ef4dcf5d8da6833ff22d2f9
|
||||
R b7bd98ed0e43c8f2d4cb4f0d7b13d574
|
||||
U dan
|
||||
Z cdcaab38ea26a5b321640bb9e7f7a848
|
||||
Z 38db85555459c758350756078d19d70e
|
||||
|
@ -1 +1 @@
|
||||
336de43a47e206fe7629072e5b8c80d4ede17ead8ef4dcf5d8da6833ff22d2f9
|
||||
4383cb68a1241768ddb3f180f8cbb9ea1638f8806210b10aac1384b8a7ecdca2
|
36
src/window.c
36
src/window.c
@ -954,6 +954,7 @@ static void windowCheckFrameValue(Parse *pParse, int reg, int bEnd){
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, regZero);
|
||||
sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2);
|
||||
sqlite3VdbeAddOp3(v, OP_Ge, regZero, sqlite3VdbeCurrentAddr(v)+2, reg);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_ERROR, OE_Abort);
|
||||
sqlite3VdbeAppendP4(v, (void*)azErr[bEnd], P4_STATIC);
|
||||
sqlite3ReleaseTempReg(pParse, regZero);
|
||||
@ -1031,6 +1032,7 @@ static void windowAggStep(
|
||||
sqlite3VdbeAddOp2(v, OP_IdxInsert, pWin->csrApp, pWin->regApp+2);
|
||||
}else{
|
||||
sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp);
|
||||
sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
|
||||
}
|
||||
@ -1056,6 +1058,7 @@ static void windowAggStep(
|
||||
regTmp = regArg + nArg;
|
||||
}
|
||||
addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1);
|
||||
VdbeCoverage(v);
|
||||
if( csr>0 ){
|
||||
sqlite3ReleaseTempReg(pParse, regTmp);
|
||||
}
|
||||
@ -1089,6 +1092,7 @@ static void windowAggFinal(Parse *pParse, Window *pMWin, int bFinal){
|
||||
){
|
||||
sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);
|
||||
sqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult);
|
||||
sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);
|
||||
if( bFinal ){
|
||||
@ -1156,6 +1160,7 @@ static void windowPartitionCache(
|
||||
addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart);
|
||||
sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
|
||||
sqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1);
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, regFlushPart, lblFlushPart);
|
||||
}
|
||||
@ -1209,7 +1214,9 @@ static void windowReturnOneRow(
|
||||
}
|
||||
sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg);
|
||||
sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
|
||||
sqlite3VdbeResolveLabel(v, lbl);
|
||||
sqlite3ReleaseTempReg(pParse, tmpReg);
|
||||
@ -1239,6 +1246,7 @@ static void windowReturnOneRow(
|
||||
}
|
||||
|
||||
sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult);
|
||||
sqlite3VdbeResolveLabel(v, lbl);
|
||||
sqlite3ReleaseTempReg(pParse, tmpReg);
|
||||
@ -1275,12 +1283,14 @@ static void windowReturnRows(
|
||||
Vdbe *v = sqlite3GetVdbe(pParse);
|
||||
windowAggFinal(pParse, pMWin, 0);
|
||||
addr = sqlite3VdbeAddOp3(v, OP_IfPos, regCtr, sqlite3VdbeCurrentAddr(v)+2 ,1);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
|
||||
windowReturnOneRow(pParse, pMWin, regGosub, addrGosub);
|
||||
if( regInvArg ){
|
||||
windowAggStep(pParse, pMWin, pMWin->iEphCsr, 1, regInvArg, regInvSize);
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, addr);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeJumpHere(v, addr+1); /* The OP_Goto */
|
||||
}
|
||||
|
||||
@ -1489,6 +1499,7 @@ static void windowCodeRowExprStep(
|
||||
/* Start of "flush_partition" */
|
||||
sqlite3VdbeResolveLabel(v, lblFlushPart);
|
||||
sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+3);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_OpenDup, csrStart, pMWin->iEphCsr);
|
||||
sqlite3VdbeAddOp2(v, OP_OpenDup, csrEnd, pMWin->iEphCsr);
|
||||
|
||||
@ -1514,6 +1525,7 @@ static void windowCodeRowExprStep(
|
||||
if( pMWin->pEnd && pMWin->pStart && pMWin->eStart==TK_FOLLOWING ){
|
||||
assert( pMWin->eEnd==TK_FOLLOWING );
|
||||
sqlite3VdbeAddOp3(v, OP_Ge, regStart, sqlite3VdbeCurrentAddr(v)+2, regEnd);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart);
|
||||
sqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regEnd);
|
||||
}
|
||||
@ -1521,6 +1533,7 @@ static void windowCodeRowExprStep(
|
||||
if( pMWin->pEnd && pMWin->pStart && pMWin->eEnd==TK_PRECEDING ){
|
||||
assert( pMWin->eStart==TK_PRECEDING );
|
||||
sqlite3VdbeAddOp3(v, OP_Le, regStart, sqlite3VdbeCurrentAddr(v)+3, regEnd);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart);
|
||||
sqlite3VdbeAddOp2(v, OP_Copy, regSize, regEnd);
|
||||
}
|
||||
@ -1529,9 +1542,12 @@ static void windowCodeRowExprStep(
|
||||
regArg = windowInitAccum(pParse, pMWin);
|
||||
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblFlushDone);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, csrStart, lblFlushDone);
|
||||
VdbeCoverageNeverTaken(v);
|
||||
sqlite3VdbeChangeP5(v, 1);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, csrEnd, lblFlushDone);
|
||||
VdbeCoverageNeverTaken(v);
|
||||
sqlite3VdbeChangeP5(v, 1);
|
||||
|
||||
/* Invoke AggStep function for each window function using the row that
|
||||
@ -1540,8 +1556,10 @@ static void windowCodeRowExprStep(
|
||||
addrTop = sqlite3VdbeCurrentAddr(v);
|
||||
if( pMWin->eEnd==TK_PRECEDING ){
|
||||
addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_Next, csrEnd, sqlite3VdbeCurrentAddr(v)+2);
|
||||
VdbeCoverage(v);
|
||||
addr = sqlite3VdbeAddOp0(v, OP_Goto);
|
||||
windowAggStep(pParse, pMWin, csrEnd, 0, regArg, regSize);
|
||||
if( pMWin->eEnd==TK_UNBOUNDED ){
|
||||
@ -1557,13 +1575,16 @@ static void windowCodeRowExprStep(
|
||||
|
||||
if( pMWin->eEnd==TK_FOLLOWING ){
|
||||
addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
if( pMWin->eStart==TK_FOLLOWING ){
|
||||
addrIfPos2 = sqlite3VdbeAddOp3(v, OP_IfPos, regStart, 0 , 1);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
windowAggFinal(pParse, pMWin, 0);
|
||||
windowReturnOneRow(pParse, pMWin, regGosub, addrGosub);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)+2);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 0, lblFlushDone);
|
||||
if( pMWin->eStart==TK_FOLLOWING ){
|
||||
sqlite3VdbeJumpHere(v, addrIfPos2);
|
||||
@ -1576,8 +1597,10 @@ static void windowCodeRowExprStep(
|
||||
int addrJumpHere = 0;
|
||||
if( pMWin->eStart==TK_PRECEDING ){
|
||||
addrJumpHere = sqlite3VdbeAddOp3(v, OP_IfPos, regStart, 0 , 1);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_Next, csrStart, sqlite3VdbeCurrentAddr(v)+1);
|
||||
VdbeCoverage(v);
|
||||
windowAggStep(pParse, pMWin, csrStart, 1, regArg, regSize);
|
||||
if( addrJumpHere ){
|
||||
sqlite3VdbeJumpHere(v, addrJumpHere);
|
||||
@ -1748,6 +1771,7 @@ static void windowCodeCacheStep(
|
||||
/* Start of "flush_partition" */
|
||||
sqlite3VdbeResolveLabel(v, lblFlushPart);
|
||||
sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+2);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_OpenDup, csrLead, pMWin->iEphCsr);
|
||||
|
||||
/* Initialize the accumulator register for each window function to NULL */
|
||||
@ -1755,13 +1779,17 @@ static void windowCodeCacheStep(
|
||||
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, regCtr);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblEmpty);
|
||||
VdbeCoverageNeverTaken(v);
|
||||
|
||||
if( bReverse ){
|
||||
int addr = sqlite3VdbeCurrentAddr(v);
|
||||
windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
|
||||
VdbeCoverageNeverTaken(v);
|
||||
}
|
||||
addrNext = sqlite3VdbeCurrentAddr(v);
|
||||
|
||||
@ -1778,6 +1806,7 @@ static void windowCodeCacheStep(
|
||||
addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer);
|
||||
sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
|
||||
addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, nPeer-1);
|
||||
}
|
||||
|
||||
@ -1792,6 +1821,7 @@ static void windowCodeCacheStep(
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_AddImm, regCtr, 1);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, csrLead, addrNext);
|
||||
VdbeCoverage(v);
|
||||
|
||||
windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub, 0, 0);
|
||||
|
||||
@ -1892,6 +1922,7 @@ static void windowCodeDefaultStep(
|
||||
addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart);
|
||||
sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
|
||||
addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
|
||||
VdbeCoverage(v);
|
||||
windowAggFinal(pParse, pMWin, 1);
|
||||
if( pOrderBy ){
|
||||
addrGoto = sqlite3VdbeAddOp0(v, OP_Goto);
|
||||
@ -1908,6 +1939,7 @@ static void windowCodeDefaultStep(
|
||||
addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer);
|
||||
sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO);
|
||||
addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2);
|
||||
VdbeCoverage(v);
|
||||
}else{
|
||||
addrJump = 0;
|
||||
}
|
||||
@ -1916,8 +1948,10 @@ static void windowCodeDefaultStep(
|
||||
}
|
||||
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1);
|
||||
VdbeCoverage(v);
|
||||
|
||||
sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr);
|
||||
sqlite3VdbeAddOp3(
|
||||
@ -1945,8 +1979,10 @@ static void windowCodeDefaultStep(
|
||||
|
||||
windowAggFinal(pParse, pMWin, 1);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user