From 511f9e8d29925fd2b68318df516102b8662f4778 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 22 Sep 2016 18:53:13 +0000 Subject: [PATCH] Remove the internal sqlite3CodeOnce() interface, replacing it with a direct call to sqlite3VdbeAddOp0(v,OP_Once). Slightly smaller and faster. FossilOrigin-Name: c3774c6a5fe48af91fda28e9e18c6ed9053ea992 --- manifest | 23 +++++++++++------------ manifest.uuid | 2 +- src/delete.c | 2 +- src/expr.c | 15 +++------------ src/select.c | 4 ++-- src/sqliteInt.h | 1 - src/where.c | 2 +- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/manifest b/manifest index 2528c3d19e..ec0fb230b0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Makefile\schanges\sto\ssupport\sbuilding\swinsqlite3.dll\susing\sSTDCALL\srather\sthan\sCDECL. -D 2016-09-22T18:46:38.171 +C Remove\sthe\sinternal\ssqlite3CodeOnce()\sinterface,\sreplacing\sit\swith\sa\ndirect\scall\sto\ssqlite3VdbeAddOp0(v,OP_Once).\s\sSlightly\ssmaller\sand\sfaster. +D 2016-09-22T18:53:13.560 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f @@ -338,8 +338,8 @@ F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7 F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d -F src/delete.c e91a11e0e86a13ce1917ca5ad7cf14c37ba31e59 -F src/expr.c f35e6c250bceaadc6a65e0c344e8f8bc398119e6 +F src/delete.c cb3f6300df24c26c609778b2731f82644b5532ec +F src/expr.c 471ca87aa3b176548814a332172848015f13d823 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8 F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771 @@ -386,12 +386,12 @@ F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 3c3cf0dc719cd2a32ab5c1e10c26481dd565492e F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac -F src/select.c 244f9cc5e4662987cd2ef5c22d1b7027560f3425 +F src/select.c fb9da69a36382cf9cf57fb7a93247bf3de5a81ae F src/shell.c b80396d2fadce4681397707e30078bf416e1dec2 F src/sqlite.h.in 2683a291ed8db5228024267be6421f0de507b80e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae -F src/sqliteInt.h 1abb4501bbc28c9badf0ebc1e99bd66585ba04f0 +F src/sqliteInt.h e7c39dc148cd38b947cbdd482986afba3fe9ef22 F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247 F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1 F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -467,7 +467,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2 F src/walker.c 83042807db1a27175fcb39be8f3e2a839dbdddb2 -F src/where.c e4140408b81539cf9298355138a3749164dfd6a2 +F src/where.c 5f91be9fe122e847c4e72d54d3989eb32a927981 F src/whereInt.h 14dd243e13b81cbb0a66063d38b70f93a7d6e613 F src/wherecode.c e412e09abad1eea213d85594cf46db9f877db56d F src/whereexpr.c e3db778ed205e982f31960896db71c50612ae009 @@ -1525,8 +1525,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 7785b3a25778cc19861c01f4148f72e0f724f55d 20f3c7436f6a8a7bab3968adc010c7c8325e4618 -R 72cc550b3f8e650b8595781f4d1f9482 -T +closed 20f3c7436f6a8a7bab3968adc010c7c8325e4618 -U mistachkin -Z ffa47cef2805fb0d684496ef32d8ed25 +P 5e892d60935e5c82234d1bfaef4c5026061acceb +R 4a98fd5ad20cf7ad4821bfd13a964ce7 +U drh +Z 0d81e518bb5c5c1a02f800fff5730756 diff --git a/manifest.uuid b/manifest.uuid index 414281e5da..3aff546e20 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e892d60935e5c82234d1bfaef4c5026061acceb \ No newline at end of file +c3774c6a5fe48af91fda28e9e18c6ed9053ea992 \ No newline at end of file diff --git a/src/delete.c b/src/delete.c index 74ffd584a1..ec85718246 100644 --- a/src/delete.c +++ b/src/delete.c @@ -473,7 +473,7 @@ void sqlite3DeleteFrom( if( !isView ){ int iAddrOnce = 0; if( eOnePass==ONEPASS_MULTI ){ - iAddrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v); + iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } testcase( IsVirtual(pTab) ); sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE, diff --git a/src/expr.c b/src/expr.c index 60eff846d0..195fe43955 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1968,15 +1968,6 @@ static Select *isCandidateForInOpt(Expr *pX){ } #endif /* SQLITE_OMIT_SUBQUERY */ -/* -** Code an OP_Once instruction and allocate space for its flag. Return the -** address of the new instruction. -*/ -int sqlite3CodeOnce(Parse *pParse){ - Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ - return sqlite3VdbeAddOp0(v, OP_Once); -} - #ifndef SQLITE_OMIT_SUBQUERY /* ** Generate code that checks the left-most column of index table iCur to see if @@ -2150,7 +2141,7 @@ int sqlite3FindInIndex( assert(v); /* sqlite3GetVdbe() has always been previously called */ if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){ /* The "x IN (SELECT rowid FROM table)" case */ - int iAddr = sqlite3CodeOnce(pParse); + int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); @@ -2233,7 +2224,7 @@ int sqlite3FindInIndex( assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) ); if( colUsed==(MASKBIT(nExpr)-1) ){ /* If we reach this point, that means the index pIdx is usable */ - int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v); + int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); #ifndef SQLITE_OMIT_EXPLAIN sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0, sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName), @@ -2408,7 +2399,7 @@ int sqlite3CodeSubselect( ** save the results, and reuse the same result on subsequent invocations. */ if( !ExprHasProperty(pExpr, EP_VarSelect) ){ - jmpIfDynamic = sqlite3CodeOnce(pParse); VdbeCoverage(v); + jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } #ifndef SQLITE_OMIT_EXPLAIN diff --git a/src/select.c b/src/select.c index 2d4e901ba4..6e4f4b99ed 100644 --- a/src/select.c +++ b/src/select.c @@ -1232,7 +1232,7 @@ static void generateSortTail( int regSortOut = ++pParse->nMem; iSortTab = pParse->nTab++; if( pSort->labelBkOut ){ - addrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v); + addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData); if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); @@ -5027,7 +5027,7 @@ int sqlite3Select( /* If the subquery is not correlated and if we are not inside of ** a trigger, then we only need to compute the value of the subquery ** once. */ - onceAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v); + onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName)); }else{ VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName)); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index ebae7e54ab..6d736b47a6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3583,7 +3583,6 @@ void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); int sqlite3ParseUri(const char*,const char*,unsigned int*, sqlite3_vfs**,char**,char **); Btree *sqlite3DbNameToBtree(sqlite3*,const char*); -int sqlite3CodeOnce(Parse *); #ifdef SQLITE_OMIT_BUILTIN_TEST # define sqlite3FaultSim(X) SQLITE_OK diff --git a/src/where.c b/src/where.c index 0af935ff02..785c13be78 100644 --- a/src/where.c +++ b/src/where.c @@ -651,7 +651,7 @@ static void constructAutomaticIndex( ** transient index on 2nd and subsequent iterations of the loop. */ v = pParse->pVdbe; assert( v!=0 ); - addrInit = sqlite3CodeOnce(pParse); VdbeCoverage(v); + addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); /* Count the number of columns that will be added to the index ** and used to match WHERE clause constraints */ -- 2.47.2