/ Check-in [a500893b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove a testcase() that is no longer reachable without the column cache. Provide an assert() to help prove that the testcase is no longer reachable.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | omit-column-cache
Files: files | file ages | folders
SHA3-256: a500893b6f64aced197cd32b79d51a481629a39d45dbcf0f02d65e5451ac4706
User & Date: drh 2018-08-04 20:12:10
Context
2018-08-04
20:30
Remove the column-cache from the code generator. The column-cache has been a persistent source of bugs for years and with recent improvements in the performance of OP_Column, it no longer provides a benefit. After the column cache is removed, the binary is almost 2KB smaller and the speed-check.sh performance test is over 3 million cycles faster. check-in: cdff3af7 user: drh tags: trunk
20:12
Remove a testcase() that is no longer reachable without the column cache. Provide an assert() to help prove that the testcase is no longer reachable. Closed-Leaf check-in: a500893b user: drh tags: omit-column-cache
17:15
Fix comments that were made obsolete by the removal of the column cache. check-in: 2041231d user: drh tags: omit-column-cache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  1908   1908   case OP_Gt:               /* same as TK_GT, jump, in1, in3 */
  1909   1909   case OP_Ge: {             /* same as TK_GE, jump, in1, in3 */
  1910   1910     int res, res2;      /* Result of the comparison of pIn1 against pIn3 */
  1911   1911     char affinity;      /* Affinity to use for comparison */
  1912   1912     u16 flags1;         /* Copy of initial value of pIn1->flags */
  1913   1913     u16 flags3;         /* Copy of initial value of pIn3->flags */
  1914   1914   
         1915  +  /* The only way for P1 and P3 to be the same is when comparing constants.
         1916  +  ** But in that case, the affinities will always be SQLITE_AFF_BLOB or none */
         1917  +  assert( pOp->p1!=pOp->p3 || (pOp->p5 & SQLITE_AFF_MASK)<=SQLITE_AFF_BLOB );
         1918  +  testcase( pOp->p1==pOp->p3 );
         1919  +
  1915   1920     pIn1 = &aMem[pOp->p1];
  1916   1921     pIn3 = &aMem[pOp->p3];
  1917   1922     flags1 = pIn1->flags;
  1918   1923     flags3 = pIn3->flags;
  1919   1924     if( (flags1 | flags3)&MEM_Null ){
  1920   1925       /* One or both operands are NULL */
  1921   1926       if( pOp->p5 & SQLITE_NULLEQ ){
................................................................................
  1955   1960     }else{
  1956   1961       /* Neither operand is NULL.  Do a comparison. */
  1957   1962       affinity = pOp->p5 & SQLITE_AFF_MASK;
  1958   1963       if( affinity>=SQLITE_AFF_NUMERIC ){
  1959   1964         if( (flags1 | flags3)&MEM_Str ){
  1960   1965           if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
  1961   1966             applyNumericAffinity(pIn1,0);
  1962         -          testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */
         1967  +          /* testcase( flags3!=pIn3->flags );
         1968  +          ** this used to be possible with pIn1==pIn3, but not since
         1969  +          ** the column cache was removed.  The following assignment
         1970  +          ** is essentially a no-op.  But, it prevents defense-in-depth
         1971  +          ** in case our analysis is incorrect, so it is left in. */
  1963   1972             flags3 = pIn3->flags;
  1964   1973           }
  1965   1974           if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
  1966   1975             applyNumericAffinity(pIn3,0);
  1967   1976           }
  1968   1977         }
  1969   1978         /* Handle the common case of integer comparison here, as an