From: drh Date: Sat, 1 Oct 2016 21:43:37 +0000 (+0000) Subject: Rearrange fields in the Parse object to reduce the amount of initialization X-Git-Tag: version-3.15.0~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=445f3d564c3f225be477b47cd1c332614113cca7;p=thirdparty%2Fsqlite.git Rearrange fields in the Parse object to reduce the amount of initialization required. FossilOrigin-Name: 361940b44dd17bf2b39fc0e0716c0de6b2b7f4f7 --- diff --git a/manifest b/manifest index ca02dd450c..21ffdd5597 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sthe\swidth\sof\sa\smemset()\sto\savoid\sdouble-initializing\ssome\svariables. -D 2016-10-01T20:43:41.486 +C Rearrange\sfields\sin\sthe\sParse\sobject\sto\sreduce\sthe\samount\sof\sinitialization\nrequired. +D 2016-10-01T21:43:37.888 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f @@ -391,7 +391,7 @@ 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 16f22a872a901d4a455a4a65bbbc1658cc2159f4 +F src/sqliteInt.h 5748a35f10c0a03dc546caf8508f41ae3895ee8b F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247 F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1 F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9 @@ -1525,7 +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 a76bff74ce47c9c98106566bde5d781992657e22 -R 9894c16f602bc73182e0b90dfc6c19cc +P 34edbfd12d6cfa6bbfa30eef9276a4865eadc869 +R de5ca274755abcf0d716abfc4e191e0a U drh -Z 74b7a0dbeb8f3fe501e0e4424068d2fe +Z f893e5ce9e69907538e2c5169945e4a7 diff --git a/manifest.uuid b/manifest.uuid index 7e97ce5af9..d72e56d3cc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -34edbfd12d6cfa6bbfa30eef9276a4865eadc869 \ No newline at end of file +361940b44dd17bf2b39fc0e0716c0de6b2b7f4f7 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 61a705827e..fade8a34d0 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2890,7 +2890,6 @@ struct Parse { u8 okConstFactor; /* OK to factor out constants */ u8 disableLookaside; /* Number of times lookaside has been disabled */ u8 nColCache; /* Number of entries in aColCache[] */ - int aTempReg[8]; /* Holding area for temporary registers */ int nRangeReg; /* Size of the temporary register block */ int iRangeReg; /* First register in temporary register block */ int nErr; /* Number of errors seen */ @@ -2920,8 +2919,6 @@ struct Parse { TableLock *aTableLock; /* Required table locks for shared-cache mode */ #endif AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ - - /* Information used while coding trigger programs. */ Parse *pToplevel; /* Parse structure for main program (or NULL) */ Table *pTriggerTab; /* Table triggers are being coded for */ int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */ @@ -2932,11 +2929,13 @@ struct Parse { u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ u8 disableTriggers; /* True to disable triggers */ - /* The column cache comes at the end of the recursive section - ** When initializing a new Parse object, the header above, and - ** the non-recursive part that follows the column cache both need - ** to be zeroed. But the column cache itself does not need zeroing - */ + /************************************************************************** + ** Fields above must be initialized to zero. The fields that follow, + ** down to the beginning of the recursive section, do not need to be + ** initialized as they will be set before being used. The boundary is + ** determined by offsetof(Parse,aColCache). + **************************************************************************/ + struct yColCache { int iTable; /* Table cursor number */ i16 iColumn; /* Table column number */ @@ -2945,6 +2944,9 @@ struct Parse { int iReg; /* Reg with value of this column. 0 means none. */ int lru; /* Least recently used entry has the smallest value */ } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ + int aTempReg[8]; /* Holding area for temporary registers */ + Token sNameToken; /* Token with unqualified schema object name */ + Token sLastToken; /* The last token parsed */ /************************************************************************ ** Above is constant between recursions. Below is reset before and after @@ -2972,8 +2974,6 @@ struct Parse { Table *pNewTable; /* A table being constructed by CREATE TABLE */ Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ - Token sNameToken; /* Token with unqualified schema object name */ - Token sLastToken; /* The last token parsed */ #ifndef SQLITE_OMIT_VIRTUALTABLE Token sArg; /* Complete text of a module argument */ Table **apVtabLock; /* Pointer to virtual tables needing locking */