]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Register-ify the OP_ForceInt opcode. (CVS 4684)
authordrh <drh@noemail.net>
Sat, 5 Jan 2008 05:38:21 +0000 (05:38 +0000)
committerdrh <drh@noemail.net>
Sat, 5 Jan 2008 05:38:21 +0000 (05:38 +0000)
FossilOrigin-Name: 32380dcabcd3839e79f91430b0c250d6e02d9243

manifest
manifest.uuid
src/vdbe.c
src/where.c

index a6dd62160059e5b63abecc68a41baed7a25567ff..2b93b9a51728fde0094b159046411a16c8a4cc65 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Register-ify\sthe\sOP_AddImm\sand\sall\scasting\sopcodes.\s\sOmit\sthe\nOP_MemIncr\sopcode.\s(CVS\s4683)
-D 2008-01-05T05:20:10
+C Register-ify\sthe\sOP_ForceInt\sopcode.\s(CVS\s4684)
+D 2008-01-05T05:38:21
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -168,7 +168,7 @@ F src/update.c ac6cdfebf88340fd68550b1d7fd6a15ad7144fd8
 F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736
 F src/util.c 05f31144bbd3f1a24f4139ae029c42545cb72624
 F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
-F src/vdbe.c f8aabf9ae1e013ae837e2620d39533189396fa58
+F src/vdbe.c d96c341f070f7f683fd1a34114c19dbecdf49647
 F src/vdbe.h bb128757b84280504a1243c450fd13ead248ede5
 F src/vdbeInt.h 31bd686595356284d5484592e2dc6e58025aa346
 F src/vdbeapi.c f14174843bf4be2c9afdf2ef48b61e7c3ac62d7c
@@ -177,7 +177,7 @@ F src/vdbeblob.c b90f7494c408d47ce6835000b01e40b371e27baf
 F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6
 F src/vdbemem.c 123994fcd344993d2fb050a83b91b341bbbd08b4
 F src/vtab.c 03014b2bfa8096ecac5fcdc80d34cd76e06af52a
-F src/where.c af005c6a5875b230648e7f1a38993cd848161313
+F src/where.c 941635bb007484330bc1a0f3cc013b67f1c41864
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test ee350b9ab15b175fc0a8fb51bf2141ed3a3b9cba
@@ -603,7 +603,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P cc149eb9ca3c672cc6fea3528353234ac2ed5745
-R 9381db31828d60007b12e8ca022919a2
+P 3e8a07dd3cc9921ad39e379576abb0b485a42202
+R 5fa8eccc6a1d8f273459b71d7e4508a7
 U drh
-Z 6bb8ea814574f175721b7ff6434341e5
+Z 54cf213cacf40b4b6524baf65c0d27ec
index 265f768825d21ac2a1ce1a42fd182e21938e280a..ac44a0df372192d1eadf36624a1866d03ee0839e 100644 (file)
@@ -1 +1 @@
-3e8a07dd3cc9921ad39e379576abb0b485a42202
\ No newline at end of file
+32380dcabcd3839e79f91430b0c250d6e02d9243
\ No newline at end of file
index d5177df191dc11f02dd26176a5409ef6667d034e..53d7ad83492d622aff483902483d7e1fca0a20a5 100644 (file)
@@ -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.681 2008/01/05 05:20:10 drh Exp $
+** $Id: vdbe.c,v 1.682 2008/01/05 05:38:21 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1614,38 +1614,35 @@ case OP_AddImm: {            /* no-push, in1 */
   break;
 }
 
-/* Opcode: ForceInt P1 P2 *
+/* Opcode: ForceInt P1 P2 P3 * *
 **
-** Convert the top of the stack into an integer.  If the current top of
-** the stack is not numeric (meaning that is is a NULL or a string that
-** does not look like an integer or floating point number) then pop the
-** stack and jump to P2.  If the top of the stack is numeric then
+** Convert value in register P1 into an integer.  If the value 
+** in P1 is not numeric (meaning that is is a NULL or a string that
+** does not look like an integer or floating point number) then
+** jump to P2.  If the value in P1 is numeric then
 ** convert it into the least integer that is greater than or equal to its
-** current value if P1==0, or to the least integer that is strictly
-** greater than its current value if P1==1.
+** current value if P3==0, or to the least integer that is strictly
+** greater than its current value if P3==1.
 */
-case OP_ForceInt: {            /* no-push, jump */
+case OP_ForceInt: {            /* no-push, jump, in1 */
   i64 v;
-  assert( pTos>=p->aStack );
-  applyAffinity(pTos, SQLITE_AFF_NUMERIC, encoding);
-  if( (pTos->flags & (MEM_Int|MEM_Real))==0 ){
-    Release(pTos);
-    pTos--;
+  applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
+  if( (pIn1->flags & (MEM_Int|MEM_Real))==0 ){
     pc = pOp->p2 - 1;
     break;
   }
-  if( pTos->flags & MEM_Int ){
-    v = pTos->u.i + (pOp->p1!=0);
+  nPop = 0;
+  if( pIn1->flags & MEM_Int ){
+    v = pIn1->u.i + (pOp->p3!=0);
   }else{
-    /* FIX ME:  should this not be assert( pTos->flags & MEM_Real ) ??? */
-    sqlite3VdbeMemRealify(pTos);
-    v = (int)pTos->r;
-    if( pTos->r>(double)v ) v++;
-    if( pOp->p1 && pTos->r==(double)v ) v++;
-  }
-  Release(pTos);
-  pTos->u.i = v;
-  pTos->flags = MEM_Int;
+    assert( pIn1->flags & MEM_Real );
+    v = (sqlite3_int64)pIn1->r;
+    if( pIn1->r>(double)v ) v++;
+    if( pOp->p3 && pIn1->r==(double)v ) v++;
+  }
+  Release(pIn1);
+  pIn1->u.i = v;
+  pIn1->flags = MEM_Int;
   break;
 }
 
index 5f512abb00ea7fc2cc4409f25ed84db2f2184892..0ca12237999797adee6ef67422b5fb80012fef43 100644 (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.274 2008/01/05 04:06:04 drh Exp $
+** $Id: where.c,v 1.275 2008/01/05 05:38:21 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -2348,7 +2348,8 @@ WhereInfo *sqlite3WhereBegin(
         assert( pX!=0 );
         assert( pStart->leftCursor==iCur );
         sqlite3ExprCode(pParse, pX->pRight, 0);
-        sqlite3VdbeAddOp2(v, OP_ForceInt, pX->op==TK_LE || pX->op==TK_GT, brk);
+        sqlite3VdbeAddOp3(v, OP_ForceInt, 0, brk, 
+                             pX->op==TK_LE || pX->op==TK_GT);
         sqlite3VdbeAddOp2(v, bRev ? OP_MoveLt : OP_MoveGe, iCur, brk);
         VdbeComment((v, "pk"));
         disableTerm(pLevel, pStart);