From: drh Date: Fri, 4 Dec 2009 23:10:12 +0000 (+0000) Subject: Add the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option which tells some X-Git-Tag: version-3.7.2~748 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e14c59611b1347a2efa72be53fbd87fbf29c36f;p=thirdparty%2Fsqlite.git Add the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option which tells some assert() statements that the underlying system only requires 4-byte alignment of 8-byte data objects like double or int64 and that system malloc() only guarantees 4-byte alignment of returned pointers. FossilOrigin-Name: 08faee686eb2fabe0dde51231ee55880e78541e8 --- diff --git a/manifest b/manifest index 9db31c4d22..29711c9436 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Remove\san\sassert()\sin\sbtree.c:releasePage()\sthat\sis\snot\snecessarily\strue\nwhen\sthe\sbtree\sis\srecovering\sfrom\san\sOOM\sthat\soccurs\sin\sthe\smiddle\sof\na\sbalance(). -D 2009-12-04T22:51:40 +C Add\sthe\sSQLITE_4_BYTE_ALIGNED_MALLOC\scompile-time\soption\swhich\stells\ssome\nassert()\sstatements\sthat\sthe\sunderlying\ssystem\sonly\srequires\s4-byte\salignment\nof\s8-byte\sdata\sobjects\slike\sdouble\sor\sint64\sand\sthat\ssystem\smalloc()\sonly\nguarantees\s4-byte\salignment\sof\sreturned\spointers. +D 2009-12-04T23:10:13 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -169,7 +169,7 @@ F src/select.c 2f9ed7482e7a25b0b127fc41693bbdbe1caf5647 F src/shell.c f4948cb6d30665d755a6b5e0ec313d1094aab828 F src/sqlite.h.in 2d34605565e021851255e0bbcb15f8c1930d1f6f F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 -F src/sqliteInt.h f09be5c67f95f3d28d44e5b608b18cab28758ba4 +F src/sqliteInt.h e946a6a3f2df015cdbc7668e9626987e8badbb5f F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -779,14 +779,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 507890a9139875b1b594225c432c714f67312c0e -R a9917927ecf932a5206784016c23ed7e +P 04fc9c7661dd24d080f965e7eae9010a2d346e6a +R 012380c4025d7401ec31300c24d1a49d U drh -Z 46b355286c20c46db7bbe0e342865ca8 +Z 3a60f929898567f03b13abb7e9741c72 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLGZJ/oxKgR168RlERAj8wAJ9G69y4b+LzPt4d3Ae0lzt3fJkTzQCcC1o7 -UcWORVO4f1q8aqaDcPGdI60= -=Xm8G +iD8DBQFLGZbXoxKgR168RlERAgzLAKCGX83GaoDdnZtQhPjMOrZGC9L8TwCcC1Yk +V482pOMKKDD0UFm2zbfBJVE= +=H8qI -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 223123aab3..86acda274a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -04fc9c7661dd24d080f965e7eae9010a2d346e6a \ No newline at end of file +08faee686eb2fabe0dde51231ee55880e78541e8 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index aae1c3c663..1202971a84 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -484,9 +484,19 @@ extern const int sqlite3one; #define ROUNDDOWN8(x) ((x)&~7) /* -** Assert that the pointer X is aligned to an 8-byte boundary. +** Assert that the pointer X is aligned to an 8-byte boundary. This +** macro is used only within assert() to verify that the code gets +** all alignment restrictions correct. +** +** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the +** underlying malloc() implemention might return us 4-byte aligned +** pointers. In that case, only verify 4-byte alignment. */ -#define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) +#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC +# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0) +#else +# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) +#endif /*