-C Fix\san\salways-true\sconditional\sleft\sover\sfrom\sthe\sprevious\scommit.
-D 2016-09-30T21:20:37.770
+C Avoid\sinitializing\sthe\scolumn-cache\ssection\sof\sthe\sParse\sobject,\ssince\sentries\nin\sthe\scache\swill\sbe\sinitialized\sas\sthey\sare\sused,\sand\savoiding\sthe\sinitial\nmemset()\ssaves\smany\sCPU\scycles.
+D 2016-09-30T22:24:29.959
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
F src/btree.c 56e1732ecfb3731efcb216266ec26b1b96e5e8c9
F src/btree.h d05b2fcc290991a8a3d9ea1816ddd55a4359dcde
F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
-F src/build.c 4d01b74ea76f4295f83910feb8fdb9635952904a
+F src/build.c 59dcfdc1ee55439d069af301ef7f2e84421b5102
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7
F src/pcache1.c 4bb7a6a5300c67d0b033d25adb509c120c03e812
F src/pragma.c d932ba278654617cdd281f88a790a3185fca7c44
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
-F src/prepare.c 0fcf16eaacc90c1059055519a76b75b516a59a88
+F src/prepare.c 3c8b1bc8799a794aa2e825db1a977e93487b01d4
F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c 3c3cf0dc719cd2a32ab5c1e10c26481dd565492e
F src/sqlite.h.in 2683a291ed8db5228024267be6421f0de507b80e
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
-F src/sqliteInt.h dea74ebe041661eb9a4924140c80b1731a4b5262
+F src/sqliteInt.h 16f22a872a901d4a455a4a65bbbc1658cc2159f4
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 6028502059ccbd3699637b7a70a6d8ce1b7c3dad
-R a6256cdf36804c151ce32af7b8e56062
+P ab12fce3318db447995e1465f34a1e43cd623d6a
+R 0a3a2f22297400a0c501bf7a0c2b0caa
U drh
-Z 3fef1d146c2cf0fe38cc3824ec800a2a
+Z fb861c120dabfe63359c1b99efc6b84b
-ab12fce3318db447995e1465f34a1e43cd623d6a
\ No newline at end of file
+63cf7eafae5c3c1379edf416c5157010c7c120b5
\ No newline at end of file
char *zSql;
char *zErrMsg = 0;
sqlite3 *db = pParse->db;
-# define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar))
- char saveBuf[SAVE_SZ];
+ char saveBuf[PARSE_TAIL_SZ];
if( pParse->nErr ) return;
assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
return; /* A malloc must have failed */
}
pParse->nested++;
- memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
- memset(&pParse->nVar, 0, SAVE_SZ);
+ memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
+ memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
sqlite3RunParser(pParse, zSql, &zErrMsg);
sqlite3DbFree(db, zErrMsg);
sqlite3DbFree(db, zSql);
- memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
+ memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
pParse->nested--;
}
int i; /* Loop counter */
/* Allocate the parsing context */
- pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
+ pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));
if( pParse==0 ){
rc = SQLITE_NOMEM_BKPT;
goto end_prepare;
}
+ memset(pParse, 0, PARSE_HDR_SZ);
+ memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
pParse->pReprepare = pReprepare;
assert( ppStmt && *ppStmt==0 );
/* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
int iCacheCnt; /* Counter used to generate aColCache[].lru values */
int nLabel; /* Number of labels used */
int *aLabel; /* Space to hold the labels */
- struct yColCache {
- int iTable; /* Table cursor number */
- i16 iColumn; /* Table column number */
- u8 tempReg; /* iReg is a temp register that needs to be freed */
- int iLevel; /* Nesting level */
- 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 */
ExprList *pConstExpr;/* Constant expressions */
Token constraintName;/* Name of the constraint currently being parsed */
yDbMask writeMask; /* Start a write transaction on these databases */
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
+ */
+ struct yColCache {
+ int iTable; /* Table cursor number */
+ i16 iColumn; /* Table column number */
+ u8 tempReg; /* iReg is a temp register that needs to be freed */
+ int iLevel; /* Nesting level */
+ 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 */
+
/************************************************************************
** Above is constant between recursions. Below is reset before and after
** each recursion. The boundary between these two regions is determined
With *pWithToFree; /* Free this WITH object at the end of the parse */
};
+/*
+** Sizes and pointers of various parts of the Parse object.
+*/
+#define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
+#define PARSE_RECURSE_SZ offsetof(Parse,nVar) /* Recursive part */
+#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
+#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
+
/*
** Return true if currently inside an sqlite3_declare_vtab() call.
*/