]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In the lemon-generated parser, automatically promote SHIFTREDUCE actions on
authordrh <drh@noemail.net>
Wed, 28 Jun 2017 11:56:18 +0000 (11:56 +0000)
committerdrh <drh@noemail.net>
Wed, 28 Jun 2017 11:56:18 +0000 (11:56 +0000)
nonterminal systems to pure REDUCE actions, for a performance enhancement.

FossilOrigin-Name: c46d94a8cde816ca383e771721ebd4900de77950cba700e35a26f70fd5b794a4

manifest
manifest.uuid
tool/lemon.c
tool/lempar.c

index f56deb4aff0aa4bcd623333df6f8e36e7073d7e9..8586f644db4652c2760e36d878e592a4d883176e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\serror\shandling\slogic\sin\ssqlite3_exec()\sto\ssave\sabout\s40\sbytes.
-D 2017-06-28T01:21:16.224
+C In\sthe\slemon-generated\sparser,\sautomatically\spromote\sSHIFTREDUCE\sactions\son\nnonterminal\ssystems\sto\spure\sREDUCE\sactions,\sfor\sa\sperformance\senhancement.
+D 2017-06-28T11:56:18.525
 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@@ -1509,8 +1509,8 @@ F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
 F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c f4f1045743e12f86b132253a3192ef92c94bfceb7f41ac41b8e3b373aa78474e
-F tool/lempar.c db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1
+F tool/lemon.c 8f18c158ff3fb92e844d389a8f8802ef47d3065746139b9f065a34f8e3acba82
+F tool/lempar.c 12d9fc3b7fd504a413d578f8542a84227dd560c29dc2e829d01a333e09df035c
 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
 F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1584,7 +1584,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 bfc4e7f30e4654b9603457fb6a4136828e346dcfe4e313fdf56ed62d131b7156
-R 9ee65c1aa637763c0020e3a8027e1724
+P 6480916c7266437cf8a70e5db2ca5c753ad71c361b68e41cbf8572f77c271920
+R 01de758547ecf045b8fcd9d862711733
 U drh
-Z 46819a22d665678fea30894f28c71769
+Z e0e7b0df8e672e69a6f8d6e88a7b4646
index 61d99173247a04260b74af51bedddf1019a30d70..05c0a7d81a6408f69161a45ae47212b9e24f671c 100644 (file)
@@ -1 +1 @@
-6480916c7266437cf8a70e5db2ca5c753ad71c361b68e41cbf8572f77c271920
\ No newline at end of file
+c46d94a8cde816ca383e771721ebd4900de77950cba700e35a26f70fd5b794a4
\ No newline at end of file
index 37d2c781d93a86774d04da3572b1b60051aa74ce..8a00787a49c0fdd716355c81320bdb786b8f694e 100644 (file)
@@ -3297,7 +3297,14 @@ PRIVATE int compute_action(struct lemon *lemp, struct action *ap)
   int act;
   switch( ap->type ){
     case SHIFT:  act = ap->x.stp->statenum;                        break;
-    case SHIFTREDUCE: act = ap->x.rp->iRule + lemp->nstate;        break;
+    case SHIFTREDUCE: {
+      act = ap->x.rp->iRule + lemp->nstate;
+      /* Since a SHIFT is inherient after a prior REDUCE, convert any
+      ** SHIFTREDUCE action with a nonterminal on the LHS into a simple
+      ** REDUCE action: */
+      if( ap->sp->index>=lemp->nterminal ) act += lemp->nrule;
+      break;
+    }
     case REDUCE: act = ap->x.rp->iRule + lemp->nstate+lemp->nrule; break;
     case ERROR:  act = lemp->nstate + lemp->nrule*2;               break;
     case ACCEPT: act = lemp->nstate + lemp->nrule*2 + 1;           break;
index 21ed9d79abe3fd9b5d61bc5d709c675146e02feb..59fb6dfcd3a73e1436dd5841a4fa727215a3ab60 100644 (file)
@@ -708,19 +708,23 @@ static void yy_reduce(
   yygoto = yyRuleInfo[yyruleno].lhs;
   yysize = yyRuleInfo[yyruleno].nrhs;
   yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
-  if( yyact <= YY_MAX_SHIFTREDUCE ){
-    if( yyact>YY_MAX_SHIFT ){
-      yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
-    }
+
+  /* There are no SHIFTREDUCE actions on nonterminals because the table
+  ** generator has simplified them to pure REDUCE actions. */
+  assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
+
+  /* It is not possible for a REDUCE to be followed by an error */
+  assert( yyact!=YY_ERROR_ACTION );
+
+  if( yyact==YY_ACCEPT_ACTION ){
+    yypParser->yytos -= yysize;
+    yy_accept(yypParser);
+  }else{
     yymsp -= yysize-1;
     yypParser->yytos = yymsp;
     yymsp->stateno = (YYACTIONTYPE)yyact;
     yymsp->major = (YYCODETYPE)yygoto;
     yyTraceShift(yypParser, yyact);
-  }else{
-    assert( yyact == YY_ACCEPT_ACTION );
-    yypParser->yytos -= yysize;
-    yy_accept(yypParser);
   }
 }