diff options
author | drh <drh@noemail.net> | 2019-08-23 13:32:03 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-08-23 13:32:03 +0000 |
commit | ec3dda5b11f527c69f1007fa60ba2765e0a5628b (patch) | |
tree | 855f6a265650aa711e4de216877b1e15a397f042 /src/wherecode.c | |
parent | 74e1b861ad749a00966583c29f0e2d8dfb510c82 (diff) | |
download | sqlite-ec3dda5b11f527c69f1007fa60ba2765e0a5628b.tar.gz sqlite-ec3dda5b11f527c69f1007fa60ba2765e0a5628b.zip |
Invert the meaning of the regBignull flag so that it is 1 when doing the
normal scan and 1 when scanning nulls. This enables the re-do jump at the
bottom of the loop to be coded with a single OP_IfNotZero opcode, rather
than a sequence of OP_If, OP_Integer, OP_Goto.
FossilOrigin-Name: bf875e1a259a4167694e06349458452dc36c1d38aa6843518d9ae46ce74e5559
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 12ed0d7af..2aff70554 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1690,8 +1690,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur); } if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, regBignull); - VdbeComment((v, "NULL-scan flag")); + sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); + VdbeComment((v, "NULL-scan needed flag")); } op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; @@ -1776,8 +1776,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+3); - VdbeComment((v, "If in NULL-scan")); + sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+3); + VdbeComment((v, "If NULL-scan active")); VdbeCoverage(v); } op = aEndOp[bRev*2 + endEq]; @@ -1788,8 +1788,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE ); } if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+2); - VdbeComment((v, "If not in NULL-scan")); + sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+2); + VdbeComment((v, "If NULL-scan pending")); VdbeCoverage(v); if( bStopAtNull ){ op = aEndOp[bRev*2 + 0]; |