OSDN Git Service

Fix computation of primitive array widths.
authorAndy McFadden <fadden@android.com>
Wed, 22 Sep 2010 19:13:29 +0000 (12:13 -0700)
committerAndy McFadden <fadden@android.com>
Wed, 22 Sep 2010 19:13:29 +0000 (12:13 -0700)
commit34f91a12d8ac8cd6c0b36dec5b927f63c076f14e
tree8ce3a07277988b04abeae8dae0697e9a4cb0f5b5
parent4abedd83f88c84fae2a92b15c96709801203e9a8
Fix computation of primitive array widths.

The code was comparing class pointers, but the class objects for arrays
of primitives are initialized on demand.  If the class wasn't yet
instantiated, the array width code was returning a default value of 4.
This meant the "write values to an array of longs through the unsafe
methods" code was actually scribbling on the wrong part of the array,
which went unnoticed until recently.  (The new-ish ldrexd/strexd code
requires 64-bit alignment.)

We now use the existing array element width computation function.  The
code needed a bit of rearranging since it expected an instance of the
class rather than the class.

Bug 3023981.

Change-Id: I51462978362b6a4fce26e13eda17e1bbc0eac192
vm/native/sun_misc_Unsafe.c
vm/oo/Array.c
vm/oo/Array.h