aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-08-23 17:00:22 +0000
committerdrh <drh@noemail.net>2019-08-23 17:00:22 +0000
commit5f6a4ea2e2b5a12bc425615a8a01af920c1bc65d (patch)
tree4e1deb6d2012deab7fc8321238de92e46c724626
parent0086e078656bbdfebffdbea67f3f0131aa677b08 (diff)
downloadsqlite-5f6a4ea2e2b5a12bc425615a8a01af920c1bc65d.tar.gz
sqlite-5f6a4ea2e2b5a12bc425615a8a01af920c1bc65d.zip
Additional simplifications of the WHERE loop code generator logic for
NULLS LAST. FossilOrigin-Name: 1383680d927d7d703933be7653c0019199845e7f7e82bcc76d9ca3808093e9d8
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--src/wherecode.c28
3 files changed, 21 insertions, 21 deletions
diff --git a/manifest b/manifest
index 46a935e60..3fb90c268 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplification\sof\sthe\sWHERE\sloop\scode\sgenerator\sfor\sNULLS\sLAST\ssaves\sa\nfew\sCPU\scycles\sand\sabout\sa\shundred\sbytes\sof\scode\sspace.
-D 2019-08-23T16:12:20.533
+C Additional\ssimplifications\sof\sthe\sWHERE\sloop\scode\sgenerator\slogic\sfor\nNULLS\sLAST.
+D 2019-08-23T17:00:22.277
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -611,7 +611,7 @@ F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
F src/walker.c d5a94907dcac990e31976be9dc769d17f6a806782593d6aec9d760ee01ec22cd
F src/where.c 10e21ac338582a4f87b2d09f09dd812c9bda0a0c4c456f54daeeee355afae733
F src/whereInt.h 4a296fd4fa79fdcbc2b5e8c1b898901617655811223e1082b899c23ecb092217
-F src/wherecode.c f8ba85888b8a6843bce84e7e21f61d6c043c21c888871ad84fb911f45671e95d
+F src/wherecode.c 3bed0f377aacff188575bccc2f01d45ed5df353b52e8b2c39a22ff88ae3cfc25
F src/whereexpr.c 2757afbd5cfdbb420f9d0392e1bd5f5c0e33dee50a8c692befc7e502308e449f
F src/window.c 3ea716bb0dd5ffc8cdbaa48baffc525958b51bc61b2afd73a56baccfcd7ceb2f
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1837,7 +1837,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P bf875e1a259a4167694e06349458452dc36c1d38aa6843518d9ae46ce74e5559
-R f34508d6bf0c4c450df67caf81b0a3ce
+P e3ed2f496f51234a8f81d90d47ba603b06dbed38b8bd8f1934294379cde74d3a
+R 1ab18b69b8d15ca4e03875cc0023fa2f
U drh
-Z 77866c600215002b5dd6dd0eeafd861f
+Z e7fe19284bcd51997b007393da65f48c
diff --git a/manifest.uuid b/manifest.uuid
index c464a63a9..80c0a7a60 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e3ed2f496f51234a8f81d90d47ba603b06dbed38b8bd8f1934294379cde74d3a \ No newline at end of file
+1383680d927d7d703933be7653c0019199845e7f7e82bcc76d9ca3808093e9d8 \ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index c1304c8af..9868428c5 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1708,6 +1708,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
assert( bSeekPastNull==0 || bStopAtNull==0 );
if( regBignull ){
assert( bSeekPastNull==1 || bStopAtNull==1 );
+ assert( bSeekPastNull==!bStopAtNull );
assert( bStopAtNull==startEq );
sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
op = aStartOp[(nConstraint>1)*4 + 2 + bRev];
@@ -1766,6 +1767,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
/* Check if the index cursor is past the end of the range. */
if( nConstraint ){
if( regBignull ){
+ /* Except, skip the end-of-range check while doing the NULL-scan */
sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+3);
VdbeComment((v, "If NULL-scan active"));
VdbeCoverage(v);
@@ -1778,23 +1780,21 @@ Bitmask sqlite3WhereCodeOneLoopStart(
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
if( regBignull ){
+ /* During a NULL-scan, check to see if we have reached the end of
+ ** the NULLs */
+ assert( bSeekPastNull==!bStopAtNull );
+ assert( bSeekPastNull+bStopAtNull==1 );
+ assert( nConstraint+bSeekPastNull>0 );
sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+2);
VdbeComment((v, "If NULL-scan pending"));
VdbeCoverage(v);
- if( bStopAtNull ){
- op = aEndOp[bRev*2 + 0];
- assert( op==OP_IdxGE || op==OP_IdxLE );
- sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
- testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
- testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
- }else{
- op = aEndOp[bRev*2 + endEq];
- sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint+1);
- testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT );
- testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
- testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
- testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
- }
+ op = aEndOp[bRev*2 + bSeekPastNull];
+ sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase,
+ nConstraint+bSeekPastNull);
+ testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT );
+ testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
+ testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
+ testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){