Improved VdbeCoverage() macros. A few minor simplifications to generated
VDBE code.
FossilOrigin-Name: 01f60027ad1841051fa493a646141445f8971357
diff --git a/manifest b/manifest
index 6f9201a..e1ddd56 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Part\sof\sthe\schange\sin\sthe\sprevious\scheck-in\swas\sincorrect\sand\scan\sresult\nin\san\sincorrect\sUPDATE\sfor\sWITHOUT\sROWID\stables.\s\sThis\scheck-in\sfixes\sthe\nproblem.
-D 2014-08-04T21:26:58.927
+C Improved\sVdbeCoverage()\smacros.\s\sA\sfew\sminor\ssimplifications\sto\sgenerated\nVDBE\scode.
+D 2014-08-05T00:53:51.727
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -176,7 +176,7 @@
F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a
F src/date.c 593c744b2623971e45affd0bde347631bdfa4625
F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf
-F src/expr.c 8ac2d0e8a0c1bc84eba94ab39867ba4d07d84f75
+F src/expr.c ef474fc0e73a2fc14835a2dc5282d3c28f8e1eaa
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c 8545f3b36da47473e10800ea4fb0810fd4062514
F src/func.c 3bc223ea36cd29a91c481485343d0ee4257ab8dc
@@ -216,13 +216,13 @@
F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
F src/pcache1.c 102e6f5a2fbc646154463eb856d1fd716867b64c
-F src/pragma.c d4a33151f057e35e5a2024adf8e41d2817b5c105
+F src/pragma.c d10ef67c4de79f78188b965b4b7988aff1d66f2e
F src/prepare.c 677521ab7132615a8a26107a1d1c3132f44ae337
F src/printf.c af06f66927919730f03479fed6ae9854f73419f4
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02
F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be
-F src/select.c 6762c62e11b504aa014edceab8886495165e3a77
+F src/select.c 1529c49075464c5a95fde77314073612b1b8d595
F src/shell.c 191129c3f7a9cf241aea90ff6a6be3e74d3767f0
F src/sqlite.h.in 9bbc5815c73b0e77e68b5275481a5e3e7814a804
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
@@ -283,7 +283,7 @@
F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05
F src/util.c 3076bdd51cdbf60a6e2e57fada745be37133c73e
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
-F src/vdbe.c b9e6866e43a61ca4080410f27c4bb52823495186
+F src/vdbe.c aa93cf7a215a37d1c7ae565202a44869c78dbf8d
F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
F src/vdbeInt.h f5513f2b5ac1e2c5128996c7ea23add256a301df
F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
@@ -1185,7 +1185,7 @@
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7fdf26da1d2f40b80f9e44ff6f5af22ace8f95f3
-R bbb8ed3fbc770a15faae84bee68a96b7
+P ee5f6eae57a656d09a4b3f7fbef664b2c696ddb4
+R 05961687f6977550c21111dd4304208a
U drh
-Z dee92a9842f8b9e58ec243da3f9d9eb9
+Z b7d896cc5839c70221fa827c578afa41
diff --git a/manifest.uuid b/manifest.uuid
index 9bd8699..c10e21e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ee5f6eae57a656d09a4b3f7fbef664b2c696ddb4
\ No newline at end of file
+01f60027ad1841051fa493a646141445f8971357
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index 6816d56..e6ac84d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -2020,7 +2020,9 @@
}
if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){
sqlite3VdbeAddOp4(v, OP_Eq, r1, labelOk, r2,
- (void*)pColl, P4_COLLSEQ); VdbeCoverage(v);
+ (void*)pColl, P4_COLLSEQ);
+ VdbeCoverageIf(v, ii<pList->nExpr-1);
+ VdbeCoverageIf(v, ii==pList->nExpr-1);
sqlite3VdbeChangeP5(v, affinity);
}else{
assert( destIfNull==destIfFalse );
diff --git a/src/pragma.c b/src/pragma.c
index b37499f..9ed5e13 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1794,9 +1794,8 @@
*/
static const int iLn = VDBE_OFFSET_LINENO(2);
static const VdbeOpList endCode[] = {
- { OP_AddImm, 1, 0, 0}, /* 0 */
- { OP_IfNeg, 1, 0, 0}, /* 1 */
- { OP_String8, 0, 3, 0}, /* 2 */
+ { OP_IfNeg, 1, 0, 0}, /* 0 */
+ { OP_String8, 0, 3, 0}, /* 1 */
{ OP_ResultRow, 3, 1, 0},
};
@@ -2002,9 +2001,9 @@
}
}
addr = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);
- sqlite3VdbeChangeP2(v, addr, -mxErr);
- sqlite3VdbeJumpHere(v, addr+1);
- sqlite3VdbeChangeP4(v, addr+2, "ok", P4_STATIC);
+ sqlite3VdbeChangeP3(v, addr, -mxErr);
+ sqlite3VdbeJumpHere(v, addr);
+ sqlite3VdbeChangeP4(v, addr+1, "ok", P4_STATIC);
}
break;
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
diff --git a/src/select.c b/src/select.c
index 6ceb3fe..f5456c8 100644
--- a/src/select.c
+++ b/src/select.c
@@ -541,8 +541,7 @@
){
if( iOffset>0 ){
int addr;
- sqlite3VdbeAddOp2(v, OP_AddImm, iOffset, -1);
- addr = sqlite3VdbeAddOp1(v, OP_IfNeg, iOffset); VdbeCoverage(v);
+ addr = sqlite3VdbeAddOp3(v, OP_IfNeg, iOffset, 0, -1); VdbeCoverage(v);
sqlite3VdbeAddOp2(v, OP_Goto, 0, iContinue);
VdbeComment((v, "skip OFFSET records"));
sqlite3VdbeJumpHere(v, addr);
diff --git a/src/vdbe.c b/src/vdbe.c
index ade82b0..16d9eee 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -116,6 +116,12 @@
** branch can go. It is usually 2. "I" is the direction the branch
** goes. 0 means falls through. 1 means branch is taken. 2 means the
** second alternative branch is taken.
+**
+** iSrcLine is the source code line (from the __LINE__ macro) that
+** generated the VDBE instruction. This instrumentation assumes that all
+** source code is in a single file (the amalgamation). Special values 1
+** and 2 for the iSrcLine parameter mean that this particular branch is
+** always taken or never taken, respectively.
*/
#if !defined(SQLITE_VDBE_COVERAGE)
# define VdbeBranchTaken(I,M)
@@ -5600,17 +5606,16 @@
break;
}
-/* Opcode: IfNeg P1 P2 * * *
-** Synopsis: if r[P1]<0 goto P2
+/* Opcode: IfNeg P1 P2 P3 * *
+** Synopsis: r[P1]+=P3, if r[P1]<0 goto P2
**
-** If the value of register P1 is less than zero, jump to P2.
-**
-** It is illegal to use this instruction on a register that does
-** not contain an integer. An assertion fault will result if you try.
+** Register P1 must contain an intger. Add literal P3 to the value in
+** register P1 then if the value of register P1 is less than zero, jump to P2.
*/
case OP_IfNeg: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];
assert( pIn1->flags&MEM_Int );
+ pIn1->u.i += pOp->p3;
VdbeBranchTaken(pIn1->u.i<0, 2);
if( pIn1->u.i<0 ){
pc = pOp->p2 - 1;
@@ -5623,9 +5628,6 @@
**
** The register P1 must contain an integer. Add literal P3 to the
** value in register P1. If the result is exactly 0, jump to P2.
-**
-** It is illegal to use this instruction on a register that does
-** not contain an integer. An assertion fault will result if you try.
*/
case OP_IfZero: { /* jump, in1 */
pIn1 = &aMem[pOp->p1];