]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Omit one or more pointless instructions that occur in between OP_NoConflict
authordrh <drh@noemail.net>
Thu, 19 Dec 2013 02:23:45 +0000 (02:23 +0000)
committerdrh <drh@noemail.net>
Thu, 19 Dec 2013 02:23:45 +0000 (02:23 +0000)
and OP_Halt.

FossilOrigin-Name: 61e2f3575c4a94f9571c28fb2bd19da84b0edceb

manifest
manifest.uuid
src/insert.c

index a1d9fbcef1d306c1e4126f6824e8eefc168ff7b3..8a760c5b7dcd420c98968e469a32debe80ccfbd5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\san\sunnecessary\scolumn-cache\sflush\soperation.\s\sAdd\scode\sto\strace\sthe\ncolumn\scache\swhen\scompiled\swith\sSQLITE_DEBUG\sand\susing\nPRAGMA\svdbe_addoptrace=ON.
-D 2013-12-18T18:44:43.134
+C Omit\sone\sor\smore\spointless\sinstructions\sthat\soccur\sin\sbetween\sOP_NoConflict\nand\sOP_Halt.
+D 2013-12-19T02:23:45.916
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -183,7 +183,7 @@ F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486
 F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
 F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22
 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
-F src/insert.c 3cf8012325857d162f74389420b14be7976a538d
+F src/insert.c d1b3fd53cd8e3f232e47675cf2c3d1b1f4101f2a
 F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
 F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
@@ -1147,8 +1147,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 93121d3097a43997af3c0de65bd9bd7663845fa2 97fdfc6b79833011fc0c506fe5e0985c0fb1906c
-R ad4bcfdba61e39f0bb9e7693f91a62e0
-T +closed 97fdfc6b79833011fc0c506fe5e0985c0fb1906c
+P 58704ed1f4cd78bb3b0c095ffd1626906a95a413
+R 464abf9a1fd9120477908520316caad2
 U drh
-Z d67945416ae9c517bb5d46293eed5eb3
+Z 1a25f8b4acb360c6ad6b1c4bc1cd07e9
index c14fd41eab41af10b6fd161327fc355562ee4ce8..6fd6c73113fec0c7cceef4d4363bf76d98048e06 100644 (file)
@@ -1 +1 @@
-58704ed1f4cd78bb3b0c095ffd1626906a95a413
\ No newline at end of file
+61e2f3575c4a94f9571c28fb2bd19da84b0edceb
\ No newline at end of file
index b1a9104f717667d6217c37cca20f46889f175e72..fe1f74addb45b126dd73ae1830f4ef3cb4b04053 100644 (file)
@@ -1503,47 +1503,49 @@ void sqlite3GenerateConstraintChecks(
 
     /* Generate code to handle collisions */
     regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
-    if( HasRowid(pTab) ){
-      sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
-      /* Conflict only if the rowid of the existing index entry
-      ** is different from old-rowid */
-      if( isUpdate ){
-        sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
-      }
-    }else{
-      int x;
-      /* Extract the PRIMARY KEY from the end of the index entry and
-      ** store it in registers regR..regR+nPk-1 */
-      if( (isUpdate || onError==OE_Replace) && pIdx!=pPk ){
-        for(i=0; i<pPk->nKeyCol; i++){
-          x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
-          sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
-          VdbeComment((v, "%s.%s", pTab->zName,
-                       pTab->aCol[pPk->aiColumn[i]].zName));
+    if( isUpdate || onError==OE_Replace ){
+      if( HasRowid(pTab) ){
+        sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
+        /* Conflict only if the rowid of the existing index entry
+        ** is different from old-rowid */
+        if( isUpdate ){
+          sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
         }
-      }
-      if( isUpdate ){
-        /* If currently processing the PRIMARY KEY of a WITHOUT ROWID 
-        ** table, only conflict if the new PRIMARY KEY values are actually
-        ** different from the old.
-        **
-        ** For a UNIQUE index, only conflict if the PRIMARY KEY values
-        ** of the matched index row are different from the original PRIMARY
-        ** KEY values of this row before the update.  */
-        int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
-        int op = OP_Ne;
-        int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
-
-        for(i=0; i<pPk->nKeyCol; i++){
-          char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
-          x = pPk->aiColumn[i];
-          if( i==(pPk->nKeyCol-1) ){
-            addrJump = addrUniqueOk;
-            op = OP_Eq;
+      }else{
+        int x;
+        /* Extract the PRIMARY KEY from the end of the index entry and
+        ** store it in registers regR..regR+nPk-1 */
+        if( (isUpdate || onError==OE_Replace) && pIdx!=pPk ){
+          for(i=0; i<pPk->nKeyCol; i++){
+            x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
+            sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
+            VdbeComment((v, "%s.%s", pTab->zName,
+                         pTab->aCol[pPk->aiColumn[i]].zName));
+          }
+        }
+        if( isUpdate ){
+          /* If currently processing the PRIMARY KEY of a WITHOUT ROWID 
+          ** table, only conflict if the new PRIMARY KEY values are actually
+          ** different from the old.
+          **
+          ** For a UNIQUE index, only conflict if the PRIMARY KEY values
+          ** of the matched index row are different from the original PRIMARY
+          ** KEY values of this row before the update.  */
+          int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
+          int op = OP_Ne;
+          int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
+  
+          for(i=0; i<pPk->nKeyCol; i++){
+            char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
+            x = pPk->aiColumn[i];
+            if( i==(pPk->nKeyCol-1) ){
+              addrJump = addrUniqueOk;
+              op = OP_Eq;
+            }
+            sqlite3VdbeAddOp4(v, op, 
+                regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
+            );
           }
-          sqlite3VdbeAddOp4(v, op, 
-              regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
-          );
         }
       }
     }