Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When pinning a temp register after it is reused by the column cache, make sure all instances of that register in the cache are pinned so that the register is never reused for a different purpose. Ticket #3879. (CVS 6676) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 5f358e63712e8de93bd6fecc5131bade |
User & Date: | drh 2009-05-25 11:46:29 |
Context
2009-05-25
| ||
14:17 | Fix the rtree test module so that it works even if the ext/ subfolder is omitted from the tree. (CVS 6679) check-in: 086206e1 user: drh tags: trunk | |
11:46 | When pinning a temp register after it is reused by the column cache, make sure all instances of that register in the cache are pinned so that the register is never reused for a different purpose. Ticket #3879. (CVS 6676) check-in: 5f358e63 user: drh tags: trunk | |
11:46 | Add a test case for ticket #3879. (CVS 6675) check-in: 5b9b66f4 user: danielk1977 tags: trunk | |
Changes
Changes to src/expr.c.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .... 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 .... 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** ** $Id: expr.c,v 1.435 2009/05/21 20:41:32 drh Exp $ */ #include "sqliteInt.h" /* ** Return the 'affinity' of the expression pExpr if any. ** ** If pExpr is a column, a reference to a column via an 'AS' alias, ................................................................................ for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ if( p->iReg && p->iLevel>pParse->iCacheLevel ){ cacheEntryClear(pParse, p); p->iReg = 0; } } } /* ** Generate code that will extract the iColumn-th column from ** table pTab and store the column value in a register. An effort ** is made to store the column value in register iReg, but this is ** not guaranteed. The location of the column value is returned. ** ................................................................................ if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn && (!p->affChange || allowAffChng) ){ #if 0 sqlite3VdbeAddOp0(v, OP_Noop); VdbeComment((v, "OPT: tab%d.col%d -> r%d", iTable, iColumn, p->iReg)); #endif p->lru = pParse->iCacheCnt++; p->tempReg = 0; /* This pins the register, but also leaks it */ return p->iReg; } } assert( v!=0 ); if( iColumn<0 ){ sqlite3VdbeAddOp2(v, OP_Rowid, iTable, iReg); }else if( pTab==0 ){ |
| > > > > > > > > > > > > > > > > | |
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .... 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 .... 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 |
** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** ** $Id: expr.c,v 1.436 2009/05/25 11:46:29 drh Exp $ */ #include "sqliteInt.h" /* ** Return the 'affinity' of the expression pExpr if any. ** ** If pExpr is a column, a reference to a column via an 'AS' alias, ................................................................................ for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ if( p->iReg && p->iLevel>pParse->iCacheLevel ){ cacheEntryClear(pParse, p); p->iReg = 0; } } } /* ** When a cached column is reused, make sure that its register is ** no longer available as a temp register. ticket #3879: that same ** register might be in the cache in multiple places, so be sure to ** get them all. */ static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){ int i; struct yColCache *p; for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ if( p->iReg==iReg ){ p->tempReg = 0; } } } /* ** Generate code that will extract the iColumn-th column from ** table pTab and store the column value in a register. An effort ** is made to store the column value in register iReg, but this is ** not guaranteed. The location of the column value is returned. ** ................................................................................ if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn && (!p->affChange || allowAffChng) ){ #if 0 sqlite3VdbeAddOp0(v, OP_Noop); VdbeComment((v, "OPT: tab%d.col%d -> r%d", iTable, iColumn, p->iReg)); #endif p->lru = pParse->iCacheCnt++; sqlite3ExprCachePinRegister(pParse, p->iReg); return p->iReg; } } assert( v!=0 ); if( iColumn<0 ){ sqlite3VdbeAddOp2(v, OP_Rowid, iTable, iReg); }else if( pTab==0 ){ |