/ Check-in [32055623]
Login

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

Overview
Comment:Simplify the way the column cache is managed around OP_Move instructions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 320556233e19cdd9d590a09655c3465754700d39
User & Date: drh 2014-09-12 17:41:30
Context
2014-09-12
20:30
Small performance improvement to the dirty list handling in the pager. check-in: b332a84d user: drh tags: trunk
17:41
Simplify the way the column cache is managed around OP_Move instructions. check-in: 32055623 user: drh tags: trunk
04:28
Fix a problem with parser memory allocation on 32-bit systems. check-in: 2f69a1fa user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2428   2428   }
  2429   2429   
  2430   2430   /*
  2431   2431   ** Generate code to move content from registers iFrom...iFrom+nReg-1
  2432   2432   ** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
  2433   2433   */
  2434   2434   void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
  2435         -  int i;
  2436         -  struct yColCache *p;
  2437   2435     assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );
  2438   2436     sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
  2439         -  for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
  2440         -    int x = p->iReg;
  2441         -    if( x>=iFrom && x<iFrom+nReg ){
  2442         -      p->iReg += iTo-iFrom;
  2443         -    }
  2444         -  }
         2437  +  sqlite3ExprCacheRemove(pParse, iFrom, nReg);
  2445   2438   }
  2446   2439   
  2447   2440   #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
  2448   2441   /*
  2449   2442   ** Return true if any register in the range iFrom..iTo (inclusive)
  2450   2443   ** is used as part of the column cache.
  2451   2444   **

Changes to src/select.c.

   484    484       pParse->nMem += nBase;
   485    485     }
   486    486     sqlite3ExprCodeExprList(pParse, pSort->pOrderBy, regBase, SQLITE_ECEL_DUP);
   487    487     if( bSeq ){
   488    488       sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr);
   489    489     }
   490    490     if( nPrefixReg==0 ){
   491         -    sqlite3VdbeAddOp3(v, OP_Move, regData, regBase+nExpr+bSeq, nData);
          491  +    sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData);
   492    492     }
   493    493   
   494    494     sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regRecord);
   495    495     if( nOBSat>0 ){
   496    496       int regPrevKey;   /* The first nOBSat columns of the previous row */
   497    497       int addrFirst;    /* Address of the OP_IfNot opcode */
   498    498       int addrJmp;      /* Address of the OP_Jump opcode */
................................................................................
   520    520       addrJmp = sqlite3VdbeCurrentAddr(v);
   521    521       sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);
   522    522       pSort->labelBkOut = sqlite3VdbeMakeLabel(v);
   523    523       pSort->regReturn = ++pParse->nMem;
   524    524       sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);
   525    525       sqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor);
   526    526       sqlite3VdbeJumpHere(v, addrFirst);
   527         -    sqlite3VdbeAddOp3(v, OP_Move, regBase, regPrevKey, pSort->nOBSat);
          527  +    sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat);
   528    528       sqlite3VdbeJumpHere(v, addrJmp);
   529    529     }
   530    530     if( pSort->sortFlags & SORTFLAG_UseSorter ){
   531    531       op = OP_SorterInsert;
   532    532     }else{
   533    533       op = OP_IdxInsert;
   534    534     }