1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

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
This commit is contained in:
drh
2009-12-04 23:10:12 +00:00
parent 44a1d92050
commit 8e14c59611
3 changed files with 22 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 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(). 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-04T22:51:40 D 2009-12-04T23:10:13
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -169,7 +169,7 @@ F src/select.c 2f9ed7482e7a25b0b127fc41693bbdbe1caf5647
F src/shell.c f4948cb6d30665d755a6b5e0ec313d1094aab828 F src/shell.c f4948cb6d30665d755a6b5e0ec313d1094aab828
F src/sqlite.h.in 2d34605565e021851255e0bbcb15f8c1930d1f6f F src/sqlite.h.in 2d34605565e021851255e0bbcb15f8c1930d1f6f
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h f09be5c67f95f3d28d44e5b608b18cab28758ba4 F src/sqliteInt.h e946a6a3f2df015cdbc7668e9626987e8badbb5f
F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7 F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -779,14 +779,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 507890a9139875b1b594225c432c714f67312c0e P 04fc9c7661dd24d080f965e7eae9010a2d346e6a
R a9917927ecf932a5206784016c23ed7e R 012380c4025d7401ec31300c24d1a49d
U drh U drh
Z 46b355286c20c46db7bbe0e342865ca8 Z 3a60f929898567f03b13abb7e9741c72
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux) Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLGZJ/oxKgR168RlERAj8wAJ9G69y4b+LzPt4d3Ae0lzt3fJkTzQCcC1o7 iD8DBQFLGZbXoxKgR168RlERAgzLAKCGX83GaoDdnZtQhPjMOrZGC9L8TwCcC1Yk
UcWORVO4f1q8aqaDcPGdI60= V482pOMKKDD0UFm2zbfBJVE=
=Xm8G =H8qI
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
04fc9c7661dd24d080f965e7eae9010a2d346e6a 08faee686eb2fabe0dde51231ee55880e78541e8

View File

@@ -484,9 +484,19 @@ extern const int sqlite3one;
#define ROUNDDOWN8(x) ((x)&~7) #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.
*/ */
#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) # define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
#endif
/* /*