From 8bb93daca0004d8c882fd7d46a4bdf2a5979ad88 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 3 Apr 2022 20:39:48 +0000 Subject: [PATCH] Performance optimization and size reduction in the OP_Halt opcode. FossilOrigin-Name: 21948e6e1ccd2ce128742415d21759604ecb8902226ec4707dbd75585450f208 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbe.c | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f0f98c5b05..244b07b907 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sthe\sVdbe.runOnlyOnce\sflag\s(simplifying\sthe\sprepared\sstatement\nimplementation)\sand\saccomplish\sthe\ssame\sresult\sby\sadding\san\s"OP_Expire\s1\s1"\nopcode\sto\sprepared\sstatements\sthat\swould\snormally\shave\srunOnlyOnce\sset. -D 2022-04-03T19:13:40.130 +C Performance\soptimization\sand\ssize\sreduction\sin\sthe\sOP_Halt\sopcode. +D 2022-04-03T20:39:48.118 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -624,7 +624,7 @@ F src/upsert.c 8789047a8f0a601ea42fa0256d1ba3190c13746b6ba940fe2d25643a7e991937 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c 602fe229f32a96ceccae4f40824129669582096f7c355f53dbac156c9fecef23 F src/vacuum.c 6c38ddc52f0619865c91dae9c441d4d48bf3040d7dc1bc5b22da1e45547ed0b3 -F src/vdbe.c 17c49fe3d853ca458dbf681ea462f8095b4cab86beaca57be3483f8aa0394ca4 +F src/vdbe.c 1d839d17db758a6c3a06cc2018880395f9b0f11ff81945d55cf90c4ae6c901c3 F src/vdbe.h a1d0e3b934e835e73edd146f2e7c4eadb711b5c9875c18159a57483fd78e550e F src/vdbeInt.h 5f3d0abcf30c2b7a6672ad4386f18be0fca9c9b2cefe18f85a2e3df74f2613bf F src/vdbeapi.c 5c498998c99667f16cac2519f2fa439fe46acf99a332b0caa73637fc2ab35c22 @@ -1945,8 +1945,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7bee8c195f3fc27aaab13e493ad446a4f19201de3ac064ed6d8a3cbda7c69ee1 -R 15ed6d8a2e61bcb1b52a461e4c596e08 +P 6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1 +R d64478804f8f45705fcb95b743cf8c6f U drh -Z c2f5051216c01ebf5c6b4028b126912b +Z 82c6988106584643e5a2e0ab2496c5d2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 25906a8e25..50c5b7148b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1 \ No newline at end of file +21948e6e1ccd2ce128742415d21759604ecb8902226ec4707dbd75585450f208 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 4c7a3a72c8..a4177ae2ea 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -1129,11 +1129,10 @@ case OP_Halt: { VdbeFrame *pFrame; int pcx; - pcx = (int)(pOp - aOp); #ifdef SQLITE_DEBUG if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); } #endif - if( pOp->p1==SQLITE_OK && p->pFrame ){ + if( p->pFrame && pOp->p1==SQLITE_OK ){ /* Halt the sub-program. Return control to the parent frame. */ pFrame = p->pFrame; p->pFrame = pFrame->pParent; @@ -1155,7 +1154,6 @@ case OP_Halt: { } p->rc = pOp->p1; p->errorAction = (u8)pOp->p2; - p->pc = pcx; assert( pOp->p5<=4 ); if( p->rc ){ if( pOp->p5 ){ @@ -1172,6 +1170,7 @@ case OP_Halt: { }else{ sqlite3VdbeError(p, "%s", pOp->p4.z); } + pcx = (int)(pOp - aOp); sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg); } rc = sqlite3VdbeHalt(p);