From 25c3b8caf4f19658cb34ad33686fcf9f30873907 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Apr 2018 10:34:13 +0000 Subject: [PATCH 1/2] Reduce the size of the NameContext object by grouping seldom-used fields into a union. FossilOrigin-Name: dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/expr.c | 3 ++- src/resolve.c | 14 +++++++++----- src/select.c | 3 ++- src/sqliteInt.h | 8 ++++++-- 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index ef91e54a13..da1fb89e0f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\salways-true\sbranch\sfrom\sthe\spreupdate\shook\slogic. -D 2018-04-13T16:23:22.787 +C Reduce\sthe\ssize\sof\sthe\sNameContext\sobject\sby\sgrouping\sseldom-used\sfields\ninto\sa\sunion. +D 2018-04-16T10:34:13.460 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3 @@ -443,7 +443,7 @@ F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957 F src/dbpage.c 8db4c97f630e7d83f884ea75caf1ffd0988c160e9d530194d93721c80821e0f6 F src/dbstat.c edabb82611143727511a45ca0859b8cd037851ebe756ae3db289859dd18b6f91 F src/delete.c 20c8788451dc737a967c87ea53ad43544d617f5b57d32ccce8bd52a0daf9e89b -F src/expr.c 6a41ceb27924dcfb6dc910a283ce74e136c9c305aba87a5acbfca32f5c49caa7 +F src/expr.c ca52b09125b9619062202eac54b69df5fff170a84dcbc961c19402de6dd6dfeb F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c d617daf66b5515e2b42c1405b2b4984c30ca50fb705ab164271a9bf66c69e331 F src/func.c 94f42cba2cc1c34aeaa441022ba0170ec3fec4bba54db4e0ded085c6dc0fdc51 @@ -489,14 +489,14 @@ F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324 F src/prepare.c b086fea6a1952db88beca31fdd621201ee5e4ce3f02905248cc3035a8174aa89 F src/printf.c d3b7844ddeb11fbbdd38dd84d09c9c1ac171d21fb038473c3aa97981201cc660 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 -F src/resolve.c 66c73fcb7719b8ff0e841b58338f13604ff3e2b50a723f9b8f383595735262f6 +F src/resolve.c b3ace63b0470cb0063c2acc3a1dcb95eb432be45ed3c931854694f8a000cd763 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac -F src/select.c 41e857c107be5fb972b87a4cbb948c8b1191f339c1e32a65742581573932e119 +F src/select.c 3e84cb869930aa8fcacd3acbb1a0ec2d82736c8479d6a4367a5f1a926fb8a763 F src/shell.c.in cc960721e56ebc1a78773bb5d2f5608b54275f945cbe49e4afe919d6888062a7 F src/sqlite.h.in e0be726ea6e4e6571724d39d242472ecd8bd1ba6f84ade88e1641bde98a6d02b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 83a3c4ce93d650bedfd1aa558cb85a516bd6d094445ee989740827d0d944368d -F src/sqliteInt.h a4837c57f9a3e2af100bc59f4be60d16b823f18131f8cef6a6685440f775eebd +F src/sqliteInt.h 155bd93e3d6dd215cf3f48c7817576ae086fcb5acc9d59cfefa3f720959928af F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 @@ -1717,7 +1717,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 d7ec7b5970df9e542401f8299e098a5039d1875e2e3383dad06a0ec998589b6e -R f9cb5caefaf1e23db60ecde977cce853 +P 0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91 +R 80124f5c46813a79081d38ccf28ed65d U drh -Z 2e05817b48e1d8380863fbfa532bc935 +Z 0ede432c15c5cbd49352341f017c0dd7 diff --git a/manifest.uuid b/manifest.uuid index 8a952e019d..d3e97144da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91 \ No newline at end of file +dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index eac5476f73..73a4416443 100644 --- a/src/expr.c +++ b/src/expr.c @@ -5255,8 +5255,9 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ NameContext *pNC = pWalker->u.pNC; Parse *pParse = pNC->pParse; SrcList *pSrcList = pNC->pSrcList; - AggInfo *pAggInfo = pNC->pAggInfo; + AggInfo *pAggInfo = pNC->uNC.pAggInfo; + assert( pNC->ncFlags & NC_UAggInfo ); switch( pExpr->op ){ case TK_AGG_COLUMN: case TK_COLUMN: { diff --git a/src/resolve.c b/src/resolve.c index 7ae49bde57..c8059df974 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -383,10 +383,12 @@ static int lookupName( ** is supported for backwards compatibility only. Hence, we issue a warning ** on sqlite3_log() whenever the capability is used. */ - if( (pEList = pNC->pEList)!=0 - && zTab==0 + if( (pNC->ncFlags & NC_UEList)!=0 && cnt==0 + && zTab==0 ){ + pEList = pNC->uNC.pEList; + assert( pEList!=0 ); for(j=0; jnExpr; j++){ char *zAs = pEList->a[j].zName; if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){ @@ -915,8 +917,8 @@ static int resolveOrderByTermToExprList( memset(&nc, 0, sizeof(nc)); nc.pParse = pParse; nc.pSrcList = pSelect->pSrc; - nc.pEList = pEList; - nc.ncFlags = NC_AllowAgg; + nc.uNC.pEList = pEList; + nc.ncFlags = NC_AllowAgg|NC_UEList; nc.nErr = 0; db = pParse->db; savedSuppErr = db->suppressErr; @@ -1299,7 +1301,9 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ ** Minor point: If this is the case, then the expression will be ** re-evaluated for each reference to it. */ - sNC.pEList = p->pEList; + assert( (sNC.ncFlags & (NC_UAggInfo))==0 ); + sNC.uNC.pEList = p->pEList; + sNC.ncFlags |= NC_UEList; if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; diff --git a/src/select.c b/src/select.c index 3e765c8464..c2686e0fec 100644 --- a/src/select.c +++ b/src/select.c @@ -5683,7 +5683,8 @@ int sqlite3Select( memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; - sNC.pAggInfo = &sAggInfo; + sNC.uNC.pAggInfo = &sAggInfo; + VVA_ONLY( sNC.ncFlags = NC_UAggInfo; ) sAggInfo.mnReg = pParse->nMem+1; sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0; sAggInfo.pGroupBy = pGroupBy; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index d932ae87da..45cefb95a9 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2682,8 +2682,10 @@ struct SrcList { struct NameContext { Parse *pParse; /* The parser */ SrcList *pSrcList; /* One or more tables used to resolve names */ - ExprList *pEList; /* Optional list of result-set columns */ - AggInfo *pAggInfo; /* Information about aggregates at this level */ + union { + ExprList *pEList; /* Optional list of result-set columns */ + AggInfo *pAggInfo; /* Information about aggregates at this level */ + } uNC; NameContext *pNext; /* Next outer name context. NULL for outermost */ int nRef; /* Number of names resolved by this context */ int nErr; /* Number of errors encountered while resolving names */ @@ -2705,6 +2707,8 @@ struct NameContext { #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */ #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */ #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */ +#define NC_UEList 0x0080 /* True if uNC.pEList is used */ +#define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ #define NC_Complex 0x2000 /* True if a function or subquery seen */ From f5ced1f3b14994816b476e63bf37213dce33f10d Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Apr 2018 10:41:15 +0000 Subject: [PATCH 2/2] Increase the version number to 3.24.0 FossilOrigin-Name: f94528e1c70765c8649750b2d9c17f23e81f191554ff56d905a9abe3fb6037b7 --- VERSION | 2 +- configure | 18 +++++++++--------- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/VERSION b/VERSION index 9b2f2a1688..954e228821 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.23.1 +3.24.0 diff --git a/configure b/configure index baead2ea36..ea1160120f 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.23.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.24.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -726,8 +726,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.23.1' -PACKAGE_STRING='sqlite 3.23.1' +PACKAGE_VERSION='3.24.0' +PACKAGE_STRING='sqlite 3.24.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1465,7 +1465,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.23.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.24.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1530,7 +1530,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.23.1:";; + short | recursive ) echo "Configuration of sqlite 3.24.0:";; esac cat <<\_ACEOF @@ -1655,7 +1655,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.23.1 +sqlite configure 3.24.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2074,7 +2074,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.23.1, which was +It was created by sqlite $as_me 3.24.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -12242,7 +12242,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.23.1, which was +This file was extended by sqlite $as_me 3.24.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12308,7 +12308,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.23.1 +sqlite config.status 3.24.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/manifest b/manifest index da1fb89e0f..db3eba976c 100644 --- a/manifest +++ b/manifest @@ -1,12 +1,12 @@ -C Reduce\sthe\ssize\sof\sthe\sNameContext\sobject\sby\sgrouping\sseldom-used\sfields\ninto\sa\sunion. -D 2018-04-16T10:34:13.460 +C Increase\sthe\sversion\snumber\sto\s3.24.0 +D 2018-04-16T10:41:15.351 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 43dd6ae2e5a2bb8df7bfc9ed85935129caffeafb8c1803d24c5d038b1e74c8ca F README.md 7764d56778d567913ef11c82da9ab94aefa0826f7c243351e4e2d7adaef6f373 -F VERSION 7169eb6959db9ad1b7004ae3b754ef6e703eb7d8dde3b07d2e63103413eb25fb +F VERSION b7c9d1d11cb70ef8e90cfcf3c944aa58a9f801cc2ad487eebb0a110c16dfc2df F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 @@ -32,7 +32,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 41d0e05b0d289c1c981aafe5c4070713c8e70b5a7d3472360764a3fce08a82a8 x +F configure 80e2dcad8ab88aacc58b55eb0e395f79184b45fcfaa3f36fc20d2e71cfa0a7e4 x F configure.ac d4529ebb26ae046269334f1dac65f2b1d6927c2efe22b2ec24dce24dfe4f83dd F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 278113807f49d12d04179a93fab92b5b917a08771152ca7949d34e928efa3941 @@ -1717,7 +1717,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 0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91 -R 80124f5c46813a79081d38ccf28ed65d +P dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742 +R 50577be4101ba6800e0ceb3fdb5a7f41 U drh -Z 0ede432c15c5cbd49352341f017c0dd7 +Z fd8d37ec919dd409461d7d6bfec613a5 diff --git a/manifest.uuid b/manifest.uuid index d3e97144da..a7a4e35008 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742 \ No newline at end of file +f94528e1c70765c8649750b2d9c17f23e81f191554ff56d905a9abe3fb6037b7 \ No newline at end of file