Remove more column-cache residue: The OP_SetColTab and OP_VerifyColTab

opcodes and the associated SQLITE_DEBUG_COLUMNCACHE logic.

FossilOrigin-Name: 80236e81cefdf3d3cda3dbdb6de1575c38e4e248cc4b72ca9ee96d3aa0464bfd
This commit is contained in:
drh 2018-08-04 16:54:53 +00:00
parent 8c60719132
commit c6ed275fcb
8 changed files with 12 additions and 83 deletions

View File

@ -1,5 +1,5 @@
C Further\slogic\ssimplifications\sthat\sflow\sout\sof\sthe\somission\sof\sthe\scolumn\scache. C Remove\smore\scolumn-cache\sresidue:\s\sThe\sOP_SetColTab\sand\sOP_VerifyColTab\nopcodes\sand\sthe\sassociated\sSQLITE_DEBUG_COLUMNCACHE\slogic.
D 2018-08-04T15:53:55.103 D 2018-08-04T16:54:53.280
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6 F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
@ -503,7 +503,7 @@ F src/shell.c.in 5e4c139799f059a5231f0259111f51f6dffcb28154c535f6b4c2192619a4084
F src/sqlite.h.in c6451bb876adced3aba5b1682c6317d215c5eceaba21a6ce979e71a0b8d0bf95 F src/sqlite.h.in c6451bb876adced3aba5b1682c6317d215c5eceaba21a6ce979e71a0b8d0bf95
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7 F src/sqlite3ext.h 9887b27e69c01e79c2cbe74ef73bf01af5b5703d6a7f0a4371e386d7249cb1c7
F src/sqliteInt.h aafcf34d4c70b6654b87a34be3d267c87178ac3aae3d875319ffd5d529cd4b5d F src/sqliteInt.h 353f6ec5d09927a6188c2c427f789ff5c50a495f809c6f5855aac4f3bd90debe
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@ -569,13 +569,13 @@ F src/upsert.c 47edd408cc73f8d3c00a140550d1ad180b407c146285947969dd09874802bf88
F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157 F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157
F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855 F src/vacuum.c 36e7d21a20c0bf6ef4ef7c399d192b5239410b7c4d3c1070fba4e30810d0b855
F src/vdbe.c 8fbefa50884f4803139bdc2d4795b973a1a892f023726fa72246fea2fe8e9925 F src/vdbe.c 7ab5a3cbc893c9896bd9bb85aa634e8b1cd1f94af4df5cd6c4ce2468058008c6
F src/vdbe.h d93abdc8bc9295e0a256e582c19f548c545dc498319d108bbc9dd29de31c48a2 F src/vdbe.h d93abdc8bc9295e0a256e582c19f548c545dc498319d108bbc9dd29de31c48a2
F src/vdbeInt.h 2a45270d7f44870ca5452f48cdf3c56387019ae03331c008d670a7d0a3e1ba3f F src/vdbeInt.h 8ea493d994c6697cf7bccc60583a80a0222560490410f60f1113e90d36643ce0
F src/vdbeapi.c af4a3de00d1851bcbc55b85dfbe52849aa2b1e17b4a5a1f3d9c257df7af361ff F src/vdbeapi.c 2ba821c5929a2769e4b217dd85843479c718b8989d414723ec8af0616a83d611
F src/vdbeaux.c 3872c2956c0a0ca54e3c084194dc0f4d9c6f2701cab6fdf88485109f53fb4b0d F src/vdbeaux.c b610cef3d8d381c9287d02c2e61590acc0a1b4de1cc0188d560f5ef345527a24
F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191
F src/vdbemem.c a699a1d7ccc3f94cdff69ddf35d5f7540dbf52ca44cf040eda3c87520e67858c F src/vdbemem.c 720df42ad8e5c7cb883573de40a185afef4a214903098a16f2bb14b62b2399b7
F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f
F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392
F src/vtab.c 678992ac8ec677a3f9b08126aaf891441083805e3b42574e3654d44538381c14 F src/vtab.c 678992ac8ec677a3f9b08126aaf891441083805e3b42574e3654d44538381c14
@ -1754,7 +1754,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P db6052e9725368736abd19f14f97376582d35d07f543046d39991d767ed29851 P 7d9072b027cc28dd8ecf5e2686d821017997445c15124eebe2839984622af4db
R fd23b7205db96325ad5bdc4a85a4841d R 820f26f9a4f9afda56ce762b9f0675a6
U drh U drh
Z 93377b53226b40bb6708d8eb4dc72ffd Z d3574326d1871130835115db0c78586b

View File

@ -1 +1 @@
7d9072b027cc28dd8ecf5e2686d821017997445c15124eebe2839984622af4db 80236e81cefdf3d3cda3dbdb6de1575c38e4e248cc4b72ca9ee96d3aa0464bfd

View File

@ -367,17 +367,6 @@
# undef NDEBUG # undef NDEBUG
#endif #endif
/* SQLITE_DEBUG_COLUMNCACHE is synomous with SQLITE_DEBUG. The
** SQLITE_DEBUG_COLUMNCACHE symbol only exists to provide a convenient
** way to search for all code that deals with verifying correct behavior
** of the column cache.
*/
#ifdef SQLITE_DEBUG
# define SQLITE_DEBUG_COLUMNCACHE 1
#else
# undef SQLIT_DEBUG_COLUMNCACHE
#endif
/* /*
** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. ** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
*/ */

View File

@ -36,18 +36,6 @@
# define memAboutToChange(P,M) # define memAboutToChange(P,M)
#endif #endif
/*
** Given a cursor number and a column for a table or index, compute a
** hash value for use in the Mem.iTabColHash value. The iTabColHash
** column is only used for verification - it is omitted from production
** builds. Collisions are harmless in the sense that the correct answer
** still results. The only harm of collisions is that they can potential
** reduce column-cache error detection during SQLITE_DEBUG builds.
**
** No valid hash should be 0.
*/
#define TableColumnHash(T,C) (((u32)(T)<<16)^(u32)(C+2))
/* /*
** The following global variable is incremented every time a cursor ** The following global variable is incremented every time a cursor
** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
@ -1308,7 +1296,6 @@ case OP_Copy: {
Deephemeralize(pOut); Deephemeralize(pOut);
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
pOut->pScopyFrom = 0; pOut->pScopyFrom = 0;
pOut->iTabColHash = 0;
#endif #endif
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut); REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
if( (n--)==0 ) break; if( (n--)==0 ) break;
@ -7446,34 +7433,6 @@ case OP_Abortable: {
} }
#endif #endif
#ifdef SQLITE_DEBUG_COLUMNCACHE
/* Opcode: SetTabCol P1 P2 P3 * *
**
** Set a flag in register REG[P3] indicating that it holds the value
** of column P2 from the table on cursor P1. This flag is checked
** by a subsequent VerifyTabCol opcode.
**
** This opcode only appears SQLITE_DEBUG builds. It is used to verify
** that the expression table column cache is working correctly.
*/
case OP_SetTabCol: {
aMem[pOp->p3].iTabColHash = TableColumnHash(pOp->p1,pOp->p2);
break;
}
/* Opcode: VerifyTabCol P1 P2 P3 * *
**
** Verify that register REG[P3] contains the value of column P2 from
** cursor P1. Assert() if this is not the case.
**
** This opcode only appears SQLITE_DEBUG builds. It is used to verify
** that the expression table column cache is working correctly.
*/
case OP_VerifyTabCol: {
assert( aMem[pOp->p3].iTabColHash == TableColumnHash(pOp->p1,pOp->p2) );
break;
}
#endif
/* Opcode: Noop * * * * * /* Opcode: Noop * * * * *
** **
** Do nothing. This instruction is often useful as a jump ** Do nothing. This instruction is often useful as a jump

View File

@ -211,10 +211,6 @@ struct sqlite3_value {
Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
u16 mScopyFlags; /* flags value immediately after the shallow copy */ u16 mScopyFlags; /* flags value immediately after the shallow copy */
#endif #endif
#ifdef SQLITE_DEBUG_COLUMNCACHE
u32 iTabColHash; /* Hash of table.column that is origin of this value */
u32 iPadding; /* sqlite3_value objects must be 8-byte aligned */
#endif
}; };
/* /*

View File

@ -971,9 +971,6 @@ static const Mem *columnNullValue(void){
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
/* .pScopyFrom = */ (Mem*)0, /* .pScopyFrom = */ (Mem*)0,
/* .mScopyFlags= */ 0, /* .mScopyFlags= */ 0,
#endif
#ifdef SQLITE_DEBUG_COLUMNCACHE
/* .iTabColHash= */ 0,
#endif #endif
}; };
return &nullMem; return &nullMem;

View File

@ -1638,9 +1638,6 @@ static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
p->szMalloc = 0; p->szMalloc = 0;
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
p->pScopyFrom = 0; p->pScopyFrom = 0;
#endif
#ifdef SQLITE_DEBUG_COLUMNCACHE
p->iTabColHash = 0;
#endif #endif
p++; p++;
} }

View File

@ -934,9 +934,6 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
} }
} }
pMem->pScopyFrom = 0; pMem->pScopyFrom = 0;
#ifdef SQLITE_DEBUG_COLUMN_CACHE
pMem->iTabColHash = 0;
#endif
} }
#endif /* SQLITE_DEBUG */ #endif /* SQLITE_DEBUG */
@ -957,9 +954,6 @@ void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
assert( pTo->db==pFrom->db ); assert( pTo->db==pFrom->db );
if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; } if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
memcpy(pTo, pFrom, MEMCELLSIZE); memcpy(pTo, pFrom, MEMCELLSIZE);
#ifdef SQLITE_DEBUG_COLUMNCACHE
pTo->iTabColHash = pFrom->iTabColHash;
#endif
if( (pFrom->flags&MEM_Static)==0 ){ if( (pFrom->flags&MEM_Static)==0 ){
pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem); pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
assert( srcType==MEM_Ephem || srcType==MEM_Static ); assert( srcType==MEM_Ephem || srcType==MEM_Static );
@ -977,9 +971,6 @@ int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
assert( (pFrom->flags & MEM_RowSet)==0 ); assert( (pFrom->flags & MEM_RowSet)==0 );
if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo); if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
memcpy(pTo, pFrom, MEMCELLSIZE); memcpy(pTo, pFrom, MEMCELLSIZE);
#ifdef SQLITE_DEBUG_COLUMNCACHE
pTo->iTabColHash = pFrom->iTabColHash;
#endif
pTo->flags &= ~MEM_Dyn; pTo->flags &= ~MEM_Dyn;
if( pTo->flags&(MEM_Str|MEM_Blob) ){ if( pTo->flags&(MEM_Str|MEM_Blob) ){
if( 0==(pFrom->flags&MEM_Static) ){ if( 0==(pFrom->flags&MEM_Static) ){