1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

All essential opcodes can now operate out of registers and completely

avoid the stack.  Many still optionally use the stack to support legacy
code generation, but the stack is not required.  The next step is to
update all code generation to avoid using the stack. (CVS 4700)

FossilOrigin-Name: e3cf1c1c114bcda8fe577beb5ee55b4a651b96db
This commit is contained in:
drh
2008-01-09 23:04:12 +00:00
parent c920628f26
commit 98757157ee
15 changed files with 380 additions and 453 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sthe\sbuild\sfor\sAIX\sand\sother\ssystems\swhere\s"char"\sis\sunsigned\sby\sdefault.\s(CVS\s4699)
D 2008-01-09T18:31:45
C All\sessential\sopcodes\scan\snow\soperate\sout\sof\sregisters\sand\scompletely\navoid\sthe\sstack.\s\sMany\sstill\soptionally\suse\sthe\sstack\sto\ssupport\slegacy\ncode\sgeneration,\sbut\sthe\sstack\sis\snot\srequired.\s\sThe\snext\sstep\sis\sto\nupdate\sall\scode\sgeneration\sto\savoid\susing\sthe\sstack.\s(CVS\s4700)
D 2008-01-09T23:04:12
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -79,24 +79,24 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4
F sqlite3.pc.in abed4664817e1cd500f2276142c71958087c16bc
F src/alter.c 5a54f58d9481ac14c4e58b702f3f8758dee84d04
F src/analyze.c 6327934f5a4ec38b71f085482df4a05db0a99126
F src/attach.c 1c96631e56cdc51d3d70736bf61f1fe01c62cbea
F src/analyze.c 6cd38a981cac4491d71f99bfc10df32139b3a16a
F src/attach.c 61f0cae7b1a0e7c3b5f5286be5dc1a7c4d7112d2
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/btmutex.c 5d39da37c9d1282f3c6f9967afae6a34ee36b7ff
F src/btree.c 5164b32950cfd41f2c5c31e8ff82c4a499918aef
F src/btree.h 19dcf5ad23c17b98855da548e9a8e3eb4429d5eb
F src/btreeInt.h 1c5a9da165718ef7de81e35ce9ab5d9ba9283f76
F src/build.c 22b50a462d7b2be82e29071069d1c3daf29e953f
F src/build.c 785139de34c0141208f7f70865bcc603e29faf70
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
F src/date.c 49c5a6d2de6c12000905b4d36868b07d3011bbf6
F src/delete.c 971f5f774d121cfb790630a878a54c939b5b1494
F src/delete.c 4f760fb7e9b0bb3cf05534bb9d43ea9e726b7e74
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
F src/expr.c f1bee4f35fef3078fdbf9075f2b18e41202ccb09
F src/expr.c 27971029714d4b24081cf20b35e7c96d0e148311
F src/func.c 996071cf0af9d967e58b69fce1909555059ebc7d
F src/hash.c 45a7005aac044b6c86bd7e49c44bc15d30006d6c
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
F src/insert.c 4443b9026fe9be6c64a689879c564dcd8b7cbcb3
F src/insert.c 8630ee92dac91944c9f7b75847fa4ef74292b220
F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
@@ -127,16 +127,16 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 0cb6ccea4b9615627d61d7c4417cedc45776d429
F src/pager.h f504f7ae84060fee0416a853e368d3d113c3d6fa
F src/parse.y 2ae06e8d3190faace49c5b82e7cea1fc60d084a1
F src/pragma.c 355d53bc64b70d2dfcd9a1c4a9c5c2ea87da2857
F src/pragma.c bc6063d91d56a8b3cdad9e3478bba86700759cc4
F src/prepare.c c31a879d6795f4765fd0b113675c6debbc96b7fd
F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
F src/select.c 8570d4db93e115227393fd3cdf88be28d9ac585b
F src/select.c 7b88e17052dce3c89530cd6be014505b00d6ff4c
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 5391e889384d2062249f668110d64ed16f601c4b
F src/sqlite.h.in 2a7e3776534bbe6ff2cdc058f3abebe91e7e429f
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
F src/sqliteInt.h 884eb3db36efe571ce371309592ad44fefb91c9a
F src/sqliteInt.h c2866ab4a8eb42e4daffe30d19afc82952ed67c1
F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4
F src/tclsqlite.c 9923abeffc9b3d7dad58e92b319661521f60debf
@@ -164,20 +164,20 @@ F src/test_tclvar.c b2d1115e4d489179d3f029e765211b2ad527ba59
F src/test_thread.c e297dd41db0b249646e69f97d36ec13e56e8b730
F src/tokenize.c a4e04438c11fed2c67ec47fe3edbef9cca2d1b48
F src/trigger.c 1e77b3c21c129ad01f7f23a497ae1d224b4e5bc4
F src/update.c 93c7bca744988798c8898d024512954683e3e370
F src/update.c 18f2f3af050399da584fe94548d7e15aa45e884d
F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736
F src/util.c 05f31144bbd3f1a24f4139ae029c42545cb72624
F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
F src/vdbe.c cf1f4de3b96226da2b53fd01b843d5bb0d58f723
F src/vdbe.c b094a8834bc44e790aef0b0024daf45570b7d56e
F src/vdbe.h a9166e1601f5b74c20516a74182773a20baee43e
F src/vdbeInt.h 31bd686595356284d5484592e2dc6e58025aa346
F src/vdbeapi.c f14174843bf4be2c9afdf2ef48b61e7c3ac62d7c
F src/vdbeaux.c 2f716ebde79aa5bd83231c61269000413d8710f0
F src/vdbeaux.c 53cc9e2d3a870fe64f23c43b9417f28118e58d8f
F src/vdbeblob.c b90f7494c408d47ce6835000b01e40b371e27baf
F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6
F src/vdbemem.c a94f3e9e85578ba457133ad3446fc6114a03ec5a
F src/vtab.c 03014b2bfa8096ecac5fcdc80d34cd76e06af52a
F src/where.c 8c2bedcc61961a470c358b8c1466c7d8915bc722
F src/where.c 9705df3c2b78ea8e02a768be8ac5d3f7a2902f1e
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/all.test ee350b9ab15b175fc0a8fb51bf2141ed3a3b9cba
@@ -605,7 +605,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 92deff07bba2089bbe011f44defb3a0ac1362d56
R d2a91e2bbc73e1392892ecb0f6b599b2
P 47672af0c658573c6b305d224c6901058b8c0e00
R 6d8b60c5adc02caf36922454c955c896
U drh
Z ad96d49ec8605701787cc205558d1dd0
Z d27dfd6a1a930c2fffbab0aa79d70acf

View File

@@ -1 +1 @@
47672af0c658573c6b305d224c6901058b8c0e00
e3cf1c1c114bcda8fe577beb5ee55b4a651b96db

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: analyze.c,v 1.35 2008/01/08 23:54:25 drh Exp $
** @(#) $Id: analyze.c,v 1.36 2008/01/09 23:04:12 drh Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"
@@ -73,6 +73,9 @@ static void openStatTable(
sqlite3TableLock(pParse, iDb, iRootPage, 1, "sqlite_stat1");
}
sqlite3VdbeAddOp3(v, OP_OpenWrite, iStatCur, iRootPage, iDb);
if( iRootPage==0 ){
sqlite3VdbeChangeP5(v, 1);
}
sqlite3VdbeAddOp2(v, OP_SetNumColumns, iStatCur, 3);
}

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.66 2008/01/03 23:44:53 drh Exp $
** $Id: attach.c,v 1.67 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
@@ -332,7 +332,8 @@ static void codeAttach(
assert( v || db->mallocFailed );
if( v ){
sqlite3VdbeAddOp2(v, OP_Function, 0, nFunc);
sqlite3VdbeAddOp0(v, OP_Function);
sqlite3VdbeChangeP5(v, nFunc);
pFunc = sqlite3FindFunction(db, zFunc, strlen(zFunc), nFunc, SQLITE_UTF8,0);
sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF);

View File

@@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.461 2008/01/06 00:25:22 drh Exp $
** $Id: build.c,v 1.462 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1496,6 +1496,7 @@ void sqlite3EndTable(
sqlite3VdbeAddOp0(v, OP_Copy);
sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, 0, iDb);
sqlite3VdbeChangeP5(v, 1);
pParse->nTab = 2;
sqlite3SelectDestInit(&dest, SRT_Table, 1);
sqlite3Select(pParse, pSelect, &dest, 0, 0, 0, 0);
@@ -1834,7 +1835,7 @@ void sqlite3RootPageMoved(Db *pDb, int iFrom, int iTo){
*/
static void destroyRootPage(Parse *pParse, int iTable, int iDb){
Vdbe *v = sqlite3GetVdbe(pParse);
sqlite3VdbeAddOp2(v, OP_Destroy, iTable, iDb);
sqlite3VdbeAddOp3(v, OP_Destroy, iTable, 0, iDb);
#ifndef SQLITE_OMIT_AUTOVACUUM
/* OP_Destroy pushes an integer onto the stack. If this integer
** is non-zero, then it is the root page number of a table moved to
@@ -2246,6 +2247,9 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
pKey = sqlite3IndexKeyinfo(pParse, pIndex);
sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb,
(char *)pKey, P4_KEYINFO_HANDOFF);
if( memRootPage>=0 ){
sqlite3VdbeChangeP5(v, 1);
}
sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);
sqlite3GenerateIndexKey(v, pIndex, iTab);
@@ -2255,7 +2259,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
sqlite3VdbeChangeP2(v, curaddr-1, addr2);
sqlite3VdbeAddOp1(v, OP_Rowid, iTab);
sqlite3VdbeAddOp2(v, OP_AddImm, 0, 1);
sqlite3VdbeAddOp2(v, OP_IsUnique, iIdx, addr2);
sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx, addr2, 0, 0, P4_INT32);
sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, 0,
"indexed columns are not unique", P4_STATIC);
assert( db->mallocFailed || addr2==sqlite3VdbeCurrentAddr(v) );

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.154 2008/01/08 23:54:25 drh Exp $
** $Id: delete.c,v 1.155 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
@@ -369,7 +369,7 @@ void sqlite3DeleteFrom(
/* Populate the OLD.* pseudo-table */
if( old_col_mask ){
sqlite3VdbeAddOp3(v, OP_RowData, iCur, 0, iData);
sqlite3VdbeAddOp2(v, OP_RowData, iCur, iData);
}else{
sqlite3VdbeAddOp2(v, OP_Null, 0, iData);
}

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.339 2008/01/09 02:15:39 drh Exp $
** $Id: expr.c,v 1.340 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2210,8 +2210,9 @@ int sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){
if( !pColl ) pColl = pParse->db->pDfltColl;
sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
}
sqlite3VdbeAddOp4(v, OP_Function, constMask, nExpr, 0,
sqlite3VdbeAddOp4(v, OP_Function, constMask, 0, 0,
(char*)pDef, P4_FUNCDEF);
sqlite3VdbeChangeP5(v, nExpr);
break;
}
#ifndef SQLITE_OMIT_SUBQUERY

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.219 2008/01/09 02:15:39 drh Exp $
** $Id: insert.c,v 1.220 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
@@ -1184,7 +1184,7 @@ void sqlite3GenerateConstraintChecks(
/* Check to see if the new index entry will be unique */
sqlite3VdbeAddOp1(v, OP_SCopy, aRegIdx[iCur]);
sqlite3VdbeAddOp1(v, OP_SCopy, regRowid-hasTwoRowids);
j3 = sqlite3VdbeAddOp2(v, OP_IsUnique, baseCur+iCur+1, 0);
j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0, 0, 0, P4_INT32);
/* Generate code that executes if the new index entry is not unique */
assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
@@ -1617,7 +1617,7 @@ static int xferOptimization(
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, 0);
assert( pDest->autoInc==0 );
}
sqlite3VdbeAddOp2(v, OP_RowData, iSrc, 0);
sqlite3VdbeAddOp1(v, OP_RowData, iSrc);
sqlite3CodeInsert(pParse,iDest,OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND);
sqlite3VdbeChangeP4(v, -1, pDest->zName, 0);
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1);
@@ -1638,7 +1638,7 @@ static int xferOptimization(
(char*)pKey, P4_KEYINFO_HANDOFF);
VdbeComment((v, "%s", pDestIdx->zName));
addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0);
sqlite3VdbeAddOp2(v, OP_RowKey, iSrc, 0);
sqlite3VdbeAddOp1(v, OP_RowKey, iSrc);
sqlite3VdbeAddOp3(v, OP_IdxInsert, iDest, 0, 1);
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1);
sqlite3VdbeJumpHere(v, addr1);

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.163 2008/01/09 02:15:39 drh Exp $
** $Id: pragma.c,v 1.164 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -854,6 +854,7 @@ void sqlite3Pragma(
}
}
sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1);
pParse->nMem = 1;
/* Do an integrity check on each database file */
for(i=0; i<db->nDb; i++){
@@ -874,22 +875,25 @@ void sqlite3Pragma(
for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
Table *pTab = sqliteHashData(x);
Index *pIdx;
sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 0);
sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt);
cnt++;
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->tnum, 0);
sqlite3VdbeAddOp2(v, OP_Integer, pIdx->tnum, 2+cnt);
cnt++;
}
}
if( cnt==0 ) continue;
sqlite3VdbeAddOp2(v, OP_IntegrityCk, 1, i);
addr = sqlite3VdbeAddOp2(v, OP_StackIsNull, -1, 0);
sqlite3VdbeAddOp4(v, OP_String8, 0, 0, 0,
if( pParse->nMem < cnt+3 ){
pParse->nMem = cnt+3;
}
sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1);
sqlite3VdbeChangeP5(v, i);
addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2);
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName),
P4_DYNAMIC);
sqlite3VdbeAddOp2(v, OP_Pull, 1, 0);
sqlite3VdbeAddOp0(v, OP_Concat);
sqlite3VdbeAddOp2(v, OP_Callback, 1, 0);
sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 2);
sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);
sqlite3VdbeJumpHere(v, addr);
/* Make sure all the indices are constructed correctly.

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.394 2008/01/09 02:15:42 drh Exp $
** $Id: select.c,v 1.395 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
@@ -438,31 +438,8 @@ static void codeOffset(
}
/*
** Add code that will check to make sure the top N elements of the
** stack are distinct. iTab is a sorting index that holds previously
** seen combinations of the N values. A new entry is made in iTab
** if the current N values are new.
**
** A jump to addrRepeat is made and the N+1 values are popped from the
** stack if the top N elements are not distinct.
*/
static void codeDistinct_OLD(
Vdbe *v, /* Generate code into this VM */
int iTab, /* A sorting index used to test for distinctness */
int addrRepeat, /* Jump to here if not distinct */
int N /* The top N elements of the stack must be distinct */
){
sqlite3VdbeAddOp2(v, OP_MakeRecord, -N, 0);
sqlite3VdbeAddOp2(v, OP_Distinct, iTab, sqlite3VdbeCurrentAddr(v)+3);
sqlite3VdbeAddOp2(v, OP_Pop, N+1, 0);
sqlite3VdbeAddOp2(v, OP_Goto, 0, addrRepeat);
VdbeComment((v, "skip indistinct records"));
sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, 0);
}
/*
** Add code that will check to make sure the top N elements of the
** stack are distinct. iTab is a sorting index that holds previously
** Add code that will check to make sure the N registers starting at iMem
** form a distinct entry. iTab is a sorting index that holds previously
** seen combinations of the N values. A new entry is made in iTab
** if the current N values are new.
**
@@ -2135,7 +2112,7 @@ static int multiSelect(
iCont = sqlite3VdbeMakeLabel(v);
computeLimitRegisters(pParse, p, iBreak);
sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak);
iStart = sqlite3VdbeAddOp2(v, OP_RowKey, tab1, 0);
iStart = sqlite3VdbeAddOp1(v, OP_RowKey, tab1);
sqlite3VdbeAddOp2(v, OP_NotFound, tab2, iCont);
rc = selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr,
pOrderBy, -1, &dest, iCont, iBreak, 0);
@@ -3021,17 +2998,20 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
int nArg;
int addrNext = 0;
int regAgg;
ExprList *pList = pF->pExpr->pList;
if( pList ){
nArg = pList->nExpr;
sqlite3ExprCodeExprList(pParse, pList, 0);
regAgg = sqlite3StackToReg(pParse, nArg);
}else{
nArg = 0;
regAgg = 0;
}
if( pF->iDistinct>=0 ){
addrNext = sqlite3VdbeMakeLabel(v);
assert( nArg==1 );
codeDistinct_OLD(v, pF->iDistinct, addrNext, 1);
codeDistinct(v, pF->iDistinct, addrNext, 1, regAgg);
}
if( pF->pFunc->needCollSeq ){
CollSeq *pColl = 0;
@@ -3046,8 +3026,9 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
}
sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
}
sqlite3VdbeAddOp4(v, OP_AggStep, pF->iMem, nArg, 0,
sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,
(void*)pF->pFunc, P4_FUNCDEF);
sqlite3VdbeChangeP5(v, nArg);
if( addrNext ){
sqlite3VdbeResolveLabel(v, addrNext);
}

View File

@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.644 2008/01/08 23:54:25 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.645 2008/01/09 23:04:12 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -481,7 +481,7 @@ struct sqlite3 {
u8 autoCommit; /* The auto-commit flag. */
u8 temp_store; /* 1: file 2: memory 0: default */
u8 mallocFailed; /* True if we have seen a malloc failure */
char nextAutovac; /* Autovac setting after VACUUM if >=0 */
signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
int nTable; /* Number of tables in the database */
CollSeq *pDfltColl; /* The default collating sequence (BINARY) */
i64 lastRowid; /* ROWID of most recent insert (see above) */

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.165 2008/01/09 02:15:42 drh Exp $
** $Id: update.c,v 1.166 2008/01/09 23:04:12 drh Exp $
*/
#include "sqliteInt.h"
@@ -414,7 +414,7 @@ void sqlite3Update(
if( !old_col_mask ){
sqlite3VdbeAddOp2(v, OP_Null, 0, 0);
}else{
sqlite3VdbeAddOp2(v, OP_RowData, iCur, 0);
sqlite3VdbeAddOp1(v, OP_RowData, iCur);
}
sqlite3CodeInsert(pParse, oldIdx, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -270,7 +270,9 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs, int *pMaxStack){
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
u8 opcode = pOp->opcode;
if( opcode==OP_Function || opcode==OP_AggStep
if( opcode==OP_Function ){
if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
}else if( opcode==OP_AggStep
#ifndef SQLITE_OMIT_VIRTUALTABLE
|| opcode==OP_VUpdate
#endif
@@ -532,7 +534,10 @@ void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
pOp = &p->aOp[addr];
freeP4(pOp->p4type, pOp->p4.p);
pOp->p4.p = 0;
if( zP4==0 ){
if( n==P4_INT32 ){
pOp->p4.i = (int)zP4;
pOp->p4type = n;
}else if( zP4==0 ){
pOp->p4.p = 0;
pOp->p4type = P4_NOTUSED;
}else if( n==P4_KEYINFO ){

View File

@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.279 2008/01/09 02:15:42 drh Exp $
** $Id: where.c,v 1.280 2008/01/09 23:04:13 drh Exp $
*/
#include "sqliteInt.h"
@@ -2549,7 +2549,7 @@ WhereInfo *sqlite3WhereBegin(
sqlite3VdbeAddOp2(v, OP_SCopy, pLevel->iMem, 0);
sqlite3VdbeAddOp2(v, testOp, iIdxCur, nxt);
if( (topEq && !bRev) || (!btmEq && bRev) ){
sqlite3VdbeChangeP4(v, -1, "+", P4_STATIC);
sqlite3VdbeChangeP5(v, 1);
}
}
if( topLimit | btmLimit ){
@@ -2618,7 +2618,8 @@ WhereInfo *sqlite3WhereBegin(
/* Scan in the forward order */
sqlite3VdbeAddOp2(v, (isMinQuery?OP_MoveGt:OP_MoveGe), iIdxCur, nxt);
start = sqlite3VdbeAddOp2(v, OP_SCopy, pLevel->iMem, 0);
sqlite3VdbeAddOp4(v, OP_IdxGE, iIdxCur, nxt, 0, "+", P4_STATIC);
sqlite3VdbeAddOp2(v, OP_IdxGE, iIdxCur, nxt);
sqlite3VdbeChangeP5(v, 1);
pLevel->op = OP_Next;
}
if( !omitTable ){