aboutsummaryrefslogtreecommitdiff
path: root/vm/compiler/codegen/arm/LocalOptimizations.c
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2011-02-02 16:55:41 -0800
committerAndy McFadden <fadden@android.com>2011-02-04 15:54:59 -0800
commitd6e32b8147f26a32059ae86abc5f8e5c0ef92ac1 (patch)
tree053397a2a4a4a8061f28de78a4d1817da91c399b /vm/compiler/codegen/arm/LocalOptimizations.c
parent13a0e7b2e9b4cd0eb09a3cfa156b82e11671e116 (diff)
Ensure word atomicity in System.arraycopy
The VM needs to ensure that updates to 16-bit and 32-bit fields and array elements happen atomically. System.arraycopy was calling memmmove(), which in bionic happens to copy a byte at a time. The new plan is to have bionic provide a platform-optimized memmove variant that makes guarantees about word sizes. If it is not present (either because it hasn't been written for the current platform, or we're not linking against bionic), we will use a trivial copy loop. We assume that the memmove-by-word implementation does whatever it needs to for best performance. For example, if the function determines that memcpy() is word-safe and will be faster, it can call that. The VM no longer makes assumptions about the internal workings of libc functions. I also rearranged the code to avoid making indirect calls, reading function addresses from memory, and using integer multiplication instructions when a simple shift will do. (gcc now generates the whole thing as one function.) Also, added some primitive array copy tests to 011-array-copy. Bug 3398352 Change-Id: I4677ee1c87998697a93e61f39a48b3f391e8e11b
Diffstat (limited to 'vm/compiler/codegen/arm/LocalOptimizations.c')
0 files changed, 0 insertions, 0 deletions