1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

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
This commit is contained in:
drh
2019-08-23 13:32:03 +00:00
parent 74e1b861ad
commit ec3dda5b11
5 changed files with 17 additions and 23 deletions

View File

@@ -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];