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