From 7f0f12e3abbaccb76f26a709acbc19bdb6772c44 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 21 May 2004 13:39:50 +0000 Subject: [PATCH] Remove the OP_SetFound opcode and its cousins. (CVS 1430) FossilOrigin-Name: 5524075ec02102446f8d153e068546f763d4bf7a --- manifest | 18 +++++----- manifest.uuid | 2 +- src/build.c | 12 +++---- src/expr.c | 18 +--------- src/vdbe.c | 97 +++++---------------------------------------------- 5 files changed, 26 insertions(+), 121 deletions(-) diff --git a/manifest b/manifest index d54a680515..edff9f9822 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Eliminate\ssome\sunused\scode\s(CVS\s1429) -D 2004-05-21T11:39:05 +C Remove\sthe\sOP_SetFound\sopcode\sand\sits\scousins.\s(CVS\s1430) +D 2004-05-21T13:39:50 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -27,12 +27,12 @@ F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79 F src/btree.c 68f8e0f6271afd31551abf0b48de9667c5f7368b F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545 F src/btree_rb.c 9d7973e266ee6f9c61ce592f68742ce9cd5b10e5 -F src/build.c 1d71deac55e44e9b2443a2f8f55ca03773555613 +F src/build.c 95969f37eb4edf62660d83e314df6d08b8a19fe7 F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29 F src/date.c 0eb0a89960bb45c7f7e768748605a7a97b0c8064 F src/delete.c 2e1dda38345416a1ea1c0a6468589a7472334dac F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 -F src/expr.c fb92ef7e7111de4a4dc58bc6c6d58b84793c725a +F src/expr.c 5b283e68bd6df365b7c2ad10bd04cc54c2b4b07c F src/func.c cfbb7096efb58e2857e3b312a8958a12774b625a F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb @@ -64,7 +64,7 @@ F src/update.c 1a5e9182596f3ea8c7a141e308a3d2a7e5689fee F src/utf.c c27c4f1120f7aaef00cd6942b3d9e3f4ca4fe0e4 F src/util.c 5cbeb452da09cfc7248de9948c15b14d840723f7 F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 -F src/vdbe.c f0e24400884c3e3a5021f60ca2310e7373709e3e +F src/vdbe.c 2944326a99869c71698f634d6ace9e9be56d9180 F src/vdbe.h 391d5642a83af686f35c228fcd36cb4456d68f44 F src/vdbeInt.h 8ed2272e97bef20c5302c3b2cb4f900e8b5e2642 F src/vdbeaux.c 0a0de6f6097125960b02a3c8625fa896cbc61271 @@ -195,7 +195,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 5eb94c97657b34ed2df6455e23875e2840743bda -R df698f64280827d490a25f92b9ffde93 -U danielk1977 -Z b43705fe091d47ae368c00cb70601ef1 +P 550a53b3f28ddb288bcb6c21849ca83b0a20bde4 +R a27328b840ad5ac31f67deb6b635b74b +U drh +Z 678137ddf4cdf9bac7e4b018c69ba9fb diff --git a/manifest.uuid b/manifest.uuid index 1dcd7eba71..f494503861 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -550a53b3f28ddb288bcb6c21849ca83b0a20bde4 \ No newline at end of file +5524075ec02102446f8d153e068546f763d4bf7a \ No newline at end of file diff --git a/src/build.c b/src/build.c index 284c437185..fc0b70a536 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.191 2004/05/21 01:29:06 drh Exp $ +** $Id: build.c,v 1.192 2004/05/21 13:39:50 drh Exp $ */ #include "sqliteInt.h" #include @@ -2149,7 +2149,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ ** ** This routine starts a new transaction if we are not already within ** a transaction. If we are already within a transaction, then a checkpoint -** is set if the setCheckpoint parameter is true. A checkpoint should +** is set if the setStatement parameter is true. A checkpoint should ** be set for operations that might fail (due to a constraint) part of ** the way through and which will need to undo some writes without having to ** rollback the whole transaction. For operations where all constraints @@ -2161,7 +2161,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ ** iDb==1 then only the temp database is made writable. If iDb>1 then the ** specified auxiliary database and the temp database are made writable. */ -void sqlite3BeginWriteOperation(Parse *pParse, int setCheckpoint, int iDb){ +void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ Vdbe *v; sqlite *db = pParse->db; if( DbHasProperty(db, iDb, DB_Locked) ) return; @@ -2172,10 +2172,10 @@ void sqlite3BeginWriteOperation(Parse *pParse, int setCheckpoint, int iDb){ DbSetProperty(db, iDb, DB_Locked); sqlite3CodeVerifySchema(pParse, iDb); if( iDb!=1 ){ - sqlite3BeginWriteOperation(pParse, setCheckpoint, 1); + sqlite3BeginWriteOperation(pParse, setStatement, 1); } - }else if( setCheckpoint ){ - sqlite3VdbeAddOp(v, OP_Checkpoint, iDb, 0); + }else if( setStatement ){ + sqlite3VdbeAddOp(v, OP_Statement, iDb, 0); DbSetProperty(db, iDb, DB_Locked); } } diff --git a/src/expr.c b/src/expr.c index 5218b1fbc1..c774f73a5b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -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.126 2004/05/21 02:14:25 drh Exp $ +** $Id: expr.c,v 1.127 2004/05/21 13:39:51 drh Exp $ */ #include "sqliteInt.h" #include @@ -1431,22 +1431,6 @@ void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ sqlite3VdbeAddOp(v, op, 1, dest); break; } -#if 0 - case TK_IN: { - int addr; - sqlite3ExprCode(pParse, pExpr->pLeft); - addr = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp(v, OP_NotNull, -1, addr+3); - sqlite3VdbeAddOp(v, OP_Pop, 1, 0); - sqlite3VdbeAddOp(v, OP_Goto, 0, jumpIfNull ? dest : addr+4); - if( pExpr->pSelect ){ - sqlite3VdbeAddOp(v, OP_Found, pExpr->iTable, dest); - }else{ - sqlite3VdbeAddOp(v, OP_SetFound, pExpr->iTable, dest); - } - break; - } -#endif case TK_BETWEEN: { int addr; sqlite3ExprCode(pParse, pExpr->pLeft); diff --git a/src/vdbe.c b/src/vdbe.c index 51f954b70b..b869610ec7 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** 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.314 2004/05/21 10:49:48 danielk1977 Exp $ +** $Id: vdbe.c,v 1.315 2004/05/21 13:39:51 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -2672,18 +2672,19 @@ case OP_MakeIdxKey: { break; } -/* Opcode: Checkpoint P1 * * +/* Opcode: Statement P1 * * ** -** Begin a checkpoint. A checkpoint is the beginning of a operation that -** is part of a larger transaction but which might need to be rolled back -** itself without effecting the containing transaction. A checkpoint will -** be automatically committed or rollback when the VDBE halts. +** Begin an individual statement transaction which is part of a larger +** BEGIN..COMMIT transaction. This is needed so that the statement +** can be rolled back after an error without having to roll back the +** entire transaction. The statement transaction will automatically +** commit when the VDBE halts. ** -** The checkpoint is begun on the database file with index P1. The main +** The statement is begun on the database file with index P1. The main ** database file has an index of 0 and the file used for temporary tables ** has an index of 1. */ -case OP_Checkpoint: { +case OP_Statement: { int i = pOp->p1; if( i>=0 && inDb && db->aDb[i].pBt && db->aDb[i].inTrans==1 ){ rc = sqlite3BtreeBeginStmt(db->aDb[i].pBt); @@ -5154,86 +5155,6 @@ case OP_SetInsert: { break; } -/* Opcode: SetFound P1 P2 * -** -** Pop the stack once and compare the value popped off with the -** contents of set P1. If the element popped exists in set P1, -** then jump to P2. Otherwise fall through. -*/ -case OP_SetFound: { - int i = pOp->p1; - assert( pTos>=p->aStack ); - Stringify(pTos); - if( i>=0 && inSet && sqlite3HashFind(&p->aSet[i].hash, pTos->z, pTos->n)){ - pc = pOp->p2 - 1; - } - Release(pTos); - pTos--; - break; -} - -/* Opcode: SetNotFound P1 P2 * -** -** Pop the stack once and compare the value popped off with the -** contents of set P1. If the element popped does not exists in -** set P1, then jump to P2. Otherwise fall through. -*/ -case OP_SetNotFound: { - int i = pOp->p1; - assert( pTos>=p->aStack ); - Stringify(pTos); - if( i<0 || i>=p->nSet || - sqlite3HashFind(&p->aSet[i].hash, pTos->z, pTos->n)==0 ){ - pc = pOp->p2 - 1; - } - Release(pTos); - pTos--; - break; -} - -/* Opcode: SetFirst P1 P2 * -** -** Read the first element from set P1 and push it onto the stack. If the -** set is empty, push nothing and jump immediately to P2. This opcode is -** used in combination with OP_SetNext to loop over all elements of a set. -*/ -/* Opcode: SetNext P1 P2 * -** -** Read the next element from set P1 and push it onto the stack. If there -** are no more elements in the set, do not do the push and fall through. -** Otherwise, jump to P2 after pushing the next set element. -*/ -case OP_SetFirst: -case OP_SetNext: { - Set *pSet; - CHECK_FOR_INTERRUPT; - if( pOp->p1<0 || pOp->p1>=p->nSet ){ - if( pOp->opcode==OP_SetFirst ) pc = pOp->p2 - 1; - break; - } - pSet = &p->aSet[pOp->p1]; - if( pOp->opcode==OP_SetFirst ){ - pSet->prev = sqliteHashFirst(&pSet->hash); - if( pSet->prev==0 ){ - pc = pOp->p2 - 1; - break; - } - }else{ - assert( pSet->prev ); - pSet->prev = sqliteHashNext(pSet->prev); - if( pSet->prev==0 ){ - break; - }else{ - pc = pOp->p2 - 1; - } - } - pTos++; - pTos->z = sqliteHashKey(pSet->prev); - pTos->n = sqliteHashKeysize(pSet->prev); - pTos->flags = MEM_Utf8 | MEM_Str | MEM_Ephem; - break; -} - /* Opcode: Vacuum * * * ** ** Vacuum the entire database. This opcode will cause other virtual