OSDN Git Service
Mathieu Chartier [Tue, 2 Dec 2014 23:43:48 +0000 (15:43 -0800)]
Print memory usage in dex2oat shutdown
Example on mako:
I/dex2oat (31071): dex2oat took 31.195s (threads: 2) arena alloc=1013KB java alloc=13MB native alloc=32MB free=1490KB
Bug:
18069309
Change-Id: I08eac00842be35d4e659bddc8513f2062be725c9
Vladimir Marko [Tue, 2 Dec 2014 16:50:54 +0000 (16:50 +0000)]
Merge "Quick: Fix neg-long on ARM for overlapping regs." into lmp-mr1-dev
Sebastien Hertz [Tue, 2 Dec 2014 16:39:09 +0000 (16:39 +0000)]
Merge "JDWP: only deoptimize when it is required" into lmp-mr1-dev
Mathieu Chartier [Tue, 2 Dec 2014 00:57:21 +0000 (00:57 +0000)]
Merge "Try normal allocation if large object allocation fails" into lmp-mr1-dev
Mathieu Chartier [Mon, 1 Dec 2014 23:00:27 +0000 (15:00 -0800)]
Try normal allocation if large object allocation fails
If a large object allocation fails, we now try the normal allocators.
Bug:
18504942
Change-Id: I18b9759d6af885556941542c57fec584f18197f1
Mathieu Chartier [Mon, 1 Dec 2014 21:40:48 +0000 (13:40 -0800)]
Fix growth limit / footprint limit problems
We now properly clear the growth limit of all the spaces when
ClearGrowthLimit is called. Previously we didn't clear the growth
limit of the background space.
This wasn't caught by heap test since it only manifested itself
when we had a zygote space.
Bug:
18504942
Change-Id: Ibb3d76cba54a45ef755d7e2ced8c2e16cd2996b0
Mathieu Chartier [Mon, 1 Dec 2014 18:31:15 +0000 (10:31 -0800)]
Set dex_cache_strings_ when we call Class::SetDexCache
Ensures that these two variables never get out of sync. The error
was presumably related to not doing this for proxy classes. This
caused java code which was looking at the dex_cache_strings_ field
to incorrectly access a null array.
Bug:
18548887
Change-Id: If53c6ade3588b82a480d6674dfbd5caa2e5069fd
Vladimir Marko [Mon, 1 Dec 2014 16:48:48 +0000 (16:48 +0000)]
Quick: Fix neg-long on ARM for overlapping regs.
Bug:
18569347
(cherry picked from commit
2f340a843ea5b3413c901f8c2365243b68864468)
Change-Id: Icde3bfdd7c90d51548823ce1f81caf9484de2be5
Dmitriy Ivanov [Thu, 27 Nov 2014 18:16:27 +0000 (18:16 +0000)]
Merge "Disable stack mprotects when running on valgrind" into lmp-mr1-dev
Mathieu Chartier [Wed, 26 Nov 2014 23:37:52 +0000 (15:37 -0800)]
Add missing thread state change to kWaitingForCheckPointsToRun
Fixes tests
Change-Id: I4907d83ee1e9bcd2f6a823e402950d8051d4556a
Mathieu Chartier [Wed, 26 Nov 2014 19:21:15 +0000 (11:21 -0800)]
Trim reference tables when we trim the heap
Before:
System server:
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
2200 300 229 0 80 0 220 77 /dev/ashmem/dalvik-indirect ref table (deleted)
Location:
1896 128 102 0 28 0 100 39 /dev/ashmem/dalvik-indirect ref table (deleted)
After:
virtual shared shared private private
size RSS PSS clean dirty clean dirty # object
System server:
2216 64 64 0 0 0 64 79 /dev/ashmem/dalvik-indirect ref table (deleted)
Location:
2120 48 48 0 0 0 48 67 /dev/ashmem/dalvik-indirect ref table (deleted)
No pause time regression measured in memalloc test.
Bug:
17643507
Change-Id: I32d3e64cdcf8dd2f7aea509c81631597bbb9b392
Mathieu Chartier [Wed, 26 Nov 2014 02:36:01 +0000 (18:36 -0800)]
Add a way to change the IMT size
Useful for having smaller imts on memory constrainted devices.
Setting ART_IMT_SIZE=x will change the size of the IMT.
Bug:
17643507
Change-Id: Ia6bcfcb067c7e21c7f3003cf6254e4b2666ef169
Dmitriy Ivanov [Wed, 26 Nov 2014 18:30:11 +0000 (10:30 -0800)]
Disable stack mprotects when running on valgrind
Bug:
18155388
Change-Id: I17d7e3c707e83b864b0394ebbfb2438021faf76f
Mathieu Chartier [Tue, 25 Nov 2014 23:32:03 +0000 (23:32 +0000)]
Merge "Move dex cache strings from ArtMethod -> Class" into lmp-mr1-dev
buzbee [Tue, 25 Nov 2014 23:04:39 +0000 (23:04 +0000)]
Merge "Quick compiler: handle embedded switch data." into lmp-mr1-dev
buzbee [Tue, 25 Nov 2014 22:39:38 +0000 (14:39 -0800)]
Quick compiler: handle embedded switch data.
Although switch data is generally placed at the end of a dex
file by dx, it can occur elsewhere (and does via obsfucators).
This CL fixes a parsing error related to embedded switch data by
ensuring valid dex instructions following the embedded data appear
in their own basic blocks.
b/
18524584
Change-Id: I815bb5ec939803f706f98beb3afbefc8b527f730
Mathieu Chartier [Tue, 25 Nov 2014 19:20:28 +0000 (11:20 -0800)]
Fix oatwriter code deduping
Now that the GC maps are part of the oat method header they need
to be checked in CodeOffsetsKeyComparator.
Bug:
18523556
Change-Id: I539a6e7216166342b22515c1e2cf831dad32e41e
Mathieu Chartier [Tue, 25 Nov 2014 02:29:54 +0000 (18:29 -0800)]
Move dex cache strings from ArtMethod -> Class
Adds one load for const strings which are not direct.
Saves >= 60KB of memory avg per app.
Image size: -350KB.
Bug:
17643507
Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8
Sebastien Hertz [Mon, 17 Nov 2014 18:00:37 +0000 (19:00 +0100)]
JDWP: only deoptimize when it is required
We don't need to deoptimize anything when we forced the use of the
interpreter (-Xint). In this case, no compiled code is executed
(except native methods which are not concerned by deoptimization).
Therefore we even don't need to enable/disable deoptimization support
in instrumentation.
We also don't need to deoptimize a method that hasn't been compiled.
Since it will run with interpreter, there is no point deoptimizing
it. However this method may be inlined in a compiled caller method
so we still need to deoptimize everything in this case.
This CL updates breakpoint support by storing the required kind of
deoptimization for a particular method. There are 3 cases:
- kNothing: the method does not require deoptimization.
- kSelectiveDeoptimization: the method needs to be deoptimized.
- kFullDeoptimization: we must deoptimize everythinig.
When uninstalling a breakpoint, we need to do the reverse operation.
Also fixes the SanityCheckExistingBreakpoints function to control
breakpoints related to the given method only and adds extra verbose
ilogs when choosing the appropriate deoptimization kind.
Includes a partial cherry-pick of commit
87553c9fa1298ffb40127b2bb6413859fd3f79df to use method
ClassLinker::GetOatMethodQuickCodeFor.
Bug:
18407046
(cherry picked from commit
f3928794a10516e2ac0ffe2686a10891788d4b9c)
Change-Id: I50853cc5fc5c52650485785a1198d35ea0f7fb8e
Mathieu Chartier [Mon, 24 Nov 2014 18:31:19 +0000 (10:31 -0800)]
Fix failing tests
Forgot to fix these with other CL.
Change-Id: I5ac158ca0d312b601fbf1e12722fe271751c88f2
Mathieu Chartier [Sat, 22 Nov 2014 00:51:29 +0000 (16:51 -0800)]
Delete ArtMethod gc_map_ field
Moved the gc_map field from OatMethod to OatQuickMethodHeader.
Deleted the ArtMethod gc_map_ field.
Bug:
17643507
Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48
Mathieu Chartier [Thu, 20 Nov 2014 23:04:10 +0000 (15:04 -0800)]
Add fast string sharpening
String sharpening changes const strings to PC relative loads instead
of always going through the dex cache. This saves code size and
probably improves performance slightly.
Before:
49602992 system@framework@boot.oat
After:
49385904 system@framework@boot.oat
Pre-cursor to removing dex_cache_strings_ field from ArtMethod.
Bug:
17643507
Change-Id: I1787f48774631eee0accafeea257aa8d0e91e8d6
Mathieu Chartier [Fri, 21 Nov 2014 01:08:58 +0000 (17:08 -0800)]
Fix oatdump to use OatHeader pointer size
Bug:
18473190
Change-Id: If505b4f62105899f4f1257d3bccda3e6eb0dcd7c
Hiroshi Yamauchi [Thu, 20 Nov 2014 18:08:31 +0000 (10:08 -0800)]
Tune rosalloc buffer sizes.
We now use one-page buffers for size brackets 4-7, instead of two-page
buffers, and the first 8 size brackets for thread-local allocations,
instead of 11.
No slowdown observed with MemAllocTest, EvaluateAndApplyChanges, and
BinaryTrees.
Bug:
18377775
Change-Id: Ie1bb46bcf5d3729197e48e26a27da4cc39dd807e
Igor Murashkin [Thu, 20 Nov 2014 00:06:33 +0000 (00:06 +0000)]
Merge "dex2oat: Pack likely-dirty objects together when generating the boot image" into lmp-mr1-dev
Igor Murashkin [Fri, 14 Nov 2014 23:01:59 +0000 (15:01 -0800)]
dex2oat: Pack likely-dirty objects together when generating the boot image
This introduces a new algorithm into image writer which "bins" objects
by how likely they are to be dirtied at runtime. Objects in the same bin
are placed contiguously in memory (i.e. into the same page). We try to
tune the bin selection based on how clean or how dirty the object will
likely be at runtime.
As-is, this saves about 150KB per-process (private-dirty pages) and 700KB in
zygote (shared-dirty).
There is still about 800KB of objects that are clean but located in
dirty pages, so with more analysis we can tune the bin selection and get
even more memory savings.
Bug:
17611661
Change-Id: Ia1455e4c56ffd0a36ae2a723d35b7e06502980f7
Mathieu Chartier [Wed, 19 Nov 2014 18:51:42 +0000 (10:51 -0800)]
Fix zygote space and non moving space map names
Space names:
"non moving space" -> "zygote space"
"alloc space" -> "non moving space"
Bug:
18447855
Change-Id: Ia937b6d046ccf7f66bf1f6bbb9f17a5e0d00c016
Mathieu Chartier [Wed, 19 Nov 2014 18:37:22 +0000 (18:37 +0000)]
Merge "Fix transitive equality error in set." into lmp-mr1-dev
buzbee [Wed, 19 Nov 2014 13:26:05 +0000 (05:26 -0800)]
Quick compiler: fix x86 special identity
The Quick compiler recognizes and specially handles a set of
small methods - including those that simply return one of their
arguments. For x86, special identity was broken if the returned
argument was a double that was passed half in register and half
in memory.
internal b/
17325447
(cherry picked from commit
e8f74e58b476520cfc53970304c67b800994e33d)
Change-Id: I9afea5ef34498306528e0804489b5144e9e9aec3
Mathieu Chartier [Tue, 18 Nov 2014 22:13:58 +0000 (14:13 -0800)]
Fix transitive equality error in set.
SubstringComparator used to be broken since it didn't have transitive
equality (ex. ab a ac). Now we use normal string comparison with
set.lower_bound saves an additional 12 bytes.
Also up frame size to 2700 to fix build.
Change-Id: Ie8d41faef37591e7feed1f5d2ad6258430b8ffb6
Mathieu Chartier [Tue, 18 Nov 2014 22:03:04 +0000 (22:03 +0000)]
Merge "Change 64 bit ArtMethod fields to be pointer sized" into lmp-mr1-dev
Andreas Gampe [Tue, 18 Nov 2014 19:44:48 +0000 (19:44 +0000)]
am
85448d4b: ART: Compiled-classes list for compiler-driver
* commit '
85448d4b9c0720049a7ee4afa331870e87d83995':
ART: Compiled-classes list for compiler-driver
Vladimir Marko [Tue, 18 Nov 2014 17:43:07 +0000 (17:43 +0000)]
Merge "Do not try to sharpen super calls to abstract methods." into lmp-mr1-dev
Andreas Gampe [Tue, 18 Nov 2014 17:34:27 +0000 (17:34 +0000)]
Merge "ART: Track Flush & Close in FdFile" into lmp-mr1-dev
Andreas Gampe [Thu, 6 Nov 2014 09:00:46 +0000 (01:00 -0800)]
ART: Track Flush & Close in FdFile
Implement a check that aborts when a file hasn't been explicitly
flushed and closed when it is destructed.
Add WARN_UNUSED to FdFile methods.
Update dex2oat, patchoat, scoped_flock and some gtests to pass with
this.
Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
Vladimir Marko [Tue, 18 Nov 2014 15:26:13 +0000 (15:26 +0000)]
Do not try to sharpen super calls to abstract methods.
Bug:
18380491
Change-Id: I08bfdddb0fe698b3bbe31204b7562fbc08488a35
Mathieu Chartier [Mon, 10 Nov 2014 19:08:06 +0000 (11:08 -0800)]
Change 64 bit ArtMethod fields to be pointer sized
Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.
Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.
Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).
Savings depend on how often the shared methods are on dirty pages vs
shared.
TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.
Bug:
17643507
Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8
Hiroshi Yamauchi [Mon, 17 Nov 2014 22:52:21 +0000 (22:52 +0000)]
Merge "Enable the hspace compaction on OOM by default." into lmp-mr1-dev
Mathieu Chartier [Mon, 17 Nov 2014 22:24:59 +0000 (22:24 +0000)]
Merge "Combine image string char arrays into single array" into lmp-mr1-dev
Mathieu Chartier [Mon, 17 Nov 2014 20:36:24 +0000 (12:36 -0800)]
Don't call AddImageStringsToTable or MoveImageClassesToClassTable if running imageless
If we fail to create the image we use imageless running, this was
breaking AddImageStringsToTable since we didn't check for this
case. Added a check which avoids calling AddImageStringsToTable and
MoveImageClassesToClassTable if we don't have an image.
Bug:
18412472
Change-Id: I1dd8f306d5e41356a6b62fbd95315f564ee0d36e
Mathieu Chartier [Sat, 15 Nov 2014 03:34:18 +0000 (19:34 -0800)]
Combine image string char arrays into single array
Having one giant char array shared between all the strings saves memory
since it avoids the 12 bytes of array overhead per image string. Also
added substring finding based on prefixes, strings are added into the
array in reverse sorted length.
Image size goes from
11767808 ->
11100160.
Bug:
17643507
Change-Id: I2a7f177b40d0458d5c50640643d8f16b0030bdce
Vladimir Marko [Mon, 17 Nov 2014 19:01:36 +0000 (19:01 +0000)]
Merge "Fix ordering of fields with the same name." into lmp-mr1-dev
Vladimir Marko [Mon, 17 Nov 2014 18:55:17 +0000 (18:55 +0000)]
Merge "Fix LinkFieldsComparator." into lmp-mr1-dev
Hiroshi Yamauchi [Sat, 15 Nov 2014 01:21:06 +0000 (17:21 -0800)]
Enable the hspace compaction on OOM by default.
Bug:
18377775
Change-Id: I714367813e0f6d7cb854ace7f40dad0715f99e00
Vladimir Marko [Mon, 17 Nov 2014 15:13:34 +0000 (15:13 +0000)]
Fix ordering of fields with the same name.
While the Java language doesn't allow multiple fields with
the same name in a single class (excluding fields from super
classes), the bytecode specification permits it and tools
such as proguard actually generate them. Define the order of
these fields by their dex file index and relax the check of
field ordering to permit identical names.
Bug:
18211592
(cherry picked from commit
7a7c1db21782fb922d3ffc5c576117812624ea58)
Change-Id: I8547eeac890b7483c8925367a85382197be9ea7a
Vladimir Marko [Wed, 12 Nov 2014 17:02:02 +0000 (17:02 +0000)]
Fix LinkFieldsComparator.
Define order for primitive types with the same sizes.
Previously, the comparator would consider the fields equal
so the order would depend on std::sort() implementation.
Changing the STL implementation could silently change the
field offsets. (And, unlike std::stable_sort(), the
std::sort() doesn't even need to be deterministic.)
(cherry picked from commit
d577748c041aa6df599218f3cb31697ecf032730)
Change-Id: I9b769d023864aa36c52918c7c3dd11c0f6b8f40e
Mathieu Chartier [Sat, 15 Nov 2014 21:07:39 +0000 (13:07 -0800)]
Fix reference leaks in ToReflectedMethod and ToReflectedField
Used ScopedLocalRef to fix, added regression tests.
Bug:
18396311
Change-Id: I8ef447408f103c35389e76c14071a0f2e40de300
Andreas Gampe [Tue, 11 Nov 2014 21:28:29 +0000 (13:28 -0800)]
ART: Compiled-classes list for compiler-driver
Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.
Bug:
18336591
(cherry picked from commit
26318f722958ac1cba6a812026a1377f37c54941)
Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
Vladimir Marko [Fri, 14 Nov 2014 18:05:24 +0000 (18:05 +0000)]
Bump oat version.
Need to rebuild images after commit
bfa3ed0ad988e1da13626ddbaf6dcae0c58ea79e
Bug:
18211592
Change-Id: I10c7353ba0fc216ff73c3ff16480c7fe9da13f2d
Vladimir Marko [Fri, 14 Nov 2014 10:06:10 +0000 (10:06 +0000)]
Merge "Keep original order of fields in Class." into lmp-mr1-dev
Pavel Vyssotski [Thu, 13 Nov 2014 12:25:23 +0000 (18:25 +0600)]
ART: Implicit null check should break def tracking
Implicit null check can provoke exception that needs to be sure all VRs are saved on stack.
The fix is to reset the def tracking system at the moment of adding an implicit null check.
b/
18368901
Signed-off-by: Pavel Vyssotski <pavel.n.vyssotski@intel.com>
(cherry picked from commit
9c3617a8f7413bb1181e72bc1f7086d986a86e18)
Change-Id: If7d705b8417cf29076da9ce19ec54d698f3cb0d5
Andreas Gampe [Thu, 13 Nov 2014 18:32:18 +0000 (18:32 +0000)]
Merge "ART: Compiled-classes list for compiler-driver" into lmp-mr1-dev
Vladimir Marko [Mon, 10 Nov 2014 18:32:59 +0000 (18:32 +0000)]
Keep original order of fields in Class.
The fields of a class are ordered alphabetically in the dex
file. Keep the same order in the field arrays so that we can
do binary search lookups by name. Those lookups will be
implemented in a subsequent change in libcore/.
Bug:
18211592
Change-Id: I8f979de62ffe37d1c7d5c721717d2f3501e7c9e6
Vladimir Marko [Wed, 12 Nov 2014 15:41:57 +0000 (15:41 +0000)]
Fix bad OOM check in Thread::CreatePeer().
Bug:
18342629
Change-Id: Ic070ed6b72d11b2e1e2a89904bd9659b2146f863
Narayan Kamath [Wed, 12 Nov 2014 12:48:25 +0000 (12:48 +0000)]
Merge "Prune image cache if the boot marker is still in place." into lmp-mr1-dev
buzbee [Wed, 12 Nov 2014 00:13:46 +0000 (00:13 +0000)]
Merge "Reduce suspend check threshold" into lmp-mr1-dev
Andreas Gampe [Tue, 11 Nov 2014 21:28:29 +0000 (13:28 -0800)]
ART: Compiled-classes list for compiler-driver
Similar to the image-classes list, introduce a list of class names
that are to be compiled when creating a boot image. This defaults
to all classes.
Bug:
18336591
Change-Id: I95f69afdb500a9defb6795803d4040bbe67c5a01
Mathieu Chartier [Tue, 11 Nov 2014 17:39:06 +0000 (17:39 +0000)]
Merge "Add null check for thread name creation" into lmp-mr1-dev
Narayan Kamath [Fri, 7 Nov 2014 17:46:28 +0000 (17:46 +0000)]
Prune image cache if the boot marker is still in place.
We place a marker in each isa cache dir and have the framework
delete it for us.
This seems like a convenient place to do it given all the other
dalvik-cache related code that hooks in here, and also because
this is the first point where we try to access the cache.
TODO: Add a timeout to the (higher level) zygote code to correctly
kill the surviving zygote if one of them never comes up.
bug:
18280671
Change-Id: I4d964adc826e62c29ab73a098474a116f9818366
Mathieu Chartier [Tue, 11 Nov 2014 00:58:19 +0000 (16:58 -0800)]
Add null check for thread name creation
Previously we didn't check for null which could result in check jni
failures if we tried to throw another OOM in the next allocation.
Bug:
18297817
Change-Id: I459b1de7760a4009e410fdbdcacdb748d13fbc1d
Andreas Gampe [Tue, 11 Nov 2014 00:04:21 +0000 (00:04 +0000)]
am
d00804c6: ART: Prune links in the dalvik cache
* commit '
d00804c6b7ebde7ffdd06037e93291efe867744d':
ART: Prune links in the dalvik cache
Igor Murashkin [Tue, 11 Nov 2014 00:04:20 +0000 (00:04 +0000)]
am
e225eab4: art: Fix classlinker and nopatchoat test for PIC case
* commit '
e225eab4a17dd8db7f9d8412e4edc04e330462bc':
art: Fix classlinker and nopatchoat test for PIC case
Igor Murashkin [Tue, 11 Nov 2014 00:04:19 +0000 (00:04 +0000)]
am
48447025: ART: Add support for patching and loading OAT files compiled with PIC
* commit '
48447025389cd67605041a28d4ded1528381bc4e':
ART: Add support for patching and loading OAT files compiled with PIC
Andreas Gampe [Tue, 11 Nov 2014 00:04:18 +0000 (00:04 +0000)]
am
998ee7d0: (-s ours) ART: Add pic flag to oat header store
* commit '
998ee7d0f62a1ee7efaaad49e728d19c38b4c9c3':
ART: Add pic flag to oat header store
Igor Murashkin [Mon, 10 Nov 2014 23:52:34 +0000 (23:52 +0000)]
am
300590bd: dex2oat: Add a --compile-pic option
* commit '
300590bd7291251d9ac9aa762785a517d7f9f919':
dex2oat: Add a --compile-pic option
Andreas Gampe [Mon, 10 Nov 2014 02:14:30 +0000 (18:14 -0800)]
ART: Prune links in the dalvik cache
When pruning the isa-specific directory of the cache, also remove
symbolic links.
Bug:
18035729
Bug:
18153744
(cherry picked from commit
de5ed50940452f06b00514af0667972542ee5d59)
Change-Id: I84dbf578577b080785bbb81b660e4148bb512410
Igor Murashkin [Thu, 30 Oct 2014 02:45:42 +0000 (19:45 -0700)]
art: Fix classlinker and nopatchoat test for PIC case
ClassLinker should not be checking oat data begin and the patch delta
as part of the checksum verification (when PIC is enabled).
Also update nopatchoat test since it needs to be parametric on whether
PIC is used.
(cherry-picked from AOSP master
230faa7c44ec1986d5fa93d205eb23cb8024e333)
Bug:
18035729
(cherry picked from commit
5ef2990c2933152021633e6697d5325103649499)
Change-Id: Ia0a601c657b813767114095c3b7577421e03bde4
Igor Murashkin [Wed, 22 Oct 2014 18:37:02 +0000 (11:37 -0700)]
ART: Add support for patching and loading OAT files compiled with PIC
* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked
As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.
(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)
Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h
Bug:
18035729
(cherry picked from commit
90ca5c0301651101de0e363842e5d08ae65233f7)
Change-Id: I8d99f95cc3d1fa221fc530ebb1fcc4b3263c183d
Andreas Gampe [Thu, 23 Oct 2014 18:37:40 +0000 (11:37 -0700)]
ART: Add pic flag to oat header store
Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.
(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)
Bug:
18035729
Signed-off-by: Igor Murashkin <iam@google.com>
(cherry picked from commit
d7392faea80acb5d73a027bb384e3222bc2c2e43)
Change-Id: If5f6cf13f4c7ecb6038415e68fbb0ae9cee5ec60
Igor Murashkin [Fri, 17 Oct 2014 01:36:16 +0000 (18:36 -0700)]
dex2oat: Add a --compile-pic option
(cherry-picked from AOSP master
83c5612e69fa05610baf4f4d237fe0995a79cde5)
Bug:
18035729
(cherry picked from commit
643b5df2b065ccf5bb19a183573da691e9d0311f)
Change-Id: I14edee7c7cb996bc388d89b4c5274db2caf91004
Andreas Gampe [Mon, 10 Nov 2014 18:27:18 +0000 (18:27 +0000)]
Merge "ART: Prune links in the dalvik cache" into lmp-mr1-dev
Andreas Gampe [Mon, 10 Nov 2014 02:14:30 +0000 (18:14 -0800)]
ART: Prune links in the dalvik cache
When pruning the isa-specific directory of the cache, also remove
symbolic links.
Bug:
18035729
Bug:
18153744
Change-Id: I40347ee77e95ff9fc8e6107ba661338f5c7b1db9
Mathieu Chartier [Mon, 10 Nov 2014 18:01:04 +0000 (18:01 +0000)]
Merge "Delete unused imtable field" into lmp-mr1-dev
Mathieu Chartier [Sat, 8 Nov 2014 02:38:47 +0000 (18:38 -0800)]
Delete unused imtable field
Bug:
17643507
Change-Id: I1fc7ca2d3bdf1810bcc3b46f867b68a4a6d28ed3
Andreas Gampe [Sun, 9 Nov 2014 20:13:01 +0000 (20:13 +0000)]
Merge "ART: Fix possible soft+hard failure in verifier" into lmp-mr1-dev
Andreas Gampe [Tue, 21 Oct 2014 05:25:29 +0000 (22:25 -0700)]
ART: Fix possible soft+hard failure in verifier
It was possible to generate a hard failure and a subsequent soft
failure, which violates a CHECKed invariant.
Refactor code slightly to share common code.
Bug:
17625962
Change-Id: Iccd9e30f1087363b19b2faedc10243a2290202c0
buzbee [Fri, 7 Nov 2014 22:52:04 +0000 (14:52 -0800)]
Reduce suspend check threshold
The Quick compiler uses a dedicated count-down register (r4)
to reduce the cost of checking for suspend requests. In order
to reduce suspend latency, this CL reduces the countdown value
from 1000 to 96.
See bug
17953517 for more discussion.
Change-Id: I88b92016b869f57be83e9bded88dbe42e2ee760d
Mathieu Chartier [Fri, 7 Nov 2014 19:27:45 +0000 (19:27 +0000)]
Merge "Add hash map, reduce excessive hashing" into lmp-mr1-dev
Mathieu Chartier [Fri, 7 Nov 2014 00:35:45 +0000 (16:35 -0800)]
Add hash map, reduce excessive hashing
Changed the class def index to use a HashMap instead of unordered_map
so that we can use FindWithHash to reduce how often we need to compute
hashes.
Fixed a bug in ClassLinker::UpdateClass where we didn't properly
handle classes with the same descriptor but different class loaders.
Introduced by previous CL.
Before (fb launch):
1.74% art::ComputeModifiedUtf8Hash(char const*)
After:
0.95% art::ComputeModifiedUtf8Hash(char const*)
Bug:
18054905
Bug:
16828525
Change-Id: Iba2ee37c9837289e0ea187800ba4af322225a994
Narayan Kamath [Fri, 7 Nov 2014 12:45:28 +0000 (12:45 +0000)]
Merge "Fix thread priorities for unstarted threads." into lmp-mr1-dev
Mathieu Chartier [Fri, 26 Sep 2014 21:32:37 +0000 (14:32 -0700)]
Optimize get/set reflection performance
Speedups mostly from reducing how often access checks are needed,
and adding more inlining, and adding templates.
Field_getInt from ~850ns -> 350ns.
Field_setInt from ~900ns -> 370ns.
Bug:
14063288
Change-Id: I2441581ff3478c6ae43b6aa49939ff3f07555ec8
(cherry picked from commit
ffc788cb7b5b9f53734d7bb8af2d5e45d885546b)
Andreas Gampe [Fri, 7 Nov 2014 00:05:49 +0000 (00:05 +0000)]
am
f0cb1eb5: ART: Missing EndTiming()s in dex2oat
* commit '
f0cb1eb5b2020c3c527aca3ff458801b90b5e06c':
ART: Missing EndTiming()s in dex2oat
Mathieu Chartier [Fri, 7 Nov 2014 00:03:34 +0000 (00:03 +0000)]
Merge "Add hash set" into lmp-mr1-dev
Mathieu Chartier [Mon, 3 Nov 2014 19:41:47 +0000 (11:41 -0800)]
Add hash set
More memory efficient than libcxx since we do not box the values.
Change intern table to use new hash set. Clean up intern table by
removing const casts and deleting unnecessary code.
Changed the class linker to use a hash set, also added a pre-zygote
class table.
5 samples of:
adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo
Before:
165929 kB: Native
175859 kB: Native
168434 kB: Native
166559 kB: Native
169958 kB: Native
After:
160972 kB: Native
159439 kB: Native
157204 kB: Native
165093 kB: Native
163039 kB: Native
TODO: Add HashTable which is implemented by using a HashSet.
TODO: Use for DexFile::find_class_def_misses_.
TODO: Investigate using mem maps instead of native heap.
Bug:
17808975
Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a
Andreas Gampe [Thu, 6 Nov 2014 19:23:56 +0000 (11:23 -0800)]
ART: Missing EndTiming()s in dex2oat
In the failure case, make sure we do an EndTiming() to not abort
because of Start-End mismatch.
Bug:
18273355
Change-Id: I42e68dd337dfe32c3b90511a04bc8f12114b9484
Narayan Kamath [Tue, 7 Oct 2014 11:51:26 +0000 (12:51 +0100)]
Fix thread priorities for unstarted threads.
Calls to Thread.setPriority for unstarted threads now behave
similar to dalvik. Note that there's still some inconsistent
behaviour carried over from dalvik.
- high priority threads from bg_non_interactive processes are
not always moved to the SP_FOREGROUND cgroup.
- we do not attempt to adjust the cgroup of a native thread
that's attaching.
Note that on android, the system_server will change the
cgroups for all running threads in a process when it moves
into the foreground and background. It's by design that
threads in a background process can request to be moved
to the foreground by setting a higher priority.
bug:
17893086
Change-Id: I1662982b1c7b3ac509698e2e12c9768d082c8053
Andreas Gampe [Sat, 1 Nov 2014 01:12:30 +0000 (18:12 -0700)]
ART: Add miranda checking
Add a test for resolution of miranda methods across dex-files. See
CL 112688 and b/
18193682 for the code change.
Fix the test script to support no-verify again.
Weaken the dex cache check to a check whether the found method is a
miranda method. This will penalize miranda methods, as they will
always have to be resolved by name, but does not require the multi-step
load of the method's dex cache.
Bug:
18193682
(cherry picked from commit
2b0fa5ba4a8f07ee243452003bf93418d30e9448)
Change-Id: I1dae2a9ec0985dc8625acd7dd5686a5d3cdc8888
Jeff Hao [Mon, 3 Nov 2014 19:18:42 +0000 (19:18 +0000)]
Merge "Check null this pointer for direct methods in FindMethodFast." into lmp-mr1-dev
Jeff Hao [Thu, 30 Oct 2014 00:24:25 +0000 (17:24 -0700)]
Check null this pointer for direct methods in FindMethodFast.
Also adds regression test 122-secondarydex.
Bug:
18150997
Change-Id: If3ddc67b84ccbf3b47c78854178c0a24952c5824
Mathieu Chartier [Mon, 3 Nov 2014 18:07:18 +0000 (18:07 +0000)]
Merge "Add image strings to intern table" into lmp-mr1-dev
Mathieu Chartier [Fri, 31 Oct 2014 18:49:27 +0000 (11:49 -0700)]
Add image strings to intern table
When we create the runtime, we now add the image strings to the
intern table if we are the zygote. This caused some memory bloat,
so I added an extra unordered set to the intern table.
There is now two unordered sets (hash talbe). One for pre-zygote
interns and one for post-zygote interns. This helps since the
pre-zygote hash table doesn't get dirtied. Even with adding
the image strings, we get total memory savings of around 5-7 MB
native PSS after device boot.
FB launch Before:
2.20% art::DexFile::FindStringId(char const*) const
TotalTime: 2069
TotalTime: 1985
TotalTime: 2088
TotalTime: 2003
TotalTime: 2034
TotalTime: 2049
After boot native PSS: 175585 kB: Native
After:
0.27% art::DexFile::FindStringId(char const*) const
TotalTime: 1682
TotalTime: 1756
TotalTime: 1825
TotalTime: 1751
TotalTime: 1666
TotalTime: 1813
After boot native PSS: 167089 kB: Native
Bug:
18054905
Bug:
16828525
Bug:
17808975
Change-Id: Ie367f3222f8c4db409ec49c3845276908b51e9c9
Brian Carlstrom [Sat, 1 Nov 2014 14:08:28 +0000 (14:08 +0000)]
am
64d79730: am
9a783d6a: Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
* commit '
64d79730c33777a62e108942909773e5e782ece3':
Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
Andreas Gampe [Sat, 1 Nov 2014 00:32:21 +0000 (00:32 +0000)]
Merge "ART: Discard generated image in a low-memory environment" into lmp-mr1-dev
Andreas Gampe [Fri, 31 Oct 2014 23:45:19 +0000 (16:45 -0700)]
ART: Discard generated image in a low-memory environment
In case the available memory after image generation is low,
discard the image and continue in interpreted mode to mitigate
low-mem issues.
Bug:
17975190
Change-Id: I67a0f9c32a6c1f1a7ec659e90b1fec834a92d323
Igor Murashkin [Thu, 30 Oct 2014 02:45:42 +0000 (19:45 -0700)]
art: Fix classlinker and nopatchoat test for PIC case
ClassLinker should not be checking oat data begin and the patch delta
as part of the checksum verification (when PIC is enabled).
Also update nopatchoat test since it needs to be parametric on whether
PIC is used.
(cherry-picked from AOSP master
230faa7c44ec1986d5fa93d205eb23cb8024e333)
Bug:
18035729
Change-Id: I4eb184d22616230a7b8f0dd514d3416d0976b07e
Igor Murashkin [Wed, 22 Oct 2014 18:37:02 +0000 (11:37 -0700)]
ART: Add support for patching and loading OAT files compiled with PIC
* Images (.art) compiled with pic now have a new field added.
* isDexOptNeeded will now skip patch-ing for apps compiled PIC
* First-boot patching now only copies boot.art, boot.oat is linked
As a result, all system preopted dex files (with --compile-pic) no
longer take up any space in /data/dalvik-cache/<isa>.
(cherry-picked from AOSP master
46774767fcf7780d1455e755729198648d08742e)
Conflicts (from aosp master):
compiler/image_test.cc
compiler/image_writer.cc
compiler/image_writer.h
compiler/oat_test.cc
dex2oat/dex2oat.cc
oatdump/oatdump.cc
runtime/elf_file.cc
runtime/elf_file.h
runtime/elf_file_impl.h
runtime/oat_file.cc
runtime/oat_file.h
Bug:
18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
Andreas Gampe [Thu, 23 Oct 2014 18:37:40 +0000 (11:37 -0700)]
ART: Add pic flag to oat header store
Add the compile-time PIC flag to the oat-header key-value store.
Ignore image offset and patch delta when loading PIC oat files.
(cherry-picked from AOSP master
7ba649636c4475c3992fa15a57acd2546d69ff38)
Bug:
18035729
Signed-off-by: Igor Murashkin <iam@google.com>
Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
Igor Murashkin [Fri, 17 Oct 2014 01:36:16 +0000 (18:36 -0700)]
dex2oat: Add a --compile-pic option
(cherry-picked from AOSP master
83c5612e69fa05610baf4f4d237fe0995a79cde5)
Bug:
18035729
Change-Id: I80e03613e3b6ac079bcbc7e068bbaae760c364c9
Brian Carlstrom [Fri, 31 Oct 2014 14:33:51 +0000 (14:33 +0000)]
am
9a783d6a: Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
* commit '
9a783d6a0cb437fc0d9ffcc84502912f3d1cb73b':
Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
Brian Carlstrom [Fri, 31 Oct 2014 07:01:54 +0000 (00:01 -0700)]
Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
If a class in classes.dex implements an interface from classes2.dex,
the miranda method will be in the dex cache for classes2.dex, but
pointed to by the virtual methods of the class in the dex caches for
classes.dex.
Therefore the fast path for DexCache::ResolveMethod that searches via
class and superclass virtual methods should ensure that any method
matching on dex method_idx should be from the same dex cache as the
class itself, which is not the case for miranda methods.
Bug:
18193682
Change-Id: I10da4f5472e929b3dc0be58051a726a4bc14e438