diff options
author | Ian Rogers <irogers@google.com> | 2014-02-27 17:01:55 -0800 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-02-28 17:39:53 -0800 |
commit | 10af76d5af1d87686ff9ab8d00f3dadc15a84fb7 (patch) | |
tree | 9379ee44171cd5bc848ea5d0854b3cda5e5787da /libart/src | |
parent | 25f9a3d57eeddd56d86f84c2bd27027b8e91d591 (diff) | |
download | libcore-10af76d5af1d87686ff9ab8d00f3dadc15a84fb7.zip libcore-10af76d5af1d87686ff9ab8d00f3dadc15a84fb7.tar.gz libcore-10af76d5af1d87686ff9ab8d00f3dadc15a84fb7.tar.bz2 |
Add unpadded array allocations.
Unpadded array allocations avoid unused bytes following arrays. API conventions
follow those of newNonMovableArray.
Dalvik implementation assume dlmalloc allocation properties, ART implementation
is handled by resizing the array post-allocation:
https://android-review.googlesource.com/83670
Add VMRuntimeTest to check the properties of the array allocation routines.
Change java.lang.reflect.Array.newInstance to compare more probable array types
before less probable ones.
Bug: 13028925.
Change-Id: Icf6bfb1aa5ad4faa062b393082c689b6118a84b5
Diffstat (limited to 'libart/src')
-rw-r--r-- | libart/src/main/java/dalvik/system/VMRuntime.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java index 39cd326..7bbb93e 100644 --- a/libart/src/main/java/dalvik/system/VMRuntime.java +++ b/libart/src/main/java/dalvik/system/VMRuntime.java @@ -223,6 +223,13 @@ public final class VMRuntime { public native Object newNonMovableArray(Class<?> componentType, int length); /** + * Returns an array of at least minLength, but potentially larger. The increased size comes from + * avoiding any padding after the array. The amount of padding varies depending on the + * componentType and the memory allocator implementation. + */ + public native Object newUnpaddedArray(Class<?> componentType, int minLength); + + /** * Returns the address of array[0]. This differs from using JNI in that JNI might lie and * give you the address of a copy of the array when in forcecopy mode. */ |