Allow size for malloc-only registration

Encode malloc-only allocations with an odd size field.

These are treated similarly to the prior treatment of zero size
objects, except that:

- Huge allocations cause more frequent mallinfo() checks.
- The sizes are stored, and hence available to ahat and friends.

Add public factory methods to hide the negative size representation
and provide a slightly easier-to-describe-and-use API.

Add registerNativeAllocation(long) and registerNativeFree(long)
methods to VMRuntime to avoid enshrining the obsolete ones in the
platform API. Unfortunately we need to retain the old ones for
compatibility, at least for now.

See also ag/6235934 .

Bug: 121304803
Test: build and boot AOSP
Change-Id: Idccb8b50d26c8c3e93cc34040d784f74dfcdbf51
6 files changed