A few more optimizations to the VDBE. (CVS 1204)
FossilOrigin-Name: 06e7ff4cb8c73fd690c6d5b5f530a30d83f4f10c
This commit is contained in:
parent
6810ce677d
commit
2c79c67fcb
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Rework\sinternal\sdata\sstructures\sto\smake\sthe\sVDBE\sabout\s15%\ssmaller.\s(CVS\s1203)
|
||||
D 2004-01-31T19:22:56
|
||||
C A\sfew\smore\soptimizations\sto\sthe\sVDBE.\s(CVS\s1204)
|
||||
D 2004-01-31T20:20:30
|
||||
F Makefile.in 0515ff9218ad8d5a8f6220f0494b8ef94c67013b
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -61,7 +61,7 @@ F src/trigger.c ce83e017b407d046e909d05373d7f8ee70f9f7f9
|
||||
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
|
||||
F src/util.c 64995b5949a5d377629ffd2598747bc771cade1e
|
||||
F src/vacuum.c 77485a64a6e4e358170f150fff681c1624a092b0
|
||||
F src/vdbe.c 36a93b5e213100b4c25ca614e69b74a5056154d6
|
||||
F src/vdbe.c cdfe403fca26d94d5dc4e71203430a9b4868f474
|
||||
F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43
|
||||
F src/vdbeInt.h 8a3baf749115cba81a810b7a52208aef055eda7b
|
||||
F src/vdbeaux.c c55d87d6658487e87ef09ca80c1aa2f314024fed
|
||||
@ -182,7 +182,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P c0faa1c67a967f028cd018e58988fb08bc814d3d
|
||||
R ee0cff331d148b843c9a28e532dc12e0
|
||||
P 8273c74bd09d1a044cb5154498b0a39939f6e3ed
|
||||
R 5979f6a29680231f50461ce8d475a67c
|
||||
U drh
|
||||
Z 9c3d28234884b5bb6cce05f45417ae61
|
||||
Z 0a73371f8b29d88670c381a23920fe41
|
||||
|
@ -1 +1 @@
|
||||
8273c74bd09d1a044cb5154498b0a39939f6e3ed
|
||||
06e7ff4cb8c73fd690c6d5b5f530a30d83f4f10c
|
70
src/vdbe.c
70
src/vdbe.c
@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.253 2004/01/31 19:22:56 drh Exp $
|
||||
** $Id: vdbe.c,v 1.254 2004/01/31 20:20:30 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -146,6 +146,7 @@ int sqlite_step(
|
||||
static int AggInsert(Agg *p, char *zKey, int nKey){
|
||||
AggElem *pElem, *pOld;
|
||||
int i;
|
||||
Mem *pMem;
|
||||
pElem = sqliteMalloc( sizeof(AggElem) + nKey +
|
||||
(p->nMem-1)*sizeof(pElem->aMem[0]) );
|
||||
if( pElem==0 ) return 1;
|
||||
@ -158,8 +159,8 @@ static int AggInsert(Agg *p, char *zKey, int nKey){
|
||||
sqliteFree(pOld);
|
||||
return 0;
|
||||
}
|
||||
for(i=0; i<p->nMem; i++){
|
||||
pElem->aMem[i].flags = MEM_Null;
|
||||
for(i=0, pMem=pElem->aMem; i<p->nMem; i++, pMem++){
|
||||
pMem->flags = MEM_Null;
|
||||
}
|
||||
p->pCurrent = pElem;
|
||||
return 0;
|
||||
@ -768,7 +769,6 @@ case OP_Pull: {
|
||||
int i;
|
||||
Mem ts;
|
||||
|
||||
/* Deephemeralize(pFrom); *** not needed */
|
||||
ts = *pFrom;
|
||||
Deephemeralize(pTos);
|
||||
for(i=0; i<pOp->p1; i++, pFrom++){
|
||||
@ -778,16 +778,13 @@ case OP_Pull: {
|
||||
if( pFrom->flags & MEM_Short ){
|
||||
assert( pFrom->flags & MEM_Str );
|
||||
assert( pFrom->z==pFrom[1].zShort );
|
||||
assert( (pTos->flags & (MEM_Dyn|MEM_Static|MEM_Ephem))==0 );
|
||||
pFrom->z = pFrom->zShort;
|
||||
}
|
||||
}
|
||||
*pTos = ts;
|
||||
/* assert( (pTos->flags & MEM_Ephem)==0 ); *** not needed */
|
||||
if( pTos->flags & MEM_Short ){
|
||||
assert( pTos->flags & MEM_Str );
|
||||
assert( pTos->z==pTos[-pOp->p1].zShort );
|
||||
assert( (pTos->flags & (MEM_Dyn|MEM_Static|MEM_Ephem))==0 );
|
||||
pTos->z = pTos->zShort;
|
||||
}
|
||||
break;
|
||||
@ -4253,9 +4250,7 @@ case OP_FileColumn: {
|
||||
*/
|
||||
case OP_MemStore: {
|
||||
int i = pOp->p1;
|
||||
char *zOld;
|
||||
Mem *pMem;
|
||||
int flags;
|
||||
assert( pTos>=p->aStack );
|
||||
if( i>=p->nMem ){
|
||||
int nOld = p->nMem;
|
||||
@ -4276,28 +4271,21 @@ case OP_MemStore: {
|
||||
memset(&p->aMem[nOld], 0, sizeof(p->aMem[0])*(p->nMem-nOld));
|
||||
}
|
||||
}
|
||||
Deephemeralize(pTos);
|
||||
pMem = &p->aMem[i];
|
||||
flags = pMem->flags;
|
||||
if( flags & MEM_Dyn ){
|
||||
zOld = pMem->z;
|
||||
}else{
|
||||
zOld = 0;
|
||||
}
|
||||
Release(pMem);
|
||||
*pMem = *pTos;
|
||||
flags = pMem->flags;
|
||||
if( flags & MEM_Dyn ){
|
||||
if( pMem->flags & MEM_Dyn ){
|
||||
if( pOp->p2 ){
|
||||
pTos->flags = MEM_Null;
|
||||
}else{
|
||||
/* OR: perhaps just make the stack ephermeral */
|
||||
pMem->z = sqliteMallocRaw( pMem->n );
|
||||
if( pMem->z==0 ) goto no_mem;
|
||||
memcpy(pMem->z, pTos->z, pMem->n);
|
||||
}
|
||||
}else if( flags & MEM_Short ){
|
||||
}else if( pMem->flags & MEM_Short ){
|
||||
pMem->z = pMem->zShort;
|
||||
}
|
||||
if( zOld ) sqliteFree(zOld);
|
||||
if( pOp->p2 ){
|
||||
Release(pTos);
|
||||
pTos--;
|
||||
@ -4466,27 +4454,19 @@ case OP_AggFocus: {
|
||||
*/
|
||||
case OP_AggSet: {
|
||||
AggElem *pFocus = AggInFocus(p->agg);
|
||||
Mem *pMem;
|
||||
int i = pOp->p2;
|
||||
assert( pTos>=p->aStack );
|
||||
if( pFocus==0 ) goto no_mem;
|
||||
assert( i>=0 );
|
||||
assert( i<p->agg.nMem );
|
||||
if( i<p->agg.nMem ){
|
||||
Mem *pMem = &pFocus->aMem[i];
|
||||
char *zOld;
|
||||
if( pMem->flags & MEM_Dyn ){
|
||||
zOld = pMem->z;
|
||||
}else{
|
||||
zOld = 0;
|
||||
}
|
||||
Deephemeralize(pTos);
|
||||
*pMem = *pTos;
|
||||
if( pMem->flags & MEM_Dyn ){
|
||||
pTos->flags = MEM_Null;
|
||||
}else if( pMem->flags & MEM_Short ){
|
||||
pMem->z = pMem->zShort;
|
||||
}
|
||||
if( zOld ) sqliteFree(zOld);
|
||||
assert( i>=0 && i<p->agg.nMem );
|
||||
Deephemeralize(pTos);
|
||||
pMem = &pFocus->aMem[i];
|
||||
Release(pMem);
|
||||
*pMem = *pTos;
|
||||
if( pMem->flags & MEM_Dyn ){
|
||||
pTos->flags = MEM_Null;
|
||||
}else if( pMem->flags & MEM_Short ){
|
||||
pMem->z = pMem->zShort;
|
||||
}
|
||||
Release(pTos);
|
||||
pTos--;
|
||||
@ -4501,17 +4481,15 @@ case OP_AggSet: {
|
||||
*/
|
||||
case OP_AggGet: {
|
||||
AggElem *pFocus = AggInFocus(p->agg);
|
||||
Mem *pMem;
|
||||
int i = pOp->p2;
|
||||
if( pFocus==0 ) goto no_mem;
|
||||
assert( i>=0 );
|
||||
assert( i>=0 && i<p->agg.nMem );
|
||||
pTos++;
|
||||
assert( i<p->agg.nMem );
|
||||
if( i<p->agg.nMem ){
|
||||
Mem *pMem = &pFocus->aMem[i];
|
||||
*pTos = *pMem;
|
||||
pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short);
|
||||
pTos->flags |= MEM_Ephem;
|
||||
}
|
||||
pMem = &pFocus->aMem[i];
|
||||
*pTos = *pMem;
|
||||
pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short);
|
||||
pTos->flags |= MEM_Ephem;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user