-C Optimizations\sto\sthe\stokenizer.\s(CVS\s815)
-D 2003-01-07T01:44:38
+C More\soptimizations.\s(CVS\s816)
+D 2003-01-07T02:47:48
F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/os.h 09fd96b4d733aae2f3b98b2ae9ceea40b8fd780d
F src/pager.c e7d05fa23a61f109c2276bb05be7a8d6721980f1
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
-F src/parse.y 469c9636ff713e63c00234662209f11668671ae9
+F src/parse.y 427a17888c117cc9cc35311eda0603d55437f02b
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c cc8640e5d4e3ec1a8de58fde6b2fdd6f846b7263
F src/test2.c 03f05e984c8e2f2badc44644d42baf72b249096b
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
-F src/tokenize.c 8eaa8f878aa8c6375b567504736a5047f367ce9b
+F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
F src/update.c 881e4c8e7c786545da4fd2d95da19252b2e31137
F src/util.c e2d108842e02810d3d3242cac0e024b09cdb3c4a
-F src/vdbe.c 1d396c7029487630b16b8a310a8c5440d05945dd
+F src/vdbe.c a92cbde50ab9ddd6eeee086531252211ce00e3f9
F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
F src/where.c af235636b7bc7f7f42ee1c7162d1958ad0102cab
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P b96ec281ff29aad8af340b30c6ff4e129ffeeefb
-R eca56f05aef2b5cf05bae2fe3b0da7b4
+P 032b3daa1d3cf3e00a4a6ba0b09624f1aba6445c
+R 049c740e00e3ae1c8ab222520497ef43
U drh
-Z f083eac995258132bf28df3cbcdc9fef
+Z e3868eb77f429973c82f0ac95cfb0d3a
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.191 2003/01/06 23:54:06 drh Exp $
+** $Id: vdbe.c,v 1.192 2003/01/07 02:47:48 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
}
#endif
+/*
+** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
+** sqlite_interrupt() routine has been called. If it has been, then
+** processing of the VDBE program is interrupted.
+**
+** This macro added to every instruction that does a jump in order to
+** implement a loop. This test used to be on every single instruction,
+** but that meant we more testing that we needed. By only testing the
+** flag on jump instructions, we get a (small) speed improvement.
+*/
+#define CHECK_FOR_INTERRUPT \
+ if( db->flags & SQLITE_Interrupt ) goto abort_due_to_interrupt;
+
+
/*
** Execute the program in the VDBE.
**
**
** Allocation all the stack space we will ever need.
*/
+ sqliteVdbeAddOp(p, OP_Halt, 0, 0);
zStack = p->zStack = sqliteMalloc( p->nOp*sizeof(zStack[0]) );
aStack = p->aStack = sqliteMalloc( p->nOp*sizeof(aStack[0]) );
p->tos = -1;
}
#endif
if( sqlite_malloc_failed ) goto no_mem;
- for(pc=0; !sqlite_malloc_failed && rc==SQLITE_OK && pc<p->nOp
- VERIFY(&& pc>=0); pc++){
+ for(pc=0; rc==SQLITE_OK; pc++){
+ assert( pc>=0 && pc<p->nOp );
#ifdef VDBE_PROFILE
origPc = pc;
start = hwtime();
#endif
pOp = &p->aOp[pc];
- /* Interrupt processing if requested.
- */
- if( db->flags & SQLITE_Interrupt ){
- db->flags &= ~SQLITE_Interrupt;
- if( db->magic!=SQLITE_MAGIC_BUSY ){
- rc = SQLITE_MISUSE;
- }else{
- rc = SQLITE_INTERRUPT;
- }
- sqliteSetString(pzErrMsg, sqlite_error_string(rc), 0);
- break;
- }
-
/* Only allow tracing if NDEBUG is not defined.
*/
#ifndef NDEBUG
** the program.
*/
case OP_Goto: {
+ CHECK_FOR_INTERRUPT;
pc = pOp->p2 - 1;
break;
}
}
goto abort_due_to_error;
}else{
- pc = p->nOp-1;
+ goto cleanup;
}
- break;
}
/* Opcode: Integer P1 * P3
}
if( amt>NBFS ){
z = sqliteMallocRaw( amt );
+ if( z==0 ) goto no_mem;
aStack[tos].flags = STK_Str | STK_Dyn;
}else{
z = aStack[tos].z;
Cursor *pC;
BtCursor *pCrsr;
+ CHECK_FOR_INTERRUPT;
if( VERIFY( pOp->p1>=0 && pOp->p1<p->nCursor && )
(pCrsr = (pC = &p->aCsr[pOp->p1])->pCursor)!=0 ){
int res;
VERIFY( if( iSet<0 || iSet>=p->nSet ) goto bad_instruction; )
pSet = &p->aSet[iSet];
nRoot = sqliteHashCount(&pSet->hash);
- aRoot = sqliteMalloc( sizeof(int)*(nRoot+1) );
+ aRoot = sqliteMallocRaw( sizeof(int)*(nRoot+1) );
+ if( aRoot==0 ) goto no_mem;
for(j=0, i=sqliteHashFirst(&pSet->hash); i; i=sqliteHashNext(i), j++){
toInt((char*)sqliteHashKey(i), &aRoot[j]);
}
*/
case OP_ListRead: {
Keylist *pKeylist;
+ CHECK_FOR_INTERRUPT;
pKeylist = p->pList;
if( pKeylist!=0 ){
VERIFY(
assert(p->keylistStackDepth > 0);
p->keylistStack = sqliteRealloc(p->keylistStack,
sizeof(Keylist *) * p->keylistStackDepth);
+ if( p->keylistStack==0 ) goto no_mem;
p->keylistStack[p->keylistStackDepth - 1] = p->pList;
p->pList = 0;
break;
*/
case OP_SortNext: {
Sorter *pSorter = p->pSort;
+ CHECK_FOR_INTERRUPT;
if( pSorter!=0 ){
p->pSort = pSorter->pNext;
p->tos++;
case OP_FileRead: {
int n, eol, nField, i, c, nDelim;
char *zDelim, *z;
+ CHECK_FOR_INTERRUPT;
if( p->pFile==0 ) goto fileread_jump;
nField = pOp->p1;
if( nField<=0 ) goto fileread_jump;
AggReset(&p->agg);
p->agg.nMem = pOp->p2;
p->agg.apFunc = sqliteMalloc( p->agg.nMem*sizeof(p->agg.apFunc[0]) );
+ if( p->agg.apFunc==0 ) goto no_mem;
break;
}
** in between an AggNext and an AggReset.
*/
case OP_AggNext: {
+ CHECK_FOR_INTERRUPT;
if( p->agg.pSearch==0 ){
p->agg.pSearch = sqliteHashFirst(&p->agg.hash);
}else{
case OP_SetNext: {
Set *pSet;
int tos;
+ CHECK_FOR_INTERRUPT;
if( pOp->p1<0 || pOp->p1>=p->nSet ){
if( pOp->opcode==OP_SetFirst ) pc = pOp->p2 - 1;
break;
sqliteSetString(pzErrMsg, sqlite_error_string(rc), 0);
goto cleanup;
+ /* Jump to here if the sqlite_interrupt() API sets the interrupt
+ ** flag.
+ */
+abort_due_to_interrupt:
+ assert( db->flags & SQLITE_Interrupt );
+ db->flags &= ~SQLITE_Interrupt;
+ if( db->magic!=SQLITE_MAGIC_BUSY ){
+ rc = SQLITE_MISUSE;
+ }else{
+ rc = SQLITE_INTERRUPT;
+ }
+ sqliteSetString(pzErrMsg, sqlite_error_string(rc), 0);
+ goto cleanup;
+
/* Jump to here if a operator is encountered that requires more stack
** operands than are currently available on the stack.
*/
sprintf(zBuf,"%d",pc);
sqliteSetString(pzErrMsg, "too few operands on stack at ", zBuf, 0);
rc = SQLITE_INTERNAL;
- goto cleanup;
/* Jump here if an illegal or illformed instruction is executed.
*/