OSDN Git Service

android-x86/art.git
7 years agoRevert "Change thread suspend timeout to be fatal for non-debug"
Mathieu Chartier [Fri, 2 Jun 2017 01:45:10 +0000 (18:45 -0700)]
Revert "Change thread suspend timeout to be fatal for non-debug"

For overloaded systems, 10s might not be enough. Infinite seconds
will be though.

Bug: 37221387

Test: test-art-host

This reverts commit d69f82e155118654d989f0b436c019fb6d517341.

Change-Id: I8ac0e13e6bdae1845803682215e1794d892de8e5

7 years agoMerge "Flush data cache after updating the JIT table." into oc-dev
TreeHugger Robot [Tue, 30 May 2017 10:21:14 +0000 (10:21 +0000)]
Merge "Flush data cache after updating the JIT table." into oc-dev

7 years agoUse arena allocation for profiles
Calin Juravle [Fri, 19 May 2017 23:47:53 +0000 (16:47 -0700)]
Use arena allocation for profiles

By using our arena allocator we can madvise the memory used during
profile processing right way. jemalloc may defer the release based on
unpredictable native allocation.

The other advantage of arenas is a much simpler way to measure the
memory needed by profiles.

Test: m test-art-host
Test: manual inspection with meminfo and heaptrack
Bug: 37711886

(cherry picked from commit cc3171ab3af35b4e4ad5671d7425aa8a6bfcc5f3)

This change also squashes 2 fixes on the orginal submit.
(cherry picked from commit 798ba16bda747d74a27b7a748d3bb5deb2ccbf68)
(cherry picked from commit e6f87cc95e5351f3872a4c50e18915a282578ff8)

(partial cherry picked from commit
55232f13e4a34ab36c13f337642b57f9def00da8 to fix dexdiag formating and
please the bot)

Merged-In: I2066b6654438474c10b17d5d92538a6095748684
Change-Id: I91741229a807c777631ef324fc3f397c9a0c18e3

Bug: 37711886

7 years agoMerge "Do not deopt when using AOT inline caches" into oc-dev
Calin Juravle [Fri, 26 May 2017 16:14:28 +0000 (16:14 +0000)]
Merge "Do not deopt when using AOT inline caches" into oc-dev

7 years agoMerge "Record inline caches only for the strictly hot methods" into oc-dev
Calin Juravle [Fri, 26 May 2017 16:14:14 +0000 (16:14 +0000)]
Merge "Record inline caches only for the strictly hot methods" into oc-dev

7 years agoFlush data cache after updating the JIT table.
Nicolas Geoffray [Thu, 25 May 2017 11:54:31 +0000 (12:54 +0100)]
Flush data cache after updating the JIT table.

Otherwise, other cores could see an incomplete table when executing
the new code.

bug: 37949368
Test: test.py --jit

(cherry picked from commit 352b17af5263b27cad7a1dbf2351f9cb71d6af58)

Change-Id: Ib1e4d2386477cb537b5921bb395e4bcd0ff760b7

7 years agoDo not deopt when using AOT inline caches
Calin Juravle [Tue, 23 May 2017 21:24:55 +0000 (14:24 -0700)]
Do not deopt when using AOT inline caches

Generating a deopt does not ensure that we will actually capture the new
types; and the danger is that we could be stuck in a loop with "forever"
deoptimizations. For example, if the method never becomes hot again, the
inline cache will not be updated and the AOT code will keep
deoptimizing.

This is a compromise because we will most likely never update the inline
cache (unless there's another reason to deopt). So we might be stuck
with a sub-optimal inline cache. As a TODO, we could be smarter when
capturing inline caches to mitigate this. (e.g. by having different
thresholds for new and old methods).

Delete test 644 which was testing a regression involving deopts which is
no longer applicable.

Bug: 38412648
Test: m test-art-host

(cherry picked from commit af44e6c5ca0169bc19c6263288a7d889b37db549)

Merged-In: Ib57f9c35ddbc95646aa352ab017e8b59d9466595
Change-Id: I307826bbdc3f994ea12a66243a31f148995f348b

7 years agoRecord inline caches only for the strictly hot methods
Calin Juravle [Thu, 18 May 2017 17:15:52 +0000 (10:15 -0700)]
Record inline caches only for the strictly hot methods

Warm methods might have incomplete inline caches which could cause
unnecessary deoptimizations.

Test: m test-art-host
Bug: 38426301
Bug: 38412648

(cherry picked from commit a39fd980000d10ee0b3a49555cc8bcbbfacde943)

Change-Id: I12e2c068663e8bb948dcd7ba89d0c1d4c9118153

7 years agoRecord types when the interpreter executes intrinsics.
Nicolas Geoffray [Wed, 24 May 2017 14:59:18 +0000 (15:59 +0100)]
Record types when the interpreter executes intrinsics.

Otherwise, we could keep on deopting, as the JIT compiler wouldn't
see those types when doing inlining decisions.

bug: 37655083
Test: 652-deopt-intrinsic

(cherry picked from commit b9bec2e3846f3f500ca1354c849a81dfbb095b6b)

Change-Id: I8918626f78255ab2f6f2fd2f51017fb9fa7d4f99

7 years agoUse HeapGrowthMultiplier for native allocaitons
Mathieu Chartier [Wed, 24 May 2017 19:01:04 +0000 (12:01 -0700)]
Use HeapGrowthMultiplier for native allocaitons

Reduces the amount of native allocation GCs for foreground apps.
For camera: The number of native allocations GCs goes from 4 to 2,
improving launch time by 25ms (average of 25 runs on pixel).

The multiplier is 1 for low ram devices, so this should not increase
RAM on devices where it matters.

Bug: 36727951
Test: test-art-host

Change-Id: I0b9e090d9d85bcb2fcd24f221988e99b91ec5977

7 years agoGo to suspended before waiting for GC to complete.
Mathieu Chartier [Fri, 19 May 2017 20:05:06 +0000 (13:05 -0700)]
Go to suspended before waiting for GC to complete.

We are not allowed to wait on the GC complete lock while holding the
mutator lock.

Bug: 38449715
Bug: 38350590

Test: test-art-host

(cherry picked from commit b93d5b1f39fb0651dfe2f165ad1431c962f5a78e)

Change-Id: Ib5b6d99b82f0c4a999bfcbbb1f5271da41a51040

7 years agoMerge "Also return vdex file from DexFile.getDexFileOutputPath" into oc-dev
Calin Juravle [Fri, 19 May 2017 16:56:37 +0000 (16:56 +0000)]
Merge "Also return vdex file from DexFile.getDexFileOutputPath" into oc-dev

7 years agoMerge "Send holder to Mark in ConcurrentCopying::Process for GC verification" into...
Mathieu Chartier [Thu, 18 May 2017 23:15:05 +0000 (23:15 +0000)]
Merge "Send holder to Mark in ConcurrentCopying::Process for GC verification" into oc-dev

7 years agoMerge "Use GC critical section for profile saver" into oc-dev
Mathieu Chartier [Thu, 18 May 2017 23:11:31 +0000 (23:11 +0000)]
Merge "Use GC critical section for profile saver" into oc-dev

7 years agoAlso return vdex file from DexFile.getDexFileOutputPath
Calin Juravle [Tue, 16 May 2017 01:18:39 +0000 (18:18 -0700)]
Also return vdex file from DexFile.getDexFileOutputPath

Test: m test-art-host
      device boots
Bug: 33168521

(cherry picked from commit 367b9d8694b28896f681f00195cf4980536fe3f3)

Change-Id: I3307e9aa60331b2c78efc6a33632dce12d8b38b7

7 years agoSend holder to Mark in ConcurrentCopying::Process for GC verification
Mathieu Chartier [Thu, 18 May 2017 17:01:07 +0000 (10:01 -0700)]
Send holder to Mark in ConcurrentCopying::Process for GC verification

Aims to log more when heap corruption is detected.

Test: test-art-host-gtest-verification_test
Test: test-art-host

Bug: 38409177
Bug: 37187694

(cherry picked from commit 4ce0c765cf7bcaba4da4990b7b9c1f115ec25198)

Change-Id: I8907923ce67c6040ea467b4e3ae00a4b607f8c7c

7 years agoUse GC critical section for profile saver
Mathieu Chartier [Wed, 17 May 2017 20:14:10 +0000 (13:14 -0700)]
Use GC critical section for profile saver

Since visit classes uses DecodeWeakGlobal, it may block on decoding
weak globals. This can cause deadlocks since it will be blocked while
holding the classlinker classes lock.

Using a GC critical section ensures that the GC is not running while
we visit the classes for the profile saver.

I didn't put the logic in the VisitClasses call since some of the
callers already have no thread suspension checks that would fail from
this.

Bug: 38350590
Test: test-art-host ART_TEST_JIT=true

(cherry picked from commit 39100372d5131b3327e5af076a949da9eb6f7a33)

Change-Id: I1b8350638ce0a0486b2672100e582dc3a049b0fd

7 years agoMerge "Fix ProfileSaver logging" into oc-dev
Nicolas Geoffray [Thu, 18 May 2017 13:27:49 +0000 (13:27 +0000)]
Merge "Fix ProfileSaver logging" into oc-dev

7 years agoMerge "Revert "Revert "Use IsMarked instead of Mark for profiling info.""" into oc-dev
Nicolas Geoffray [Thu, 18 May 2017 13:00:38 +0000 (13:00 +0000)]
Merge "Revert "Revert "Use IsMarked instead of Mark for profiling info.""" into oc-dev

7 years agoFix ProfileSaver logging
Calin Juravle [Thu, 18 May 2017 05:02:07 +0000 (22:02 -0700)]
Fix ProfileSaver logging

The LOG(ERROR) should have been a LOG(WARNING) and because the
run-test captures the errors, test 595 is failing.

Test: m test-art-host-run-test-595-profile-saving
Bug: 37711886
Change-Id: I69fa46d763e8e5f59c0f6a9778f725ee559eff6a

7 years agoMerge "Do not cache profiles in the ProfileSaver." into oc-dev
Calin Juravle [Wed, 17 May 2017 21:00:11 +0000 (21:00 +0000)]
Merge "Do not cache profiles in the ProfileSaver." into oc-dev

7 years agosigchain: limit use of SetHandlingSignal.
Josh Gao [Thu, 4 May 2017 20:55:28 +0000 (13:55 -0700)]
sigchain: limit use of SetHandlingSignal.

The native bridge and user signal handlers are able to not return to
our signal handler, leaving the HandlingSignal flag set to true for the
rest of the lifetime of the thread. Fix this by only using
SetHandlingSignal for handlers that we know will return (i.e. the ART
fault handler).

This effectively reverts commit 90444558, which means sigprocmask's
behavior is back to filtering out claimed signals when inside a user
signal handler.

Include an update to test/115-native-bridge from Zhenhua Wang, to make
sure we keep handling signals when a signal handler longjmps away
instead of returning.

Bug: http://b/37988407
Test: m test-art-host
Test: m test-art-target
Change-Id: Ia7159ddfa38f1f055e5cd6089c849a208d335752
(cherry picked from commit 6b2018f4b847a60f39c86d67e1cae8a00ce977bc)

7 years agosigchain: always call InitializeSignalChain on startup.
Josh Gao [Thu, 27 Apr 2017 02:09:47 +0000 (19:09 -0700)]
sigchain: always call InitializeSignalChain on startup.

Processes that link against libsigchain because they might want to
dynamically load libart.so (e.g. surfaceflinger) might never explicitly
call InitializeSignalChain. In this scenario, the lazy initialization
that occurs when sigprocmask is called can happen at unexpected times,
such as from pthread_exit, leading to deadlocks or crashes.

Add __attribute__((constructor)) to InitializeSignalChain to have it be
automatically called upon process start. Keep the existing calls to it
in the wrapper functions in order to sidestep problems around static
initialization order.

Bug: https://issuetracker.google.com/37119593
Test: run-test 004-SignalTest
Test: m test-art-host
Test: m test-art-target
Change-Id: I7906c1f625ccca0350ea9310140a3f43a657be4c
(cherry picked from commit fd4d0d3eb9b5c7fe2fa1df97d9c0763900b2be52)

7 years agoAdd test for getError() of NativeBridge.
Yanbing Jiang [Tue, 17 Jan 2017 05:23:43 +0000 (13:23 +0800)]
Add test for getError() of NativeBridge.

NativeBridge v3 introduced getError() of which the functionality
is same as dlerror(). This patch forces the routine of ART to
NativeBridge to execute getError() on ART host test by loading
invalid library from Java.

Test: make test-art-host-run-test-115-native-bridge
Change-Id: Iba389c22b6587176cbfe57d42af49041560c5b00
Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
(cherry picked from commit 2abb686ddbf7c8fe54f2c1cb41ab90d7c8b04c7a)

7 years agoDo not cache profiles in the ProfileSaver.
Calin Juravle [Sat, 13 May 2017 02:18:47 +0000 (19:18 -0700)]
Do not cache profiles in the ProfileSaver.

Profiles with a lot of inline caches have a large memory
footprint. Do not cache them in the saver anymore.

The cache was useful to avoid doing unnecessary IO but it
takes too much memory now. Disable it until we update the
profile format to take less space.

This trades off IO for memory. As an effect we will do one extra
read to detect if we have enough new information worth saving. The
saving period has been increased to 40secs (from 20) in a previous
CL which also helps to balance the IO.

Test: m test-art-host-gtest
      manual inspection with meminfo
Bug: 37711886

(cherry picked from commit ea220658bf6ff920c5a6c658e4643da09560d278)

Change-Id: Iddf93b2f07faf4c897ac43931f41aa1e8c2a6bc4

7 years agoMerge "ART: Fix iterator invalidation" into oc-dev
TreeHugger Robot [Tue, 16 May 2017 20:21:21 +0000 (20:21 +0000)]
Merge "ART: Fix iterator invalidation" into oc-dev

7 years agoMerge "Fix determinism for app images" into oc-dev
Mathieu Chartier [Tue, 16 May 2017 19:53:12 +0000 (19:53 +0000)]
Merge "Fix determinism for app images" into oc-dev

7 years agoFix determinism for app images
Mathieu Chartier [Fri, 12 May 2017 23:07:28 +0000 (16:07 -0700)]
Fix determinism for app images

Clear the dalvik.system.DexFile cookie to make the long array
unreachable before the GC.

Test: test-art-host
Test: Ran 10x: mma -j40 && shasum $OUT/system/framework/oat/arm64/services.* && rm $OUT/system/framework/oat/arm64/services.* && rm $OUT/obj/JAVA_LIBRARIES/services_intermediates/oat/arm64/*

Bug: 34090128

(cherry picked from commit 3738e98cb8833b24e998ec3b6906bf58850741c3)

Change-Id: I5a872de3e907461803a77254902d78ff6e657b43

7 years agoART: Fix iterator invalidation
Andreas Gampe [Tue, 16 May 2017 02:26:38 +0000 (19:26 -0700)]
ART: Fix iterator invalidation

Erasing an item of a map invalidates the iterator.

(cherry picked from commit 39e673811d73ac09a822d9ee0082bba5d8e8cbad)

Bug: 38324641
Test: m test-art-host
Change-Id: I9f7499eb4a4b49e4fcd6c99d170d9b681adfd9b0

7 years agoRevert "Revert "Use IsMarked instead of Mark for profiling info.""
Nicolas Geoffray [Thu, 11 May 2017 11:48:28 +0000 (11:48 +0000)]
Revert "Revert "Use IsMarked instead of Mark for profiling info.""

Bug in the original change was that we were infitely looping on the
same inline cache entry, expecting null when it was actually an old
pointer to a GC'ed class object.

bug: 37693252
Test: test.py --jit

This reverts commit 3afefba4b5558f5f726338485c1f6ddc7f107719.

(cherry picked from commit 13056a1720aca64945541812a3c7602acfe4a937)

Change-Id: Ia637d4a7db4394964d1de5c92370921c98a103fa

7 years agoMerge "Clear odex/vdex/art file before running run-test" into oc-dev
Calin Juravle [Sat, 13 May 2017 01:47:42 +0000 (01:47 +0000)]
Merge "Clear odex/vdex/art file before running run-test" into oc-dev

7 years agoMerge "Use a sentinel when clearing JIT table entries." into oc-dev
TreeHugger Robot [Fri, 12 May 2017 09:52:48 +0000 (09:52 +0000)]
Merge "Use a sentinel when clearing JIT table entries." into oc-dev

7 years agoClear odex/vdex/art file before running run-test
Calin Juravle [Thu, 11 May 2017 07:36:53 +0000 (00:36 -0700)]
Clear odex/vdex/art file before running run-test

This allows individual tests to call the RUN script
multiple times.

Test: ./test/testrunner/testrunner.py [--host|--target] [--no-prebuild]
Bug: 38213479

(cherry picked from commit 24bd3f9d63c81f448b7fe1854742fda0343a2297)

Change-Id: I9243b448f3601dec02615699a5bca7dd7472de53

7 years agoMerge changes I93c26ff3,I0dc1a141,I3a140ce0 into oc-dev
TreeHugger Robot [Thu, 11 May 2017 15:28:50 +0000 (15:28 +0000)]
Merge changes I93c26ff3,I0dc1a141,I3a140ce0 into oc-dev

* changes:
  ART: Add IterateThroughHeapExt
  ART: Refactor IterateThroughHeap
  ART: Add Heap JVMTI extension API

7 years agoUse a sentinel when clearing JIT table entries.
Nicolas Geoffray [Wed, 10 May 2017 14:09:35 +0000 (15:09 +0100)]
Use a sentinel when clearing JIT table entries.

This can help diagnosing crashes we see.

bug: 38128052
bug: 37949368
Test: test.py --jit

(cherry picked from commit 6ca115b5fa185a2cc162a453f425efd87d8f38bd)

Change-Id: Ib048f72cef7acfdb15f515c63a2ff0ac8e3744ce

7 years agoMerge "Handle safe mode in PackageManager." into oc-dev
Nicolas Geoffray [Thu, 11 May 2017 09:43:44 +0000 (09:43 +0000)]
Merge "Handle safe mode in PackageManager." into oc-dev

7 years agoART: Add IterateThroughHeapExt
Andreas Gampe [Wed, 10 May 2017 00:14:58 +0000 (17:14 -0700)]
ART: Add IterateThroughHeapExt

Add another heap extension. This is the same as IterateThroughHeap,
but delivers an additional parameter to the callback that is the
heap id.

(cherry picked from commit 2eb25e4513778c568919f99a053a79df3a5bbe17)

Bug: 37283268
Test: m test-art-host
Change-Id: I93c26ff3afe4205f00f2e4ed871384f862886746

7 years agoART: Refactor IterateThroughHeap
Andreas Gampe [Tue, 9 May 2017 23:04:20 +0000 (16:04 -0700)]
ART: Refactor IterateThroughHeap

Factor out callback. In preparation for extension API.

(cherry picked from commit f787fd3bc5476f73edb1722b4f6a09d52f69cd12)

Bug: 37283268
Test: m test-art-host
Change-Id: I0dc1a141afe43a415be9326bed24bd835dbbdc8c

7 years agoART: Add Heap JVMTI extension API
Andreas Gampe [Thu, 4 May 2017 04:40:26 +0000 (21:40 -0700)]
ART: Add Heap JVMTI extension API

Add extension API for Android heaps. Add a function that returns
the heap id for a tag (implying an object). Add a function that
returns the heap name for a given heap id.

Add tests.

(cherry picked from commit d73aba4f0c95914cc51144b0b609d9293e5341cf)

Bug: 37283268
Test: m test-art-host
Test: art/test/testrunner/testrunner.py -b --host -t 913
Test: cts-tradefed run cts-dev --module CtsJvmtiRunTest913HostTestCases
Change-Id: I3a140ce00a33507c9ac3263d0badd10f3daf558c

7 years agoMerge "ART: Fix GetErrorName." into oc-dev
TreeHugger Robot [Wed, 10 May 2017 20:11:43 +0000 (20:11 +0000)]
Merge "ART: Fix GetErrorName." into oc-dev

7 years agoMerge "Fix page accounting for multidex" into oc-dev
David Sehr [Wed, 10 May 2017 19:46:32 +0000 (19:46 +0000)]
Merge "Fix page accounting for multidex" into oc-dev

7 years agoART: Fix GetErrorName.
Andreas Gampe [Mon, 8 May 2017 21:50:47 +0000 (14:50 -0700)]
ART: Fix GetErrorName.

Add missing case for JVMTI_ERROR_THREAD_SUSPENDED. Also return
JVMTI_ERROR_ILLEGAL_ARGUMENT for unspecified inputs.

Refactor the code
* Remove the switch default case for case checking
* Use a lambda to unify the return code. This saves 4K of so size.

Add a test.

(cherry picked from commit 95c466dd3348a875e42f8d5b85bd7eaddfb43cb9)

Bug: 38133825
Test: m
Test: art/test/testrunner/testrunner.py -b --host -t 901
Change-Id: If46b276b8abcd8b7b8ebbac1106f6b840761b997

7 years agoMerge "Fix braino in enum use." into oc-dev
TreeHugger Robot [Wed, 10 May 2017 16:07:49 +0000 (16:07 +0000)]
Merge "Fix braino in enum use." into oc-dev

7 years agoMerge "ART: Fix null dereference for JSR45" into oc-dev
TreeHugger Robot [Wed, 10 May 2017 15:35:54 +0000 (15:35 +0000)]
Merge "ART: Fix null dereference for JSR45" into oc-dev

7 years agoMerge "Honor --force-determinism for vdex." into oc-dev
Nicolas Geoffray [Wed, 10 May 2017 14:05:15 +0000 (14:05 +0000)]
Merge "Honor --force-determinism for vdex." into oc-dev

7 years agoFix braino in enum use.
Nicolas Geoffray [Wed, 10 May 2017 11:04:49 +0000 (12:04 +0100)]
Fix braino in enum use.

bug:37655083
Test: jdwp

(cherry picked from commit 81cc43e7d3c4dcd197b3d3a0fa9d1a3be9413367)

Change-Id: I566cc66efc6e1377c53650bfca9e4ffa2ffcb533

7 years agoMerge "Add runtime reasons for deopt." into oc-dev
Nicolas Geoffray [Wed, 10 May 2017 13:53:35 +0000 (13:53 +0000)]
Merge "Add runtime reasons for deopt." into oc-dev

7 years agoART: Fix null dereference for JSR45
Orion Hodson [Tue, 9 May 2017 08:51:35 +0000 (09:51 +0100)]
ART: Fix null dereference for JSR45

Avoid dereferencing DEX cache pointer if it is null. Arrays and
primitive types do not have DEX cache's installed.

Test: art/tools/run-jdwp-tests.sh --mode=host
Bug: 38126955

(Cherry pick from commit cf7127b4a368ed26eaf257286173d5337f67a0a7)

Change-Id: Ie9219c688d009d28d090a75913af86d5d3ee7df6

7 years agoHonor --force-determinism for vdex.
Nicolas Geoffray [Fri, 28 Apr 2017 13:56:39 +0000 (14:56 +0100)]
Honor --force-determinism for vdex.

b/37442966
Test: build

(cherry picked from commit 46847395470e414cd2aa1c6ea13e9a3d08e2b46b)

Change-Id: I6b72b9d0d69f42a4f1ca46403647a172bb2c6e84

7 years agoMerge "Don't use free list LOS for --force-determinism." into oc-dev
TreeHugger Robot [Wed, 10 May 2017 12:00:31 +0000 (12:00 +0000)]
Merge "Don't use free list LOS for --force-determinism." into oc-dev

7 years agoHandle safe mode in PackageManager.
Nicolas Geoffray [Wed, 3 May 2017 12:08:36 +0000 (13:08 +0100)]
Handle safe mode in PackageManager.

ART side of the change.

bug:37929796
Test: manual OTA with a safemode app.

(cherry picked from commit 741d426f2eda2ea1f1a8d7dfce1cd741a6737cc6)

Change-Id: Ibdcd10392697188eb9cc7e572fc6224722db2987

7 years agoAdd runtime reasons for deopt.
Nicolas Geoffray [Mon, 8 May 2017 08:34:26 +0000 (09:34 +0100)]
Add runtime reasons for deopt.

Currently to help investigate. Also:
1) Log when deoptimization happens (which method and what reason)
2) Trace when deoptimization happens (to make it visible in systrace)

bug:37655083
Test: test-art-host test-art-target

(cherry picked from commit 4e92c3ce7ef354620a785553bbada554fca83a67)

Change-Id: I992398a1038ab61ea0e5106af6b6ad0a3305312e

7 years agoMerge "Be defensive in dex2oat when updating the vdex in-place." into oc-dev
Nicolas Geoffray [Wed, 10 May 2017 10:47:49 +0000 (10:47 +0000)]
Merge "Be defensive in dex2oat when updating the vdex in-place." into oc-dev

7 years agoBe defensive in dex2oat when updating the vdex in-place.
Nicolas Geoffray [Tue, 9 May 2017 12:23:34 +0000 (13:23 +0100)]
Be defensive in dex2oat when updating the vdex in-place.

Invalidate the vdex header before doing any writing, in case
dex2oat gets killed in the middle.

bug: 38113240
Test: test.py --speed-profile
Test: test.py 629-vdex

(cherry picked from commit 36930eca8cd6ed2bb78da0c1d013db6a92d80670)

Change-Id: I95c1f0a7b56646a9fbd0e0264ef698a44d79c474

7 years agoFix page accounting for multidex
David Sehr [Tue, 9 May 2017 22:41:09 +0000 (15:41 -0700)]
Fix page accounting for multidex

Dexdiag was using the offset into the mapping rather than into the dex
file for determining the types of pages.  This resulted in multidex
files having incorrect accounting.

Bug: 38181622
Test: make test-art-target-gtest-dexdiag_test
Change-Id: I00a4e21db5f57f75642a17e8edaa9c73b8b529b6

7 years agoLower flock LOG(FATAL) to LOG(WARNING)
Alex Light [Mon, 8 May 2017 17:18:47 +0000 (10:18 -0700)]
Lower flock LOG(FATAL) to LOG(WARNING)

Failing to unlock a file should not be a fatal error.

The lock will usually be cleared right after this anyway by the file
being closed. Even if it isn't though this should not cause deadlocks
since most places either don't retry if they don't get the lock the
first time or are separate binaries (such as dex2oat) that are run
with external timeouts.

Bug: 36369345
Test: ./test.py --host -j40
Change-Id: Icd783c038de3c263805e8de1bbc35b2ee8918340
(cherry picked from commit 9c48ee5bac5ef0d0af9c1ab079452c954affa019)

7 years agoMerge "Bump oat version after compiler filter name changes." into oc-dev
Nicolas Geoffray [Tue, 9 May 2017 08:17:02 +0000 (08:17 +0000)]
Merge "Bump oat version after compiler filter name changes." into oc-dev

7 years agoMerge "Do not fsync profiles on close" into oc-dev
TreeHugger Robot [Tue, 9 May 2017 02:20:16 +0000 (02:20 +0000)]
Merge "Do not fsync profiles on close" into oc-dev

7 years agoDo not fsync profiles on close
Calin Juravle [Fri, 28 Apr 2017 02:30:16 +0000 (19:30 -0700)]
Do not fsync profiles on close

There's no need to fsync profile data right away. We get
many chances to write it again in case something goes
wrong. We can rely on a simple close(), no sync, and let
the kernel decide when to write to disk. This should
improve the I/O behavior of saving profiles.

Bug: 36817443
Test: m test-art-host-gtest

(cherry picked from commit df674c45091d01f504bf1bb7d241678ecd449ae0)

Change-Id: Idf503beccf912e26f31abbcf66087afb9a8fe138

7 years agoResolve the tracked locations in profile saver
Calin Juravle [Sat, 6 May 2017 00:27:23 +0000 (17:27 -0700)]
Resolve the tracked locations in profile saver

The profile saver takes the dex locations it has to track as they are.
On the buildbot the locations are symlinked, but the dex file may be
compiled with an absolute path. This may cause a mismatch and cause the
dex file to not be profiled (test 595-profile-saving will fail).

Note that this is a valid use case in production as well. It may happen
for secondary dex files which can be loaded via symlinks.

Test: test/run-test --output-path /tmp/link --always-clean --host --prebuild --interpreter --no-relocate --runtime-option -Xcheck:jni --no-image --64 595-profile-saving
       test/run-test  --output-path /tmp/link --always-clean --host
--no-prebuild --jit --no-relocate --runtime-option -Xcheck:jni
--runtime-option -verbose:profiler --64  595-profile-saving

Bug: 36605597

(cherry picked from commit 8b5d9b614ad9f13e2cb62d4956252677cd71add1)

Change-Id: I43866c6cf7ce6f33ac4386bb4fe07b88bb35e793

7 years agoDon't use free list LOS for --force-determinism.
Nicolas Geoffray [Wed, 3 May 2017 14:04:55 +0000 (15:04 +0100)]
Don't use free list LOS for --force-determinism.

If the maximum capacity is too large, we can fail mapping the memory
required for it. See:
https://android-build.googleplex.com/builds/pending/P4254206/aosp_arm64-eng/latest)

So instead just disable the LOS.

Also fix concurrent collector assuming there is always a LOS.

Test: build
bug: 37442966

(cherry picked from commit 7acddd83065bc8b12ade9528a84e6fcadda21250)

Change-Id: Iec9f8139806a99af16212906315ab906ee2c9b3f

7 years agoBump oat version after compiler filter name changes.
Nicolas Geoffray [Fri, 5 May 2017 09:27:58 +0000 (10:27 +0100)]
Bump oat version after compiler filter name changes.

bug:37988580
Test: build

(cherry picked from commit f977691961b5a49a074a535fcb29a5ad4a318974)

Change-Id: If52e569b6403a8b3f2e31d472b6d11ab42d13763

7 years agoMerge "Revert "Revert "Ensure dex file are extracted and verified at load time""...
Calin Juravle [Fri, 5 May 2017 22:46:18 +0000 (22:46 +0000)]
Merge "Revert "Revert "Ensure dex file are extracted and verified at load time""" into oc-dev

7 years agoMerge "Check static field initial value types match in dex file verifier." into oc-dev
TreeHugger Robot [Fri, 5 May 2017 22:17:08 +0000 (22:17 +0000)]
Merge "Check static field initial value types match in dex file verifier." into oc-dev

7 years agoCheck static field initial value types match in dex file verifier.
Jeff Hao [Thu, 4 May 2017 21:12:56 +0000 (14:12 -0700)]
Check static field initial value types match in dex file verifier.

Can cause segmentation faults in the gc if object and primitive types
are mixed.

Bug: 34115871
Test: mm test-art-host-gtest-dex_file_verifier_test

(cherry-picked from commit 326c1a28c3e5d9e7ea1b39d60608eab5481e38b6)

Change-Id: Ie61c4b16deb5693f03abfa1a7ba0f4523e307eb3

7 years agoAdd dexlayout support for call sites and method handles.
Jeff Hao [Fri, 28 Apr 2017 01:00:38 +0000 (18:00 -0700)]
Add dexlayout support for call sites and method handles.

Tested that it works with Orion's test dex files. Can generate output
files that match the test input files.

Unit tests to follow.

Bug: 37732062
Test: mm test-art-host

(cherry-picked from commit 5daee90642aa44ac67e7e0c200204c86fa5425a8)

Change-Id: I834a1558506e99de17010d74dc5e8d83835f7f96

7 years agoRevert "Revert "Ensure dex file are extracted and verified at load time""
Calin Juravle [Thu, 4 May 2017 01:57:17 +0000 (01:57 +0000)]
Revert "Revert "Ensure dex file are extracted and verified at load time""

The issue was caused by running device-gtests as root (which will always
have full write access everywhere).

For now, disable the tests that rely on file permissions when running as
root.

Test: m test-art-target-gtest-oat_file_assistant_test
Bug: 36605597
Bug: 36824842

This reverts commit 9bfc6bb1f44797aec19a151e47c0902ef2516095.

(cherry picked from commit 357c66dcc20ce15108ecf05f5ecf69a80b383dab)

Change-Id: I73820b8ff9d78af8d9bcb232c8345a07c5788539

7 years agoMerge "ART: Fix test 912" into oc-dev
TreeHugger Robot [Fri, 5 May 2017 15:49:54 +0000 (15:49 +0000)]
Merge "ART: Fix test 912" into oc-dev

7 years agoMerge "Allow stripped APK to be compiled with a vdex." into oc-dev
Nicolas Geoffray [Fri, 5 May 2017 08:09:06 +0000 (08:09 +0000)]
Merge "Allow stripped APK to be compiled with a vdex." into oc-dev

7 years agoMerge "Fixed bug due to not updating TC information (with regression test)" into...
Aart Bik [Thu, 4 May 2017 15:58:40 +0000 (15:58 +0000)]
Merge "Fixed bug due to not updating TC information (with regression test)" into oc-dev

7 years agoART: Fix test 912
Andreas Gampe [Thu, 4 May 2017 05:28:43 +0000 (22:28 -0700)]
ART: Fix test 912

Pass a descripter instead of a name.

Partial revert of commit 31c88580deb129f99f6b9835c6e21cb86a875f88.

(cherry picked from commit a164ec5b3811ba29a9fd83df9f318f07973224ce)

Bug: 36344364
Test: art/test/testrunner/testrunner.py -b --host --jit --no-prebuild --no-dex2oat -t 912
Test: art/test/testrunner/testrunner.py -b --host -t 912
Change-Id: I94085445bbc37f4b932dd4477763f114accbbc3c

7 years agoAllow stripped APK to be compiled with a vdex.
Nicolas Geoffray [Tue, 25 Apr 2017 16:36:51 +0000 (17:36 +0100)]
Allow stripped APK to be compiled with a vdex.

bug: 37558732
Test: oat_file_assistant_test
Test: "adb shell cmd package compile" of a stripped /system apk

(cherry picked from commit 08e9eed8f609c0917b27e15a6bfb5a05d8cb3e2b)

Change-Id: I26afa07936ef8270eda91349ce8d2f742c3b0caf

7 years agoMerge "Update knownfailures.json." into oc-dev
Nicolas Geoffray [Thu, 4 May 2017 08:36:29 +0000 (08:36 +0000)]
Merge "Update knownfailures.json." into oc-dev

7 years agoMerge "runtime: Properly unload partially loaded image spaces" into oc-dev
TreeHugger Robot [Wed, 3 May 2017 23:11:44 +0000 (23:11 +0000)]
Merge "runtime: Properly unload partially loaded image spaces" into oc-dev

7 years agoFixed bug due to not updating TC information
Aart Bik [Wed, 3 May 2017 21:29:20 +0000 (14:29 -0700)]
Fixed bug due to not updating TC information
(with regression test)

Bug: 37768917
Test: test-art-target, test-art-host

(cherry picked from commit e22445fba0e5747ea787429ac64577a9a62aded3)

Change-Id: I505106ef7ab8eed1e37067b39d6ef657ee234292

7 years agoMerge "Increase profile saver minimum save period to 40 seconds" into oc-dev
Calin Juravle [Wed, 3 May 2017 18:41:49 +0000 (18:41 +0000)]
Merge "Increase profile saver minimum save period to 40 seconds" into oc-dev

7 years agoMerge "inliner: Do not assume that the outermost_graph has an art method" into oc-dev
Calin Juravle [Wed, 3 May 2017 18:24:14 +0000 (18:24 +0000)]
Merge "inliner: Do not assume that the outermost_graph has an art method" into oc-dev

7 years agoruntime: Properly unload partially loaded image spaces
Igor Murashkin [Tue, 2 May 2017 22:58:02 +0000 (15:58 -0700)]
runtime: Properly unload partially loaded image spaces

When one of the (non-app) image space successfully loads,
it sets up runtime callee-save methods.

If it is later unloaded, callee-save methods are now pointing to memory
that is no longer valid (viewed as all 0s in the debugger).

Runtime::Init skips creating its own runtime methods if it already sees
that the runtime methods were set to non-null, thus dangling runtime
methods.

This crash would nominally manifest itself in unwinding the first time, or as a DCHECK
failure in the interpreter bridge invocation during aborting if debugging was enabled.

To get into this state:
* Fill up the /data partition (but perhaps leave a little bit of room
for one image, but not all images)
* Reboot the device or run zygote manually.

(cherry picked from commit 8275fbaccc012072948a16f537844a552db9be84)

Test: adb shell dd if=/dev/zero of=/data/local/tmp/tempFiller.deleteMe bs=1024 count=50g ; adb reboot
Bug: 36033084
Change-Id: I728c1058b003fcf5e98dc2746d53e44b688c4605

7 years agoinliner: Do not assume that the outermost_graph has an art method
Calin Juravle [Sat, 29 Apr 2017 02:58:01 +0000 (19:58 -0700)]
inliner: Do not assume that the outermost_graph has an art method

The outermost method may be in an unresolved class. If that's the case
do not assume anything about the referrer in HLoadClass.

Test: m test-art-host
Bug: 37588888

(cherry picked from commit 07f01dfa26e97f48662b6ef40fdc0926cecd7664)

Change-Id: If9974195a0b5d026c1eb16477f9cd95e83c911ec

7 years agoIncrease profile saver minimum save period to 40 seconds
Calin Juravle [Mon, 1 May 2017 22:14:44 +0000 (15:14 -0700)]
Increase profile saver minimum save period to 40 seconds

We save much more data with the addition of inline caches. Balance
amount of data with save period: save more but less often.
This relies on the assumptions that the number of apps being killed
in less than 40 seconds is actually small.

The 40 seconds number is pulled mostly out of thin air. Some
experiments show that we don't necessarily lose data when increasing
the period. I only looked at file sizes and the number of profile writes
to verify that we get a comparable amount of information between 20 and
40 seconds. (I did not do a delta on the profile content).

The test scenario was:
- clear all profiles
- boot the device and let it settle for 2 minutes
- open maps and navigate to a destination, search for restaurants
- open gmail and send an email
- open playstore and inspect the top charts
- open youtube and play a video
- open docs and write in a document
- all app interaction are kept below 40 seconds
- wait 1 minute to settle any pending saves
- take a bug report and look at profile stats

With 20 seconds: 43 profile writes, summing 1605610 bytes.
With 40 seconds: 35 profile writes, summing 1243217 bytes.

There is the obvious trade-off that apps being killed in less than
40 seconds will not get profiles.

Bug: 36281963
Test: m test-art-host
      manual device tests to verify the profile gets saved

(cherry picked from commit 806843aa293d45d88edeccd49eb5d281ff7d844f)

Change-Id: I8108c8fe41616fb14c710f8f015c50ff332d1e6b

7 years agoUpdate knownfailures.json.
Nicolas Geoffray [Wed, 3 May 2017 14:43:49 +0000 (15:43 +0100)]
Update knownfailures.json.

Extracted from:
https://googleplex-android-review.git.corp.google.com/#/c/2194222/

To avoid the merge conflict.

bug: 37558732
Test: run-test with speed-profile
Change-Id: Ieeae28f2c95870c655055075c4ab2207e58ae335

7 years agoMerge "Make vdex and dexlayout compatible." into oc-dev
TreeHugger Robot [Wed, 3 May 2017 11:56:22 +0000 (11:56 +0000)]
Merge "Make vdex and dexlayout compatible." into oc-dev

7 years agoMake vdex and dexlayout compatible.
Nicolas Geoffray [Fri, 21 Apr 2017 16:16:44 +0000 (17:16 +0100)]
Make vdex and dexlayout compatible.

Unquicken the vdex before dexlayout, to keep the dex integrity.

bug: 37558732
Test: run-test with speed-profile

(cherry picked from commit 4e868fa7b8c47600695ff92deeb373674956a67d)

Change-Id: I57ddabb79ff49d01df80bed4e3e53ba8fdb5346e

7 years agoART: Additional verifier flags for invoke-custom
Orion Hodson [Tue, 2 May 2017 11:25:45 +0000 (12:25 +0100)]
ART: Additional verifier flags for invoke-custom

Updates verifier flags for invoke-custom instructions and adds
static_asserts to enforce at build time.

Bug: 37766116
Test: m

(cherry picked from commit d81047086eb3ac5f34314c0c56b4bd602b9e853d)

Change-Id: I5ade3250f5df877e012d2f291ad8e27169b10d49

7 years agoMerge "If a profile is passed, we should always pass output-vdex and input-vdex....
Nicolas Geoffray [Wed, 3 May 2017 08:04:28 +0000 (08:04 +0000)]
Merge "If a profile is passed, we should always pass output-vdex and input-vdex." into oc-dev

7 years agoMerge "Rename and obsolete compiler filter names." into oc-dev
Nicolas Geoffray [Wed, 3 May 2017 08:04:28 +0000 (08:04 +0000)]
Merge "Rename and obsolete compiler filter names." into oc-dev

7 years agoBug fix on shift that exceeds "lane width".
Aart Bik [Mon, 1 May 2017 23:50:45 +0000 (16:50 -0700)]
Bug fix on shift that exceeds "lane width".

Rationale:
ARM is a bit less forgiving on shifting more than
the lane width of the SIMD instruction (rejecting
such cases is no loss, since it yields 0 anyway
and should be optimized differently).

Bug: 37776122
Test: test-art-target, test-art-host

(cherry picked from commit 65ffd8ef044465c47d4f97ab2556310f9ee30a01)

Change-Id: If65148eb0e8e705f48778549b7e31b8077cd233b

7 years agoMerge "Allow same-length integral type mixing in SIMD." into oc-dev
Aart Bik [Wed, 3 May 2017 03:04:25 +0000 (03:04 +0000)]
Merge "Allow same-length integral type mixing in SIMD." into oc-dev

7 years agoAllow same-length integral type mixing in SIMD.
Aart Bik [Mon, 1 May 2017 21:49:18 +0000 (14:49 -0700)]
Allow same-length integral type mixing in SIMD.

Rationale:
Just like the incoming sequential code, the SIMD
code allows for some type matching, as long as
it is integral and same length.

Bug: 37764324
Test: test-art-target, test-art-host
Change-Id: Ide1c5403e0f3b8c5372e8ac6dd282d8211ca8f1b

7 years agoFix length of descriptor field when reading debug info.
Jeff Hao [Tue, 2 May 2017 00:29:35 +0000 (17:29 -0700)]
Fix length of descriptor field when reading debug info.

TypeIndex is a 16-bit value, and storing kDexNoIndex (0xFFFFFFFF) caused
a failure in a dcheck on the bounds of the value.

Bug: 37287051
Test: mm -j31 test-art-host-gtest-dex_file_test

(cherry-picked from commit c12253611eea875d9e3299bac596be4224f7db00)

Change-Id: If5ae2b624886177d66b3a33ccd75509496deab40

7 years agoMerge "Fix unquickening in the presence of duplicate methods." into oc-dev
TreeHugger Robot [Tue, 2 May 2017 14:50:25 +0000 (14:50 +0000)]
Merge "Fix unquickening in the presence of duplicate methods." into oc-dev

7 years agoMerge "ART: Support for SourceDebugExtension" into oc-dev
Orion Hodson [Tue, 2 May 2017 11:57:29 +0000 (11:57 +0000)]
Merge "ART: Support for SourceDebugExtension" into oc-dev

7 years agoIf a profile is passed, we should always pass output-vdex and input-vdex.
Nicolas Geoffray [Thu, 27 Apr 2017 20:45:35 +0000 (21:45 +0100)]
If a profile is passed, we should always pass output-vdex and input-vdex.

Passing only input-vdex means the vdex will be updated in place, which
is not something we do with a profile in production.

Test: 629-vdex

(cherry picked from commit fbc4f118aff7c284f0d9d2ca209166b7ff79e542)

Change-Id: Ie7afabe7e017476fe5347781f304043db2555462

7 years agoRename and obsolete compiler filter names.
Nicolas Geoffray [Fri, 21 Apr 2017 12:08:25 +0000 (13:08 +0100)]
Rename and obsolete compiler filter names.

ART side of the change.

bug:34715556
Test: test-art-host, jdwp, libcore

(cherry picked from commit 49cda06d5bf003f588ba7839bbf89d606237dfa7)

Change-Id: I85126e5035f0f6fc15aa84d41af5f1d6e25a5f55

7 years agoMerge "Allow dexlayout to handle duplicate code items." into oc-dev
TreeHugger Robot [Mon, 1 May 2017 22:22:24 +0000 (22:22 +0000)]
Merge "Allow dexlayout to handle duplicate code items." into oc-dev

7 years agoMerge "Add basic heap corruption detection ConcurrentCopying::Copy" into oc-dev
TreeHugger Robot [Mon, 1 May 2017 22:13:08 +0000 (22:13 +0000)]
Merge "Add basic heap corruption detection ConcurrentCopying::Copy" into oc-dev

7 years agoAllow dexlayout to handle duplicate code items.
Jeff Hao [Wed, 26 Apr 2017 19:09:06 +0000 (12:09 -0700)]
Allow dexlayout to handle duplicate code items.

Dexlayout now checks to see if a code item already exists at a
particular offset before trying to construct a new one. If so, the
existing one is returned instead.

Bug: 37287151
Test: mm test-art-host-gtest-dexlayout_test
Change-Id: Iea21df01033e127de011568e1fe66224e260e202
(cherry-picked from commit d212d5b4dcd8ebee9858d863062d7f827ea3a9ea)

7 years agoAdd basic heap corruption detection ConcurrentCopying::Copy
Mathieu Chartier [Sat, 29 Apr 2017 01:58:59 +0000 (18:58 -0700)]
Add basic heap corruption detection ConcurrentCopying::Copy

Detect objects that have a null class. This also detects objects that
are not in the from-space allocated area since this area is zero
initialized.

Test: test-art-host

Bug: 37683299
Bug: 12687968
Bug: 37187694
Change-Id: Ib7b9a1913a582692ce05791104c181b75e0f7bcb

7 years agoLayout codeitems based on profile data
Shubham Ajmera [Mon, 3 Apr 2017 17:04:28 +0000 (10:04 -0700)]
Layout codeitems based on profile data

Bug: 35800981
Bug: 37287151 (TL triaged bug dependent on this)
Test: ./art/test/testrunner/testrunner.py --host -t 638-c
Change-Id: I7beef8aae2d085333e0c2bfc0706c7f42f8e5f5f

(cherry-picked from commit 36a282b8714071d9f16c98c316efa4304fd8d36a)

7 years agoMerge "oat_file_manager: Avoid global collision check." into oc-dev
Calin Juravle [Mon, 1 May 2017 18:03:02 +0000 (18:03 +0000)]
Merge "oat_file_manager: Avoid global collision check." into oc-dev