corda/src
Joshua Warner ba9b85f7c3 fix concurrency bugs on ios+arm64 in enter
At first, it might look like the atomicIncrement operations here,
since they resolve to OSAtomicCompareAndSwap32Barrier, ought to
provide all the memory barrier guarantees we need; however, it turns
out it's not quite sufficient.

Here's why: Apple's OSAtomic*Barrier operations guarantee that memory
operations *before* the atomic op won't be reordered with memory
operations *after* the atomic op - but makes no guarantee that the
atomic op itself won't be reordered with other operations before or
after it.  The key is that the atomic operation is not really atomic,
but rather consists of separate read, check and write steps - in a
loop, no less.  Here, presumably, the read of t->m->exclusive is
hoisted by the out-of-order processor to between the read and write
steps of the "atomic" increment of t->m->activeCount.

Longer term, it probably makes sense to replace this with the c11
<stdatomic.h> operations or the c++11 <atomic> types.  We ought to
actually use the atomic increment operations provided there.  As it
is, our atomicIncrement looks substantially less efficient than those,
since it's actually implemented on arm64 as two nested loops (one in
atomicIncrement and one in the compare-and-swap) instead of one.  We
should also evaluate whether the various instances of atomic
operations actually need as strong of barriers as we're giving them.

FWIW, the gcc __sync_* builtins seem to have the same problem, at
least on arm64.
2015-05-07 13:25:07 -06:00
..
android fix SSL stack and Android JAR resource loading 2014-08-22 07:20:19 -06:00
avian Merge pull request #431 from joshuawarner32/all-heapdump 2015-05-04 08:01:03 -06:00
codegen don't use x18 on arm64, where it's a reserved 'platform' register 2015-05-01 13:44:44 -06:00
heap update copyright years 2015-03-13 12:52:59 -06:00
lzma fix clang "always true" warning in lzma/main.cpp 2014-08-11 08:40:08 -06:00
openjdk update copyright years 2015-03-13 12:52:59 -06:00
system use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
tools fix unsigned->size_t build regression 2015-05-04 09:59:49 -06:00
util update copyright years 2015-03-13 12:52:59 -06:00
arm64.S update copyright years 2015-03-13 12:52:59 -06:00
arm.masm update copyright years 2015-03-13 12:52:59 -06:00
arm.S update copyright years 2015-03-13 12:52:59 -06:00
boot-javahome.cpp use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
boot.cpp use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
bootimage-fields.cpp bulk, global reformat 2014-07-11 13:25:22 -06:00
bootimage-template.cpp bulk, global reformat 2014-07-11 13:25:22 -06:00
builtin.cpp always include heapdump code, to eliminate one dimension of the build matrix 2015-05-01 20:11:11 -06:00
classpath-android.cpp update copyright years 2015-03-13 12:52:59 -06:00
classpath-avian.cpp update copyright years 2015-03-13 12:52:59 -06:00
classpath-openjdk.cpp fix openjdk build after finder size_t change 2015-05-03 13:25:22 -06:00
CMakeLists.txt add initial cmake script (only builds parts of the code) 2014-07-24 09:36:40 -06:00
compile-arm64.S update copyright years 2015-03-13 12:52:59 -06:00
compile-arm.masm update copyright years 2015-03-13 12:52:59 -06:00
compile-arm.S update copyright years 2015-03-13 12:52:59 -06:00
compile-i386.masm update copyright years 2015-03-13 12:52:59 -06:00
compile-i386.S update copyright years 2015-03-13 12:52:59 -06:00
compile-x86_64.S update copyright years 2015-03-13 12:52:59 -06:00
compile.cpp fix new clang warnings (from upgrading clang) 2015-05-01 13:44:21 -06:00
continuations-x86.S update copyright years 2015-03-13 12:52:59 -06:00
debug-util.cpp touch up type safety in types.def 2014-07-11 13:25:20 -06:00
debug-util.h add debug-util for printing java bytecode as it's compiled 2014-05-30 23:40:21 -06:00
embed.cpp update copyright years 2015-03-13 12:52:59 -06:00
embedded-loader.cpp update copyright years 2015-03-13 12:52:59 -06:00
finder.cpp use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
heapdump.cpp update copyright years 2015-03-13 12:52:59 -06:00
heapwalk.cpp update copyright years 2015-03-13 12:52:59 -06:00
i386.masm update copyright years 2015-03-13 12:52:59 -06:00
i386.S update copyright years 2015-03-13 12:52:59 -06:00
interpret.cpp update copyright years 2015-03-13 12:52:59 -06:00
jnienv.cpp update copyright years 2015-03-13 12:52:59 -06:00
lzma-decode.cpp use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
lzma-encode.cpp fix unsigned->size_t build regression 2015-05-04 09:59:49 -06:00
machine.cpp fix concurrency bugs on ios+arm64 in enter 2015-05-07 13:25:07 -06:00
main.cpp use size_t instead of unsigned in a bunch of appropriate places 2015-03-16 16:28:20 -06:00
powerpc-regs.S enable Linux PowerPC build 2011-02-26 12:45:22 -07:00
process.cpp update copyright years 2015-03-13 12:52:59 -06:00
thunks.cpp add util.cpp/.h changes 2014-07-11 13:25:19 -06:00
types.def fix Android thread enumeration 2014-08-22 16:07:44 -06:00
util.cpp update copyright years 2015-03-13 12:52:59 -06:00
x86_64.S update copyright years 2015-03-13 12:52:59 -06:00