]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Small size reduction and performance increase in the name resolver routine
authordrh <drh@noemail.net>
Tue, 7 Mar 2017 03:25:52 +0000 (03:25 +0000)
committerdrh <drh@noemail.net>
Tue, 7 Mar 2017 03:25:52 +0000 (03:25 +0000)
for expressions.

FossilOrigin-Name: 1a3554e1d71b666325ff377fae5329d79ce5c05f

manifest
manifest.uuid
src/parse.y
src/resolve.c

index 6a2079f2afe2d63950b73ebf6657cbbc89d41f3c..7a5b12b81fb8683ed97a45c8441ef0f7cd26fbb8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sthe\sdefault\sMASK\sargument\sfor\s"PRAGMA\soptimize"\sbe\s0xfffe,\sto\sallow\sfor\nfuture\sexpansion\sof\sup\sto\s14\snew\sdefault-on\soptimizations.
-D 2017-03-06T23:51:16.804
+C Small\ssize\sreduction\sand\sperformance\sincrease\sin\sthe\sname\sresolver\sroutine\nfor\sexpressions.
+D 2017-03-07T03:25:52.677
 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc a89ea37ab5928026001569f056973b9059492fe2
@@ -386,7 +386,7 @@ F src/os_win.c 2a6c73eef01c51a048cc4ddccd57f981afbec18a
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c ff1232b3088a39806035ecfac4fffeb22717d80b
 F src/pager.h f2a99646c5533ffe11afa43e9e0bea74054e4efa
-F src/parse.y af8830094f4aecb91cb69721f3601ad10c36abc4
+F src/parse.y 48b03113704ee8bd78ee6996d81de7fbee22e105
 F src/pcache.c 62835bed959e2914edd26afadfecce29ece0e870
 F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
 F src/pcache1.c e3967219b2a92b9edcb9324a4ba75009090d3953
@@ -395,7 +395,7 @@ F src/pragma.h c9c763958fec92b04125571472c9500b351c5f7f
 F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
 F src/printf.c 67427bbee66d891fc6f6f5aada857e9cdb368c1c
 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
-F src/resolve.c f9bc0de45a30a450da47b3766de00be89bf9be79
+F src/resolve.c 3fd6fdb3666f24bbcc15039031d0b19a5e53c901
 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
 F src/select.c d12f3539f80db38b09015561b569e0eb1c4b6c5f
 F src/shell.c 27d2b31099fd2cd749e44d025ef9b54ca26692cb
@@ -1562,7 +1562,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 ec529bf11b16c801ea438e57d208ff7e4cedf1f9
-R 299bd0d883e4720337a781b64978238c
+P 73019a8bba29fd07f73559cd00d5346fa822b439
+R 1209553f688221f7757a0938ef904e6c
 U drh
-Z 84b44db3e09ed739373a73b84fb9456e
+Z 582428290c16e3af0ac541cc18ae2bc9
index 94998487fcfb2291c8dc751c163634842f8ce326..7407f18c83a97309d9beaf268afb72fd976b9671 100644 (file)
@@ -1 +1 @@
-73019a8bba29fd07f73559cd00d5346fa822b439
\ No newline at end of file
+1a3554e1d71b666325ff377fae5329d79ce5c05f
\ No newline at end of file
index 0949e97d162a46f0bcaa1fce84773f5d517d8f6e..ef9d3dd0ecb0f04cea18dea95206196b426497a2 100644 (file)
@@ -899,7 +899,7 @@ term(A) ::= INTEGER(X). {
   A.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &X, 1);
   A.zStart = X.z;
   A.zEnd = X.z + X.n;
-  if( A.pExpr ) A.pExpr->flags |= EP_Leaf;
+  if( A.pExpr ) A.pExpr->flags |= EP_Leaf|EP_Resolved;
 }
 expr(A) ::= VARIABLE(X).     {
   if( !(X.z[0]=='#' && sqlite3Isdigit(X.z[1])) ){
index 7d89b6fec5729c7b2187f22432ddcd8e732fb4cf..59157996c551e73adc2381c58ad9ae104c6c084c 100644 (file)
@@ -608,33 +608,38 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
 #endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT)
           && !defined(SQLITE_OMIT_SUBQUERY) */
 
-    /* A lone identifier is the name of a column.
-    */
-    case TK_ID: {
-      return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);
-    }
-  
-    /* A table name and column name:     ID.ID
+    /* A column name:                    ID
+    ** Or table name and column name:    ID.ID
     ** Or a database, table and column:  ID.ID.ID
+    **
+    ** The TK_ID and TK_OUT cases are combined so that there will only
+    ** be one call to lookupName().  Then the compiler will in-line 
+    ** lookupName() for a size reduction and performance increase.
     */
+    case TK_ID:
     case TK_DOT: {
       const char *zColumn;
       const char *zTable;
       const char *zDb;
       Expr *pRight;
 
-      /* if( pSrcList==0 ) break; */
-      notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
-      pRight = pExpr->pRight;
-      if( pRight->op==TK_ID ){
+      if( pExpr->op==TK_ID ){
         zDb = 0;
-        zTable = pExpr->pLeft->u.zToken;
-        zColumn = pRight->u.zToken;
+        zTable = 0;
+        zColumn = pExpr->u.zToken;
       }else{
-        assert( pRight->op==TK_DOT );
-        zDb = pExpr->pLeft->u.zToken;
-        zTable = pRight->pLeft->u.zToken;
-        zColumn = pRight->pRight->u.zToken;
+        notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
+        pRight = pExpr->pRight;
+        if( pRight->op==TK_ID ){
+          zDb = 0;
+          zTable = pExpr->pLeft->u.zToken;
+          zColumn = pRight->u.zToken;
+        }else{
+          assert( pRight->op==TK_DOT );
+          zDb = pExpr->pLeft->u.zToken;
+          zTable = pRight->pLeft->u.zToken;
+          zColumn = pRight->pRight->u.zToken;
+        }
       }
       return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);
     }