Back out the use of __sync_fetch_and_sub() as it does not appear to work.

FossilOrigin-Name: 4c2efd4239bf07eb4b92d4af54edd68ee6312670
This commit is contained in:
drh 2017-01-03 21:50:49 +00:00
parent 5c6b944d16
commit 7433ae5df6
5 changed files with 11 additions and 32 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\stypo\sin\sa\scomment.
D 2017-01-03T21:03:37.691
C Back\sout\sthe\suse\sof\s__sync_fetch_and_sub()\sas\sit\sdoes\snot\sappear\sto\swork.
D 2017-01-03T21:50:49.166
F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -354,7 +354,7 @@ F src/insert.c 91ba5d0143e66479081536ebbaff1850ec9f57d9
F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
F src/loadext.c 5d6642d141c07d366e43d359e94ec9de47add41d
F src/main.c e207b81542d13b9f13d61e78ca441f9781f055b0
F src/malloc.c 254c1cf31c2f3783bfe49dc8e7adde3c850f2289
F src/malloc.c f3fad34cd570022abca558c573f1761fb09a8212
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
@ -393,9 +393,9 @@ F src/shell.c 6095531aa900decdaa765e0f3993fba7153c92c1
F src/sqlite.h.in e8e2d108d82647f0a812fdb74accf91c1ec08ddc
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
F src/sqliteInt.h 7bfbca79001b3553d08a5884278e57696368a794
F src/sqliteInt.h f3450b70cfd99b434304225cf3b95de9cb4a9536
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
F src/status.c 1b1e64fbce135bc178a6481433422a32f433ba37
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
F src/tclsqlite.c 205c66b9b81d97978a155caa3ef5be9c4de2b174
F src/test1.c 8a98191a1da8e100f77cdb5cc716df67d405028d
@ -1541,7 +1541,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f8ebeec211483503e135104ef977b3c384a1d789
R f0ff94e8e63c383f0258ddac073c3711
P ae087123db8e7d47b25a8d0a98cfd62e85e42fc6
Q -f69ce75b3d94331fdbfa2f3a27d61db24c285d2b
R 4be5114c40ec1b8757eebb3b6a7e4284
U drh
Z daa7f757074b48f5fb7e720dfd32b54f
Z 7a47fa67b122b20ade3d4fbc1714217d

View File

@ -1 +1 @@
ae087123db8e7d47b25a8d0a98cfd62e85e42fc6
4c2efd4239bf07eb4b92d4af54edd68ee6312670

View File

@ -376,16 +376,12 @@ void sqlite3ScratchFree(void *p){
sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
if( sqlite3GlobalConfig.bMemstat ){
int iSize = sqlite3MallocSize(p);
#ifndef SQLITE_ATOMIC_STATUS_DOWN
sqlite3_mutex_enter(mem0.mutex);
#endif
sqlite3StatusDown(SQLITE_STATUS_SCRATCH_OVERFLOW, iSize);
sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, iSize);
sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);
sqlite3GlobalConfig.m.xFree(p);
#ifndef SQLITE_ATOMIC_STATUS_DOWN
sqlite3_mutex_leave(mem0.mutex);
#endif
}else{
sqlite3GlobalConfig.m.xFree(p);
}
@ -444,15 +440,11 @@ void sqlite3_free(void *p){
assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
if( sqlite3GlobalConfig.bMemstat ){
#ifndef SQLITE_ATOMIC_STATUS_DOWN
sqlite3_mutex_enter(mem0.mutex);
#endif
sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, sqlite3MallocSize(p));
sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);
sqlite3GlobalConfig.m.xFree(p);
#ifndef SQLITE_ATOMIC_STATUS_DOWN
sqlite3_mutex_leave(mem0.mutex);
#endif
}else{
sqlite3GlobalConfig.m.xFree(p);
}

View File

@ -236,15 +236,6 @@
# define SQLITE_NOINLINE
#endif
/*
** The SQLITE_ATOMIC_STATUS_DOWN macro is defined if and only if
** the sqlite3StatusDown() function is threadsafe.
*/
#if !defined(SQLITE_DISABLE_INTRINSIC) \
&& (GCC_VERSION>=4004000 || CLANG_VERSION>=3000000)
# define SQLITE_ATOMIC_STATUS_DOWN 1
#endif
/*
** Make sure that the compiler intrinsics we desire are enabled when
** compiling with an appropriate version of MSVC unless prevented by

View File

@ -100,16 +100,11 @@ void sqlite3StatusUp(int op, int N){
void sqlite3StatusDown(int op, int N){
wsdStatInit;
assert( N>=0 );
assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
#if !defined(SQLITE_DISABLE_INTRINSIC) \
&& (GCC_VERSION>=4004000 || CLANG_VERSION>=3000000)
(void)__sync_fetch_and_sub(&wsdStat.nowValue[op], N);
#else
assert( op>=0 && op<ArraySize(statMutex) );
assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()
: sqlite3MallocMutex()) );
assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
wsdStat.nowValue[op] -= N;
#endif
}
/*