1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Remove the unused second argument from sqlite3ExprCachePop(). Add an

ALWAYS() on an always-true conditional in sqlite3VdbeResolveLabel().

FossilOrigin-Name: ab23abf392175d3e256ff619b13abbbe732a49ed
This commit is contained in:
drh
2014-04-13 19:28:15 +00:00
parent 87744513e7
commit d249090450
7 changed files with 30 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
C Make\ssure\scolumn\scache\selements\sare\scleared\scorrectly\swhen\sjumping\sover\ncode\sfor\skey\sgeneration\sin\sa\spartial\sindex.\s\nFix\sfor\sticket\s[2ea3e9fe6379fc3f6]. C Remove\sthe\sunused\ssecond\sargument\sfrom\ssqlite3ExprCachePop().\s\sAdd\san\nALWAYS()\son\san\salways-true\sconditional\sin\ssqlite3VdbeResolveLabel().
D 2014-04-13T19:15:49.713 D 2014-04-13T19:28:15.499
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -172,8 +172,8 @@ F src/callback.c 174e3c8656bc29f91d710ab61550d16eea34be98
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a
F src/date.c 593c744b2623971e45affd0bde347631bdfa4625 F src/date.c 593c744b2623971e45affd0bde347631bdfa4625
F src/delete.c d5e3a958519677049a752ed37657240b55ce5806 F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf
F src/expr.c da2b3cb41081af6b56e95e7c9e95949564ce2e21 F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf
F src/func.c 2945bb2c4cdc0ac43733046285a4434310be1811 F src/func.c 2945bb2c4cdc0ac43733046285a4434310be1811
@@ -222,7 +222,7 @@ F src/shell.c 5260f2ada8dd06e9f5ae0a448c8c01e7a75dd881
F src/sqlite.h.in a2ef671f92747a5a1c8a47bad5c585a8dd9eca80 F src/sqlite.h.in a2ef671f92747a5a1c8a47bad5c585a8dd9eca80
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
F src/sqliteInt.h 97df117e13dea9d2fe8a8e32376222e03fe4a4c9 F src/sqliteInt.h dadd17dbd05fd17cad157a7d96339bf4a0b41172
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -282,7 +282,7 @@ F src/vdbe.c bf284edea1cee0508dc93c79a73498e0f317edb7
F src/vdbe.h 394464909ed682334aa3d5831aae0c2fe2abef94 F src/vdbe.h 394464909ed682334aa3d5831aae0c2fe2abef94
F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7 F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
F src/vdbeaux.c 1153175fb57a8454e1c8cf79b59b7bf92b26779d F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447 F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
F src/vdbesort.c 4abb7c0f8f19b7d7d82f4558d5da1a30fdf9ea38 F src/vdbesort.c 4abb7c0f8f19b7d7d82f4558d5da1a30fdf9ea38
@@ -291,7 +291,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd
F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45
F src/where.c 70eb10da08cebbd6a576ced18edb7c8f79d41597 F src/where.c 7614c4383d8b6143558dc349da286d0325704d35
F src/whereInt.h 2564055b440e44ebec8b47f237bbccae6719b7af F src/whereInt.h 2564055b440e44ebec8b47f237bbccae6719b7af
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -1160,7 +1160,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P a67b5312f63909737c052fe58ab5772d45530d49 P 3122b8364082be783821da01d4af2af6a9586327
R 47ced825f4356f6492f482f71c0fa4e8 R e1df7805a07beb887bab893b56a4a7f9
U drh U drh
Z d6e06c047caf6d5aab62e0b2ec59c712 Z 77065e6cb595843b2b0b90941a9d16f6

View File

@@ -1 +1 @@
3122b8364082be783821da01d4af2af6a9586327 ab23abf392175d3e256ff619b13abbbe732a49ed

View File

@@ -832,6 +832,6 @@ int sqlite3GenerateIndexKey(
void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){
if( iLabel ){ if( iLabel ){
sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel); sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
} }
} }

View File

@@ -1883,7 +1883,7 @@ int sqlite3CodeSubselect(
if( testAddr>=0 ){ if( testAddr>=0 ){
sqlite3VdbeJumpHere(v, testAddr); sqlite3VdbeJumpHere(v, testAddr);
} }
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
return rReg; return rReg;
} }
@@ -2018,7 +2018,7 @@ static void sqlite3ExprCodeIN(
} }
} }
sqlite3ReleaseTempReg(pParse, r1); sqlite3ReleaseTempReg(pParse, r1);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
VdbeComment((v, "end IN expr")); VdbeComment((v, "end IN expr"));
} }
#endif /* SQLITE_OMIT_SUBQUERY */ #endif /* SQLITE_OMIT_SUBQUERY */
@@ -2201,15 +2201,14 @@ void sqlite3ExprCachePush(Parse *pParse){
/* /*
** Remove from the column cache any entries that were added since the ** Remove from the column cache any entries that were added since the
** the previous N Push operations. In other words, restore the cache ** the previous sqlite3ExprCachePush operation. In other words, restore
** to the state it was in N Pushes ago. ** the cache to the state it was in prior the most recent Push.
*/ */
void sqlite3ExprCachePop(Parse *pParse, int N){ void sqlite3ExprCachePop(Parse *pParse){
int i; int i;
struct yColCache *p; struct yColCache *p;
assert( N>0 ); assert( pParse->iCacheLevel>=1 );
assert( pParse->iCacheLevel>=N ); pParse->iCacheLevel--;
pParse->iCacheLevel -= N;
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
printf("POP to %d\n", pParse->iCacheLevel); printf("POP to %d\n", pParse->iCacheLevel);
@@ -2687,7 +2686,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
sqlite3ExprCacheRemove(pParse, target, 1); sqlite3ExprCacheRemove(pParse, target, 1);
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target); sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
} }
sqlite3VdbeResolveLabel(v, endCoalesce); sqlite3VdbeResolveLabel(v, endCoalesce);
break; break;
@@ -2741,7 +2740,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */ sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */
sqlite3ExprCodeExprList(pParse, pFarg, r1, sqlite3ExprCodeExprList(pParse, pFarg, r1,
SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR); SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR);
sqlite3ExprCachePop(pParse, 1); /* Ticket 2ea2425d34be */ sqlite3ExprCachePop(pParse); /* Ticket 2ea2425d34be */
}else{ }else{
r1 = 0; r1 = 0;
} }
@@ -2961,13 +2960,13 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
testcase( aListelem[i+1].pExpr->op==TK_COLUMN ); testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target); sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);
sqlite3VdbeAddOp2(v, OP_Goto, 0, endLabel); sqlite3VdbeAddOp2(v, OP_Goto, 0, endLabel);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
sqlite3VdbeResolveLabel(v, nextCase); sqlite3VdbeResolveLabel(v, nextCase);
} }
if( (nExpr&1)!=0 ){ if( (nExpr&1)!=0 ){
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target); sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
}else{ }else{
sqlite3VdbeAddOp2(v, OP_Null, 0, target); sqlite3VdbeAddOp2(v, OP_Null, 0, target);
} }
@@ -3546,7 +3545,7 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
sqlite3VdbeResolveLabel(v, d2); sqlite3VdbeResolveLabel(v, d2);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
break; break;
} }
case TK_OR: { case TK_OR: {
@@ -3554,7 +3553,7 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
break; break;
} }
case TK_NOT: { case TK_NOT: {
@@ -3700,7 +3699,7 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
break; break;
} }
case TK_OR: { case TK_OR: {
@@ -3710,7 +3709,7 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
sqlite3ExprCachePush(pParse); sqlite3ExprCachePush(pParse);
sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
sqlite3VdbeResolveLabel(v, d2); sqlite3VdbeResolveLabel(v, d2);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
break; break;
} }
case TK_NOT: { case TK_NOT: {

View File

@@ -3083,7 +3083,7 @@ void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
void sqlite3ExprCodeMove(Parse*, int, int, int); void sqlite3ExprCodeMove(Parse*, int, int, int);
void sqlite3ExprCacheStore(Parse*, int, int, int); void sqlite3ExprCacheStore(Parse*, int, int, int);
void sqlite3ExprCachePush(Parse*); void sqlite3ExprCachePush(Parse*);
void sqlite3ExprCachePop(Parse*, int); void sqlite3ExprCachePop(Parse*);
void sqlite3ExprCacheRemove(Parse*, int, int); void sqlite3ExprCacheRemove(Parse*, int, int);
void sqlite3ExprCacheClear(Parse*); void sqlite3ExprCacheClear(Parse*);
void sqlite3ExprCacheAffinityChange(Parse*, int, int); void sqlite3ExprCacheAffinityChange(Parse*, int, int);

View File

@@ -276,7 +276,7 @@ void sqlite3VdbeResolveLabel(Vdbe *v, int x){
int j = -1-x; int j = -1-x;
assert( v->magic==VDBE_MAGIC_INIT ); assert( v->magic==VDBE_MAGIC_INIT );
assert( j<p->nLabel ); assert( j<p->nLabel );
if( j>=0 && p->aLabel ){ if( ALWAYS(j>=0) && p->aLabel ){
p->aLabel[j] = v->nOp; p->aLabel[j] = v->nOp;
} }
p->iFixedOp = v->nOp - 1; p->iFixedOp = v->nOp - 1;

View File

@@ -2841,7 +2841,7 @@ static Bitmask codeOneLoopStart(
pLevel->p1 = iCur; pLevel->p1 = iCur;
pLevel->p2 = sqlite3VdbeCurrentAddr(v); pLevel->p2 = sqlite3VdbeCurrentAddr(v);
sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
sqlite3ExprCachePop(pParse, 1); sqlite3ExprCachePop(pParse);
}else }else
#endif /* SQLITE_OMIT_VIRTUALTABLE */ #endif /* SQLITE_OMIT_VIRTUALTABLE */