mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
Simplifications to the expr.c source module resulting from structural
testing. (CVS 6694) FossilOrigin-Name: f760bb7a0372d11ac7e3287b8a56fc4261e6371c
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sfor\sticket\s#3887.\s\sOther\sunrelated\sbits\sof\scode\scleanup\sin\sthe\sexpr.c\nsource\smodule.\s(CVS\s6693)
|
C Simplifications\sto\sthe\sexpr.c\ssource\smodule\sresulting\sfrom\sstructural\ntesting.\s(CVS\s6694)
|
||||||
D 2009-05-30T14:16:32
|
D 2009-05-30T20:49:20
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -114,7 +114,7 @@ F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686
|
|||||||
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
|
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
|
||||||
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
|
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
|
||||||
F src/delete.c cb791855c7948cecc96def9d97989879ca26f257
|
F src/delete.c cb791855c7948cecc96def9d97989879ca26f257
|
||||||
F src/expr.c 0851fab95daa554fee9c807f418661c9f76a159d
|
F src/expr.c f0b46b992f5e371706e91205fe3b8aea199d8766
|
||||||
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
|
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
|
||||||
F src/func.c 9d7b47729c337c5e4b78d795922ed34eec4aef67
|
F src/func.c 9d7b47729c337c5e4b78d795922ed34eec4aef67
|
||||||
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
|
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
|
||||||
@@ -158,7 +158,7 @@ F src/printf.c 3f4dca207a88258d37af5a7a03e800a825fe6456
|
|||||||
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
|
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
|
||||||
F src/resolve.c 42065c05d4dd56894d1ae232974668674435e468
|
F src/resolve.c 42065c05d4dd56894d1ae232974668674435e468
|
||||||
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
|
F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f
|
||||||
F src/select.c fd1737a667bab296f50049a841b3aba5ec89418e
|
F src/select.c a3d8a0185e437e10adf82b69cd41c987bb2e58bb
|
||||||
F src/shell.c 7eacd0bdaa887931f5ff205c9defc3e8df95a2dd
|
F src/shell.c 7eacd0bdaa887931f5ff205c9defc3e8df95a2dd
|
||||||
F src/sqlite.h.in 79210c4d8905cfb4b038486dde5f36fabb796a86
|
F src/sqlite.h.in 79210c4d8905cfb4b038486dde5f36fabb796a86
|
||||||
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
||||||
@@ -731,7 +731,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 874295ce71380da3f4c9296df0e0ce5ece136220
|
P 00e7250f11e190cd915870438d172f574d110e6d
|
||||||
R 45b4a46b0ff2886bd9af43bbb9bddda9
|
R eed238d5c207fcace25a1d14a8d7836f
|
||||||
U drh
|
U drh
|
||||||
Z 3b1ac411039a31c3d64698f887a60c7f
|
Z b1372e359ebf0d19a0cf7f52aedf055c
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
00e7250f11e190cd915870438d172f574d110e6d
|
f760bb7a0372d11ac7e3287b8a56fc4261e6371c
|
||||||
22
src/expr.c
22
src/expr.c
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.442 2009/05/30 14:16:32 drh Exp $
|
** $Id: expr.c,v 1.443 2009/05/30 20:49:20 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -2584,7 +2584,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
|||||||
** or if there is no matching Ei, the ELSE term Y, or if there is
|
** or if there is no matching Ei, the ELSE term Y, or if there is
|
||||||
** no ELSE term, NULL.
|
** no ELSE term, NULL.
|
||||||
*/
|
*/
|
||||||
case TK_CASE: {
|
default: assert( op==TK_CASE ); {
|
||||||
int endLabel; /* GOTO label for end of CASE stmt */
|
int endLabel; /* GOTO label for end of CASE stmt */
|
||||||
int nextCase; /* GOTO label for next WHEN clause */
|
int nextCase; /* GOTO label for next WHEN clause */
|
||||||
int nExpr; /* 2x number of WHEN terms */
|
int nExpr; /* 2x number of WHEN terms */
|
||||||
@@ -2606,7 +2606,8 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
|||||||
endLabel = sqlite3VdbeMakeLabel(v);
|
endLabel = sqlite3VdbeMakeLabel(v);
|
||||||
if( (pX = pExpr->pLeft)!=0 ){
|
if( (pX = pExpr->pLeft)!=0 ){
|
||||||
cacheX = *pX;
|
cacheX = *pX;
|
||||||
testcase( pX->op==TK_COLUMN || pX->op==TK_REGISTER );
|
testcase( pX->op==TK_COLUMN );
|
||||||
|
testcase( pX->op==TK_REGISTER );
|
||||||
cacheX.iTable = sqlite3ExprCodeTemp(pParse, pX, ®Free1);
|
cacheX.iTable = sqlite3ExprCodeTemp(pParse, pX, ®Free1);
|
||||||
testcase( regFree1==0 );
|
testcase( regFree1==0 );
|
||||||
cacheX.op = TK_REGISTER;
|
cacheX.op = TK_REGISTER;
|
||||||
@@ -2623,7 +2624,8 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
|||||||
pTest = aListelem[i].pExpr;
|
pTest = aListelem[i].pExpr;
|
||||||
}
|
}
|
||||||
nextCase = sqlite3VdbeMakeLabel(v);
|
nextCase = sqlite3VdbeMakeLabel(v);
|
||||||
testcase( pTest->op==TK_COLUMN || pTest->op==TK_REGISTER );
|
testcase( pTest->op==TK_COLUMN );
|
||||||
|
testcase( pTest->op==TK_COLUMN );
|
||||||
sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
|
sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
|
||||||
testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
|
testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
|
||||||
testcase( aListelem[i+1].pExpr->op==TK_REGISTER );
|
testcase( aListelem[i+1].pExpr->op==TK_REGISTER );
|
||||||
@@ -2807,7 +2809,7 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){
|
|||||||
Parse *pParse = pWalker->pParse;
|
Parse *pParse = pWalker->pParse;
|
||||||
switch( pExpr->op ){
|
switch( pExpr->op ){
|
||||||
case TK_REGISTER: {
|
case TK_REGISTER: {
|
||||||
return 1;
|
return WRC_Prune;
|
||||||
}
|
}
|
||||||
case TK_FUNCTION:
|
case TK_FUNCTION:
|
||||||
case TK_AGG_FUNCTION:
|
case TK_AGG_FUNCTION:
|
||||||
@@ -2822,7 +2824,7 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){
|
|||||||
int i = pList->nExpr;
|
int i = pList->nExpr;
|
||||||
struct ExprList_item *pItem = pList->a;
|
struct ExprList_item *pItem = pList->a;
|
||||||
for(; i>0; i--, pItem++){
|
for(; i>0; i--, pItem++){
|
||||||
if( pItem->pExpr ) pItem->pExpr->flags |= EP_FixedDest;
|
if( ALWAYS(pItem->pExpr) ) pItem->pExpr->flags |= EP_FixedDest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2832,7 +2834,7 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){
|
|||||||
int r1 = ++pParse->nMem;
|
int r1 = ++pParse->nMem;
|
||||||
int r2;
|
int r2;
|
||||||
r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);
|
r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);
|
||||||
if( r1!=r2 ) sqlite3ReleaseTempReg(pParse, r1);
|
if( NEVER(r1!=r2) ) sqlite3ReleaseTempReg(pParse, r1);
|
||||||
pExpr->op = TK_REGISTER;
|
pExpr->op = TK_REGISTER;
|
||||||
pExpr->iTable = r2;
|
pExpr->iTable = r2;
|
||||||
return WRC_Prune;
|
return WRC_Prune;
|
||||||
@@ -2910,7 +2912,8 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
int r1, r2;
|
int r1, r2;
|
||||||
|
|
||||||
assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
|
assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
|
||||||
if( v==0 || pExpr==0 ) return;
|
if( NEVER(v==0) ) return; /* Existance of VDBE checked by caller */
|
||||||
|
if( NEVER(pExpr==0) ) return; /* No way this can happen */
|
||||||
op = pExpr->op;
|
op = pExpr->op;
|
||||||
switch( op ){
|
switch( op ){
|
||||||
case TK_AND: {
|
case TK_AND: {
|
||||||
@@ -3034,7 +3037,8 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
|
|||||||
int r1, r2;
|
int r1, r2;
|
||||||
|
|
||||||
assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
|
assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
|
||||||
if( v==0 || pExpr==0 ) return;
|
if( NEVER(v==0) ) return; /* Existance of VDBE checked by caller */
|
||||||
|
if( pExpr==0 ) return;
|
||||||
|
|
||||||
/* The value of pExpr->op and op are related as follows:
|
/* The value of pExpr->op and op are related as follows:
|
||||||
**
|
**
|
||||||
|
|||||||
10
src/select.c
10
src/select.c
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle SELECT statements in SQLite.
|
** to handle SELECT statements in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: select.c,v 1.520 2009/05/28 01:00:55 drh Exp $
|
** $Id: select.c,v 1.521 2009/05/30 20:49:20 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -3959,9 +3959,7 @@ int sqlite3Select(
|
|||||||
VdbeComment((v, "Groupby result generator entry point"));
|
VdbeComment((v, "Groupby result generator entry point"));
|
||||||
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
|
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
|
||||||
finalizeAggFunctions(pParse, &sAggInfo);
|
finalizeAggFunctions(pParse, &sAggInfo);
|
||||||
if( pHaving ){
|
sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
|
||||||
sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
|
|
||||||
}
|
|
||||||
selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,
|
selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,
|
||||||
distinct, pDest,
|
distinct, pDest,
|
||||||
addrOutputRow+1, addrSetAbort);
|
addrOutputRow+1, addrSetAbort);
|
||||||
@@ -4092,9 +4090,7 @@ int sqlite3Select(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pOrderBy = 0;
|
pOrderBy = 0;
|
||||||
if( pHaving ){
|
sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
|
||||||
sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
|
|
||||||
}
|
|
||||||
selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1,
|
selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1,
|
||||||
pDest, addrEnd, addrEnd);
|
pDest, addrEnd, addrEnd);
|
||||||
sqlite3ExprListDelete(db, pDel);
|
sqlite3ExprListDelete(db, pDel);
|
||||||
|
|||||||
Reference in New Issue
Block a user