Code cleanup and simplification. Three new Mem opcodes added.
The sqlite3VdbeJumpHere function added. (CVS 2730)
FossilOrigin-Name: 2471957feee57538e5e1e50a704a337f0927d10e
diff --git a/src/expr.c b/src/expr.c
index 6324068..c77c354 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.228 2005/09/16 02:38:10 drh Exp $
+** $Id: expr.c,v 1.229 2005/09/20 17:42:23 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1292,8 +1292,7 @@
sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0);
testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0);
assert( testAddr>0 || sqlite3_malloc_failed );
- sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
- sqlite3VdbeAddOp(v, OP_MemStore, mem, 1);
+ sqlite3VdbeAddOp(v, OP_MemInt, 1, mem);
}
switch( pExpr->op ){
@@ -1367,7 +1366,7 @@
if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){
VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1);
int i;
- for(i=0; i<4; i++){
+ for(i=0; i<3; i++){
aOp[i].opcode = OP_Noop;
}
testAddr = 0;
@@ -1409,7 +1408,7 @@
}
if( testAddr ){
- sqlite3VdbeChangeP2(v, testAddr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, testAddr);
}
return;
}
@@ -1709,7 +1708,6 @@
case TK_CASE: {
int expr_end_label;
int jumpInst;
- int addr;
int nExpr;
int i;
ExprList *pEList;
@@ -1737,8 +1735,7 @@
}
sqlite3ExprCode(pParse, aListelem[i+1].pExpr);
sqlite3VdbeAddOp(v, OP_Goto, 0, expr_end_label);
- addr = sqlite3VdbeCurrentAddr(v);
- sqlite3VdbeChangeP2(v, jumpInst, addr);
+ sqlite3VdbeJumpHere(v, jumpInst);
}
if( pExpr->pLeft ){
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
@@ -1905,7 +1902,7 @@
codeCompare(pParse, pLeft, pRight, OP_Le, dest, jumpIfNull);
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
- sqlite3VdbeChangeP2(v, addr, sqlite3VdbeCurrentAddr(v));
+ sqlite3VdbeJumpHere(v, addr);
sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
break;
}