diff --git a/manifest b/manifest index 416c7b1394..079eb626a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\scomments\sand\sminor\srefactoring\sof\srowhash.c.\s(CVS\s6529) -D 2009-04-21T15:05:19 +C Allocate\sthe\sinitial\sRowHash\sobject\susing\slookaside.\s(CVS\s6530) +D 2009-04-21T16:15:15 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in fa5998fe08bd8c0fdc7f9f66cea16c0279f39da8 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -154,13 +154,13 @@ F src/prepare.c 72d74e6d3b9c8eb0663b33ec6438aa718096ac79 F src/printf.c ea2d76000cc5f4579d7e9cb2f5460433eec0d384 F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d -F src/rowhash.c c4ab59c04edf7de128e08e27dcb54f72bfbea9bc +F src/rowhash.c a62040abf905884c57d9a1e087287177d069b79a F src/rowset.c badb9f36b3a2ced9ee9551f4ce730f5fab442791 F src/select.c 35225756c247484f473678e5bd191d70a6e4dba0 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7 F src/sqlite.h.in 8e0e256079bac2319380bdfebf403fcbe630510f F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 15ae1158343bd4062424f70941c12c31fc4c0354 +F src/sqliteInt.h 0eb7cff7d38ae4e231aceaa45385862983a1fc5d F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d @@ -201,7 +201,7 @@ F src/update.c 8ededddcde6f7b6da981dd0429a5d34518a475b7 F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff F src/util.c 828c552a22a1d5b650b8a5ea0009546715c45d93 F src/vacuum.c 07121a727beeee88f27d704a00313ad6a7c9bef0 -F src/vdbe.c 6df1766d2c2961cf8224d935db57c4a6ec948481 +F src/vdbe.c 9d6ecf571858e801832b6d497cd92c15eff66152 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a F src/vdbeInt.h d3adfeccc750643ae7861f2d29f579d3dad28785 F src/vdbeapi.c 015c9d0fb7047657a13a7bb6aa886f75e43db02d @@ -721,7 +721,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 6f481ceb503c7df74d9417a5a7f019ff56261ea8 -R a4e163b71977e7fa78f31b9c9adb7e88 +P b8cb4f3e2473afaee7c147a6b3f0972f69391a9a +R 4386ce646d77f4430a63e54c18635ea7 U drh -Z 8c403435bade6e8de78fced09d0d2883 +Z ea8a74f2d1ab01bae74e5378e495aca7 diff --git a/manifest.uuid b/manifest.uuid index 8df6d3dd1c..0144fc6435 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b8cb4f3e2473afaee7c147a6b3f0972f69391a9a \ No newline at end of file +9b30ab7199d8b51bdea8ec7f0410281527623673 \ No newline at end of file diff --git a/src/rowhash.c b/src/rowhash.c index 35ddbbfc51..c1569ed297 100644 --- a/src/rowhash.c +++ b/src/rowhash.c @@ -31,7 +31,7 @@ ** The caller is responsible for insuring that there are no duplicate ** INSERTs. ** -** $Id: rowhash.c,v 1.2 2009/04/21 15:05:19 drh Exp $ +** $Id: rowhash.c,v 1.3 2009/04/21 16:15:15 drh Exp $ */ #include "sqliteInt.h" @@ -136,16 +136,14 @@ struct RowHashBlock { ** around and used as opaque handles by code in other modules. */ struct RowHash { - /* Variables populated by sqlite3RowhashInsert() */ - int nEntry; /* Number of used entries over all RowHashBlocks */ - RowHashBlock *pBlock; /* Linked list of RowHashBlocks */ - - /* Variables populated by makeHashTable() */ - int iBatch; /* The current insert batch number */ - int iMod; /* Number of buckets in hash table */ - int nHeight; /* Height of tree of hash pages */ - RowHashPage *pHash; /* Pointer to root of hash table tree */ - int nLinearLimit; /* Linear search limit (used if pHash==0) */ + int nEntry; /* Number of used entries over all RowHashBlocks */ + int iBatch; /* The current insert batch number */ + u8 nHeight; /* Height of tree of hash pages */ + u8 nLinearLimit; /* Linear search limit (used if pHash==0) */ + int nBucket; /* Number of buckets in hash table */ + RowHashPage *pHash; /* Pointer to root of hash table tree */ + RowHashBlock *pBlock; /* Linked list of RowHashBlocks */ + sqlite3 *db; /* Associated database connection */ }; @@ -205,7 +203,7 @@ static RowHashElem **findHashBucket(RowHash *pRowHash, i64 iVal){ int aOffset[16]; int n; RowHashPage *pPage = pRowHash->pHash; - int h = (((u64)iVal) % pRowHash->iMod); + int h = (((u64)iVal) % pRowHash->nBucket); assert( pRowHash->nHeight < sizeof(aOffset)/sizeof(aOffset[0]) ); for(n=0; nnHeight; n++){ @@ -233,7 +231,7 @@ static RowHashElem **findHashBucket(RowHash *pRowHash, i64 iVal){ */ static int makeHashTable(RowHash *p, int iBatch){ RowHashBlock *pBlock; - int iMod; + int nBucket; int nLeaf, n; /* Delete the old hash table. */ @@ -250,7 +248,7 @@ static int makeHashTable(RowHash *p, int iBatch){ /* Determine how many leaves the hash-table will comprise. */ nLeaf = 1 + (p->nEntry / (ROWHASH_POINTER_PER_PAGE*ROWHASH_COLLISION_LENGTH)); - p->iMod = iMod = nLeaf*ROWHASH_POINTER_PER_PAGE; + p->nBucket = nBucket = nLeaf*ROWHASH_POINTER_PER_PAGE; /* Set nHeight to the height of the tree that contains the leaf pages. If ** RowHash.nHeight is zero, then the whole hash-table fits on a single @@ -341,15 +339,16 @@ int sqlite3RowhashTest( ** Return SQLITE_OK if all goes as planned. If a malloc() fails, return ** SQLITE_NOMEM. */ -int sqlite3RowhashInsert(RowHash **pp, i64 iVal){ +int sqlite3RowhashInsert(sqlite3 *db, RowHash **pp, i64 iVal){ RowHash *p = *pp; /* If the RowHash structure has not been allocated, allocate it now. */ if( !p ){ - p = (RowHash*)sqlite3MallocZero(sizeof(RowHash)); + p = (RowHash*)sqlite3DbMallocZero(db, sizeof(RowHash)); if( !p ){ return SQLITE_NOMEM; } + p->db = db; *pp = p; } @@ -383,6 +382,6 @@ void sqlite3RowhashDestroy(RowHash *p){ pNext = pBlock->data.pNext; sqlite3_free(pBlock); } - sqlite3_free(p); + sqlite3DbFree(p->db, p); } } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 712d0191ed..fe2b893338 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.855 2009/04/21 09:02:47 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.856 2009/04/21 16:15:15 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -2402,7 +2402,7 @@ void sqlite3RowSetClear(RowSet*); void sqlite3RowSetInsert(RowSet*, i64); int sqlite3RowSetNext(RowSet*, i64*); -int sqlite3RowhashInsert(RowHash **pp, i64 iVal); +int sqlite3RowhashInsert(sqlite3*, RowHash **pp, i64 iVal); int sqlite3RowhashTest(RowHash *p, int iSet, i64 iVal, int *pExists); void sqlite3RowhashDestroy(RowHash *p); diff --git a/src/vdbe.c b/src/vdbe.c index 64760d392c..6f22d91481 100644 --- a/src/vdbe.c +++ b/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.834 2009/04/21 15:05:19 drh Exp $ +** $Id: vdbe.c,v 1.835 2009/04/21 16:15:15 drh Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -4647,7 +4647,7 @@ case OP_RowHash: { /* jump, in1, in3 */ } } if( iSet>=0 ){ - rc = sqlite3RowhashInsert(&pIn1->u.pRowHash, pIn3->u.i); + rc = sqlite3RowhashInsert(db, &pIn1->u.pRowHash, pIn3->u.i); } break; }