1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Improved extended comments of comparison operators when the SQLITE_STOREP2

flags is set on P5.  No changes to non-debug code.

FossilOrigin-Name: bbc1b016164ed0793e07302614384d52119463e0
This commit is contained in:
drh
2016-08-24 21:24:04 +00:00
parent 62659b2a80
commit 72e26dec86
4 changed files with 46 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
C In\ssqlite3FindInIndex(),\simprove\sinternal\scomments\sand\savoid\san\nunreachable\sbranch. C Improved\sextended\scomments\sof\scomparison\soperators\swhen\sthe\sSQLITE_STOREP2\nflags\sis\sset\son\sP5.\s\sNo\schanges\sto\snon-debug\scode.
D 2016-08-24T18:51:23.484 D 2016-08-24T21:24:04.787
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
@@ -450,11 +450,11 @@ F src/update.c 8179e699dbd45b92934fd02d3d8e3732e8da8802
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
F src/util.c 810ec3f22e2d1b62e66c30fe3621ebdedd23584d F src/util.c 810ec3f22e2d1b62e66c30fe3621ebdedd23584d
F src/vacuum.c 913970b9d86dd6c2b8063ef1af421880f1464ec3 F src/vacuum.c 913970b9d86dd6c2b8063ef1af421880f1464ec3
F src/vdbe.c 766d363ef6520c671eef165098a24c0c6ef36d89 F src/vdbe.c 68d56c11d5c5e704dde6d2d8748750a2f6352a09
F src/vdbe.h 67bc551f7faf04c33493892e4b378aada823ed10 F src/vdbe.h 67bc551f7faf04c33493892e4b378aada823ed10
F src/vdbeInt.h c59381049af5c7751a83456c39b80d1a6fde1f9d F src/vdbeInt.h c59381049af5c7751a83456c39b80d1a6fde1f9d
F src/vdbeapi.c a32d61b7dd05e6890d8fd44d2805f55e2f5ba9f3 F src/vdbeapi.c a32d61b7dd05e6890d8fd44d2805f55e2f5ba9f3
F src/vdbeaux.c a32d79aeaa88dc2b97c261172d952d395254a055 F src/vdbeaux.c 83458783d241cfd6691141c8a105832ee50258e5
F src/vdbeblob.c 3e82a797b60c3b9fed7b8de8c539ca7607874937 F src/vdbeblob.c 3e82a797b60c3b9fed7b8de8c539ca7607874937
F src/vdbemem.c e67dc6d8177fd1830efb5d15e17793408251a187 F src/vdbemem.c e67dc6d8177fd1830efb5d15e17793408251a187
F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c F src/vdbesort.c 91fda3909326860382b0ca8aa251e609c6a9d62c
@@ -1520,7 +1520,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 6099c180db55396d6307538a5428ae5ef1b82d10 P 55945fc12f8157e32e6850e41575c0c6422d29e7
R fa8e14e08c5acfaa4521c63ce095c576 R d8287dc165c2512db536a01f0275f112
U drh U drh
Z 500a8a58193db1f42f4b49dd37f14aa8 Z f51d93eb7238381398d31778d751851b

View File

@@ -1 +1 @@
55945fc12f8157e32e6850e41575c0c6422d29e7 bbc1b016164ed0793e07302614384d52119463e0

View File

@@ -905,7 +905,7 @@ case OP_Yield: { /* in1, jump */
} }
/* Opcode: HaltIfNull P1 P2 P3 P4 P5 /* Opcode: HaltIfNull P1 P2 P3 P4 P5
** Synopsis: if r[P3]=null halt ** Synopsis: if r[P3]=null halt
** **
** Check the value in register P3. If it is NULL then Halt using ** Check the value in register P3. If it is NULL then Halt using
** parameter P1, P2, and P4 as if this were a Halt instruction. If the ** parameter P1, P2, and P4 as if this were a Halt instruction. If the
@@ -1118,7 +1118,7 @@ case OP_String: { /* out2 */
} }
/* Opcode: Null P1 P2 P3 * * /* Opcode: Null P1 P2 P3 * *
** Synopsis: r[P2..P3]=NULL ** Synopsis: r[P2..P3]=NULL
** **
** Write a NULL into registers P2. If P3 greater than P2, then also write ** Write a NULL into registers P2. If P3 greater than P2, then also write
** NULL into register P3 and every register in between P2 and P3. If P3 ** NULL into register P3 and every register in between P2 and P3. If P3
@@ -1147,7 +1147,7 @@ case OP_Null: { /* out2 */
} }
/* Opcode: SoftNull P1 * * * * /* Opcode: SoftNull P1 * * * *
** Synopsis: r[P1]=NULL ** Synopsis: r[P1]=NULL
** **
** Set register P1 to have the value NULL as seen by the OP_MakeRecord ** Set register P1 to have the value NULL as seen by the OP_MakeRecord
** instruction, but do not free any string or blob memory associated with ** instruction, but do not free any string or blob memory associated with
@@ -1200,7 +1200,7 @@ case OP_Variable: { /* out2 */
} }
/* Opcode: Move P1 P2 P3 * * /* Opcode: Move P1 P2 P3 * *
** Synopsis: r[P2@P3]=r[P1@P3] ** Synopsis: r[P2@P3]=r[P1@P3]
** **
** Move the P3 values in register P1..P1+P3-1 over into ** Move the P3 values in register P1..P1+P3-1 over into
** registers P2..P2+P3-1. Registers P1..P1+P3-1 are ** registers P2..P2+P3-1. Registers P1..P1+P3-1 are
@@ -1310,7 +1310,7 @@ case OP_IntCopy: { /* out2 */
} }
/* Opcode: ResultRow P1 P2 * * * /* Opcode: ResultRow P1 P2 * * *
** Synopsis: output=r[P1@P2] ** Synopsis: output=r[P1@P2]
** **
** The registers P1 through P1+P2-1 contain a single row of ** The registers P1 through P1+P2-1 contain a single row of
** results. This opcode causes the sqlite3_step() call to terminate ** results. This opcode causes the sqlite3_step() call to terminate
@@ -1443,14 +1443,14 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
} }
/* Opcode: Add P1 P2 P3 * * /* Opcode: Add P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]+r[P2] ** Synopsis: r[P3]=r[P1]+r[P2]
** **
** Add the value in register P1 to the value in register P2 ** Add the value in register P1 to the value in register P2
** and store the result in register P3. ** and store the result in register P3.
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: Multiply P1 P2 P3 * * /* Opcode: Multiply P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]*r[P2] ** Synopsis: r[P3]=r[P1]*r[P2]
** **
** **
** Multiply the value in register P1 by the value in register P2 ** Multiply the value in register P1 by the value in register P2
@@ -1458,14 +1458,14 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: Subtract P1 P2 P3 * * /* Opcode: Subtract P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]-r[P1] ** Synopsis: r[P3]=r[P2]-r[P1]
** **
** Subtract the value in register P1 from the value in register P2 ** Subtract the value in register P1 from the value in register P2
** and store the result in register P3. ** and store the result in register P3.
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: Divide P1 P2 P3 * * /* Opcode: Divide P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]/r[P1] ** Synopsis: r[P3]=r[P2]/r[P1]
** **
** Divide the value in register P1 by the value in register P2 ** Divide the value in register P1 by the value in register P2
** and store the result in register P3 (P3=P2/P1). If the value in ** and store the result in register P3 (P3=P2/P1). If the value in
@@ -1473,7 +1473,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
** NULL, the result is NULL. ** NULL, the result is NULL.
*/ */
/* Opcode: Remainder P1 P2 P3 * * /* Opcode: Remainder P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]%r[P1] ** Synopsis: r[P3]=r[P2]%r[P1]
** **
** Compute the remainder after integer register P2 is divided by ** Compute the remainder after integer register P2 is divided by
** register P1 and store the result in register P3. ** register P1 and store the result in register P3.
@@ -1706,21 +1706,21 @@ case OP_Function: {
} }
/* Opcode: BitAnd P1 P2 P3 * * /* Opcode: BitAnd P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]&r[P2] ** Synopsis: r[P3]=r[P1]&r[P2]
** **
** Take the bit-wise AND of the values in register P1 and P2 and ** Take the bit-wise AND of the values in register P1 and P2 and
** store the result in register P3. ** store the result in register P3.
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: BitOr P1 P2 P3 * * /* Opcode: BitOr P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]|r[P2] ** Synopsis: r[P3]=r[P1]|r[P2]
** **
** Take the bit-wise OR of the values in register P1 and P2 and ** Take the bit-wise OR of the values in register P1 and P2 and
** store the result in register P3. ** store the result in register P3.
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: ShiftLeft P1 P2 P3 * * /* Opcode: ShiftLeft P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]<<r[P1] ** Synopsis: r[P3]=r[P2]<<r[P1]
** **
** Shift the integer value in register P2 to the left by the ** Shift the integer value in register P2 to the left by the
** number of bits specified by the integer in register P1. ** number of bits specified by the integer in register P1.
@@ -1728,7 +1728,7 @@ case OP_Function: {
** If either input is NULL, the result is NULL. ** If either input is NULL, the result is NULL.
*/ */
/* Opcode: ShiftRight P1 P2 P3 * * /* Opcode: ShiftRight P1 P2 P3 * *
** Synopsis: r[P3]=r[P2]>>r[P1] ** Synopsis: r[P3]=r[P2]>>r[P1]
** **
** Shift the integer value in register P2 to the right by the ** Shift the integer value in register P2 to the right by the
** number of bits specified by the integer in register P1. ** number of bits specified by the integer in register P1.
@@ -1788,7 +1788,7 @@ case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */
} }
/* Opcode: AddImm P1 P2 * * * /* Opcode: AddImm P1 P2 * * *
** Synopsis: r[P1]=r[P1]+P2 ** Synopsis: r[P1]=r[P1]+P2
** **
** Add the constant P2 to the value in register P1. ** Add the constant P2 to the value in register P1.
** The result is always an integer. ** The result is always an integer.
@@ -1881,7 +1881,7 @@ case OP_Cast: { /* in1 */
#endif /* SQLITE_OMIT_CAST */ #endif /* SQLITE_OMIT_CAST */
/* Opcode: Eq P1 P2 P3 P4 P5 /* Opcode: Eq P1 P2 P3 P4 P5
** Synopsis: if r[P1]==r[P3] goto P2 ** Synopsis: IF r[P1]==r[P3]
** **
** Compare the values in register P1 and P3. If reg(P3)==reg(P1) then ** Compare the values in register P1 and P3. If reg(P3)==reg(P1) then
** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5, then ** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5, then
@@ -1915,7 +1915,7 @@ case OP_Cast: { /* in1 */
** content of r[P2] is only set to 1 (true) if it was not previously NULL. ** content of r[P2] is only set to 1 (true) if it was not previously NULL.
*/ */
/* Opcode: Ne P1 P2 P3 P4 P5 /* Opcode: Ne P1 P2 P3 P4 P5
** Synopsis: if r[P1]!=r[P3] goto P2 ** Synopsis: IF r[P1]!=r[P3]
** **
** This works just like the Eq opcode except that the jump is taken if ** This works just like the Eq opcode except that the jump is taken if
** the operands in registers P1 and P3 are not equal. See the Eq opcode for ** the operands in registers P1 and P3 are not equal. See the Eq opcode for
@@ -1925,7 +1925,7 @@ case OP_Cast: { /* in1 */
** content of r[P2] is only set to 0 (false) if it was not previously NULL. ** content of r[P2] is only set to 0 (false) if it was not previously NULL.
*/ */
/* Opcode: Lt P1 P2 P3 P4 P5 /* Opcode: Lt P1 P2 P3 P4 P5
** Synopsis: if r[P1]<r[P3] goto P2 ** Synopsis: IF r[P1]<r[P3]
** **
** Compare the values in register P1 and P3. If reg(P3)<reg(P1) then ** Compare the values in register P1 and P3. If reg(P3)<reg(P1) then
** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5 store ** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5 store
@@ -1954,21 +1954,21 @@ case OP_Cast: { /* in1 */
** strings and strings are considered less than blobs. ** strings and strings are considered less than blobs.
*/ */
/* Opcode: Le P1 P2 P3 P4 P5 /* Opcode: Le P1 P2 P3 P4 P5
** Synopsis: if r[P1]<=r[P3] goto P2 ** Synopsis: IF r[P1]<=r[P3]
** **
** This works just like the Lt opcode except that the jump is taken if ** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is less than or equal to the content of ** the content of register P3 is less than or equal to the content of
** register P1. See the Lt opcode for additional information. ** register P1. See the Lt opcode for additional information.
*/ */
/* Opcode: Gt P1 P2 P3 P4 P5 /* Opcode: Gt P1 P2 P3 P4 P5
** Synopsis: if r[P1]>r[P3] goto P2 ** Synopsis: IF r[P1]>r[P3]
** **
** This works just like the Lt opcode except that the jump is taken if ** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than the content of ** the content of register P3 is greater than the content of
** register P1. See the Lt opcode for additional information. ** register P1. See the Lt opcode for additional information.
*/ */
/* Opcode: Ge P1 P2 P3 P4 P5 /* Opcode: Ge P1 P2 P3 P4 P5
** Synopsis: if r[P1]>=r[P3] goto P2 ** Synopsis: IF r[P1]>=r[P3]
** **
** This works just like the Lt opcode except that the jump is taken if ** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than or equal to the content of ** the content of register P3 is greater than or equal to the content of
@@ -2370,7 +2370,7 @@ case OP_IfNot: { /* jump, in1 */
} }
/* Opcode: IsNull P1 P2 * * * /* Opcode: IsNull P1 P2 * * *
** Synopsis: if r[P1]==NULL goto P2 ** Synopsis: if r[P1]==NULL goto P2
** **
** Jump to P2 if the value in register P1 is NULL. ** Jump to P2 if the value in register P1 is NULL.
*/ */
@@ -2398,7 +2398,7 @@ case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */
} }
/* Opcode: Column P1 P2 P3 P4 P5 /* Opcode: Column P1 P2 P3 P4 P5
** Synopsis: r[P3]=PX ** Synopsis: r[P3]=PX
** **
** Interpret the data that cursor P1 points to as a structure built using ** Interpret the data that cursor P1 points to as a structure built using
** the MakeRecord instruction. (See the MakeRecord opcode for additional ** the MakeRecord instruction. (See the MakeRecord opcode for additional
@@ -4340,7 +4340,7 @@ case OP_NewRowid: { /* out2 */
** for indices is OP_IdxInsert. ** for indices is OP_IdxInsert.
*/ */
/* Opcode: InsertInt P1 P2 P3 P4 P5 /* Opcode: InsertInt P1 P2 P3 P4 P5
** Synopsis: intkey=P3 data=r[P2] ** Synopsis: intkey=P3 data=r[P2]
** **
** This works exactly like OP_Insert except that the key is the ** This works exactly like OP_Insert except that the key is the
** integer value P3, not the value of the integer stored in register P3. ** integer value P3, not the value of the integer stored in register P3.
@@ -4571,7 +4571,7 @@ case OP_ResetCount: {
} }
/* Opcode: SorterCompare P1 P2 P3 P4 /* Opcode: SorterCompare P1 P2 P3 P4
** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 ** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2
** **
** P1 is a sorter cursor. This instruction compares a prefix of the ** P1 is a sorter cursor. This instruction compares a prefix of the
** record blob in register P3 against a prefix of the entry that ** record blob in register P3 against a prefix of the entry that
@@ -5098,7 +5098,7 @@ case OP_IdxDelete: {
} }
/* Opcode: Seek P1 * P3 P4 * /* Opcode: Seek P1 * P3 P4 *
** Synopsis: Move P3 to P1.rowid ** Synopsis: Move P3 to P1.rowid
** **
** P1 is an open index cursor and P3 is a cursor on the corresponding ** P1 is an open index cursor and P3 is a cursor on the corresponding
** table. This opcode does a deferred seek of the P3 table cursor ** table. This opcode does a deferred seek of the P3 table cursor
@@ -5605,7 +5605,7 @@ case OP_IntegrityCk: {
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
/* Opcode: RowSetAdd P1 P2 * * * /* Opcode: RowSetAdd P1 P2 * * *
** Synopsis: rowset(P1)=r[P2] ** Synopsis: rowset(P1)=r[P2]
** **
** Insert the integer value held by register P2 into a boolean index ** Insert the integer value held by register P2 into a boolean index
** held in register P1. ** held in register P1.
@@ -5625,7 +5625,7 @@ case OP_RowSetAdd: { /* in1, in2 */
} }
/* Opcode: RowSetRead P1 P2 P3 * * /* Opcode: RowSetRead P1 P2 P3 * *
** Synopsis: r[P3]=rowset(P1) ** Synopsis: r[P3]=rowset(P1)
** **
** Extract the smallest value from boolean index P1 and put that value into ** Extract the smallest value from boolean index P1 and put that value into
** register P3. Or, if boolean index P1 is initially empty, leave P3 ** register P3. Or, if boolean index P1 is initially empty, leave P3
@@ -6804,7 +6804,7 @@ case OP_MaxPgcnt: { /* out2 */
/* Opcode: Init * P2 * P4 * /* Opcode: Init * P2 * P4 *
** Synopsis: Start at P2 ** Synopsis: Start at P2
** **
** Programs contain a single instance of this opcode as the very first ** Programs contain a single instance of this opcode as the very first
** opcode. ** opcode.

View File

@@ -1094,12 +1094,21 @@ static int displayComment(
const char *zSynopsis; const char *zSynopsis;
int nOpName; int nOpName;
int ii, jj; int ii, jj;
char zAlt[50];
zOpName = sqlite3OpcodeName(pOp->opcode); zOpName = sqlite3OpcodeName(pOp->opcode);
nOpName = sqlite3Strlen30(zOpName); nOpName = sqlite3Strlen30(zOpName);
if( zOpName[nOpName+1] ){ if( zOpName[nOpName+1] ){
int seenCom = 0; int seenCom = 0;
char c; char c;
zSynopsis = zOpName += nOpName + 1; zSynopsis = zOpName += nOpName + 1;
if( strncmp(zSynopsis,"IF ",3)==0 ){
if( pOp->p5 & SQLITE_STOREP2 ){
sqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3);
}else{
sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3);
}
zSynopsis = zAlt;
}
for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){ for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){
if( c=='P' ){ if( c=='P' ){
c = zSynopsis[++ii]; c = zSynopsis[++ii];