diff --git a/manifest b/manifest index c106e26357..52ea7d278e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\san\sunreachable\sbranch\sinto\san\sassert()\sin\ssqlite3PagerAcquire()\nand\soptimize\ssqlite3PcacheOpenSavepoint()\sby\sfactoring\sout\srarely\sused\scode\ninto\sa\ssubroutine. -D 2015-06-30T11:07:32.245 +C Make\suse\sof\sbuilt-in\sbswap32()\sand\sbswap16()\sfunctions\sin\sGCC/Clang\sfor\sa\nsignificant\sperformance\simprovement\sthere. +D 2015-06-30T15:10:29.855 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -269,9 +269,9 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3 F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 08ae64b0387e72b8201981a2d7b0f58b92fdff29 +F src/btree.c 3a535c0118872c3ee4e198b80a62d09315381dab F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1 -F src/btreeInt.h e4eabc722b1ae017ac9c266a75769d4c6a9afde6 +F src/btreeInt.h 64b5723d8410a1f02c94d99c46b1b74cd547e6ef F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f @@ -332,7 +332,7 @@ F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7 F src/sqlite.h.in 76d2f5637eb795b6300d9dd3c3ec3632ffafd721 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066 -F src/sqliteInt.h 89768198547bdd70a160e47643a0e493f711e8d0 +F src/sqliteInt.h cf643b5a34633de5d4703eba1e2b1a205af53c8a F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@ -388,7 +388,7 @@ F src/treeview.c c84b1a8ebc7f1d00cd76ce4958eeb3ae1021beed F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f F src/update.c 487747b328b7216bb7f6af0695d6937d5c9e605f F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c -F src/util.c a5471ac4834ca3abe9c569745700d3f4dd5f5574 +F src/util.c 89bfe78b4610d456ba431a0865309a20acc115f3 F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 F src/vdbe.c 5ee4a2bf871418f61d06dc256b9b3a0084b5ec46 F src/vdbe.h 7a75045d879118b9d3af7e8b3c108f2f27c51473 @@ -1364,7 +1364,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d9a0481ce0fd9824b1566f182d68ec46ef091b1b -R 24b6e6de7d9b089958239ab689d72050 +P b406b20ecdf0bff63c5c222fab11cb9acee86765 ce8177e3e64d2ac4cd5d9e7757cdd5fcecd7d0ea +R e9f634c6724f1e6a3b5c72453520bbb0 +T +closed ce8177e3e64d2ac4cd5d9e7757cdd5fcecd7d0ea U drh -Z 9400732c29ac033e0975f1d6b596266c +Z 3fa235f76195131887feff91c1f8744e diff --git a/manifest.uuid b/manifest.uuid index bc33da0418..c16cd14878 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b406b20ecdf0bff63c5c222fab11cb9acee86765 \ No newline at end of file +8bfcda3d10aec864d71d12a1248c37e4db6f8899 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index ef2a861528..fe2c067db2 100644 --- a/src/btree.c +++ b/src/btree.c @@ -971,9 +971,9 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ ** This routine works only for pages that do not contain overflow cells. */ #define findCell(P,I) \ - ((P)->aData + ((P)->maskPage & get2byte(&(P)->aCellIdx[2*(I)]))) + ((P)->aData + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)]))) #define findCellPastPtr(P,I) \ - ((P)->aDataOfst + ((P)->maskPage & get2byte(&(P)->aCellIdx[2*(I)]))) + ((P)->aDataOfst + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)]))) /* @@ -1754,7 +1754,7 @@ static int btreeInitPage(MemPage *pPage){ if( !pPage->leaf ) iCellLast--; for(i=0; inCell; i++){ - pc = get2byte(&data[cellOffset+i*2]); + pc = get2byteAligned(&data[cellOffset+i*2]); testcase( pc==iCellFirst ); testcase( pc==iCellLast ); if( pciCellLast ){ @@ -6625,7 +6625,7 @@ static int editPage( #ifdef SQLITE_DEBUG for(i=0; iapCell[i+iNew]; - int iOff = get2byte(&pPg->aCellIdx[i*2]); + int iOff = get2byteAligned(&pPg->aCellIdx[i*2]); if( pCell>=aData && pCell<&aData[pPg->pBt->usableSize] ){ pCell = &pTmp[pCell - aData]; } @@ -7127,7 +7127,7 @@ static int balance_nonroot( memset(&b.szCell[b.nCell+limit], 0, sizeof(b.szCell[0])*pOld->nOverflow); limit = pOld->aiOvfl[0]; for(j=0; jcellOffset + 2*pOld->nCell; while( piCellxCellSize(pPage, &data[pc]); diff --git a/src/btreeInt.h b/src/btreeInt.h index 92a4d44692..74117848ac 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -691,3 +691,16 @@ struct IntegrityCk { #define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v)) #define get4byte sqlite3Get4byte #define put4byte sqlite3Put4byte + +/* +** get2byteAligned(), unlike get2byte(), requires that its argument point to a +** two-byte aligned address. get2bytea() is only used for accessing the +** cell addresses in a btree header. +*/ +#if SQLITE_BYTEORDER==4321 +# define get2byteAligned(x) (*(u16*)(x)) +#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4008000 +# define get2byteAligned(x) __builtin_bswap16(*(u16*)(x)) +#else +# define get2byteAligned(x) ((x)[0]<<8 | (x)[1]) +#endif diff --git a/src/sqliteInt.h b/src/sqliteInt.h index aed6557cdb..907434889d 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -60,6 +60,13 @@ # define _LARGEFILE_SOURCE 1 #endif +/* What version of GCC is being used. 0 means GCC is not being used */ +#ifdef __GNUC__ +# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__) +#else +# define GCC_VERSION 0 +#endif + /* Needed for various definitions... */ #if defined(__GNUC__) && !defined(_GNU_SOURCE) # define _GNU_SOURCE diff --git a/src/util.c b/src/util.c index 8fdaf26785..4e029b0e01 100644 --- a/src/util.c +++ b/src/util.c @@ -1078,14 +1078,31 @@ int sqlite3VarintLen(u64 v){ ** Read or write a four-byte big-endian integer value. */ u32 sqlite3Get4byte(const u8 *p){ +#if SQLITE_BYTEORDER==4321 + u32 x; + memcpy(&x,p,4); + return x; +#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) + u32 x; + memcpy(&x,p,4); + return __builtin_bswap32(x); +#else testcase( p[0]&0x80 ); return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3]; +#endif } void sqlite3Put4byte(unsigned char *p, u32 v){ +#if SQLITE_BYTEORDER==4321 + memcpy(p,&v,4); +#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) + u32 x = __builtin_bswap32(v); + memcpy(p,&x,4); +#else p[0] = (u8)(v>>24); p[1] = (u8)(v>>16); p[2] = (u8)(v>>8); p[3] = (u8)v; +#endif }