OSDN Git Service

android-x86/art.git
4 years agoMerge tag 'android-7.1.2_r39' into nougat-x86 nougat-x86 android-x86-7.1-r3 android-x86-7.1-r4 android-x86-7.1-r5
Chih-Wei Huang [Wed, 16 Oct 2019 13:51:08 +0000 (21:51 +0800)]
Merge tag 'android-7.1.2_r39' into nougat-x86

Android 7.1.2 Release 39 (5787804)

4 years agoUse conservative permissions when creating files in ART
Calin Juravle [Thu, 23 May 2019 20:14:35 +0000 (13:14 -0700)]
Use conservative permissions when creating files in ART

Use 644 permissions by default so that only the owner has write-rights.

Bug: 130821293
Test: host run-test & gtest
Merged-In: Ic4dae399a5bfe862aff3d8614c45b38044d805db
Merged-In: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853
Change-Id: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853
(cherry picked from commit e69642936ef28e09970e8a3abb36f31e3d7d17bf)

6 years agoART: Change main-thread thread paging scheme android-x86-7.1-r1 android-x86-7.1-r2
Andreas Gampe [Thu, 29 Jun 2017 00:20:15 +0000 (17:20 -0700)]
ART: Change main-thread thread paging scheme

Modify the code that ensures we can install a stack guard page into
the main thread.

A recent kernel change means that our previous approach of using a
free pointer does not work. It is important to actually extend the
stack properly. For portability, use a function with a large stack
frame (suggested by and adapted from hboehm).

Bug: 62952017
Test: m
Test: m test-art-host
Test: Device boots (x86_64 emulator)
Test: Device boots (bullhead)
Change-Id: Ic2a0c3d6d05a1ea9f655329d147b46949e1b9db3

7 years agoRevert "Revert "ART: Give JIT thread pool workers a peer""
Andreas Gampe [Mon, 30 Jan 2017 16:40:49 +0000 (16:40 +0000)]
Revert "Revert "ART: Give JIT thread pool workers a peer""

This reverts commit 9dfb707ba2f8c2ff67d42c26e3214f5d7142b6d3.

Accept a live Java thread for the JIT, and adjust the tests
accordingly.

(cherry picked from commit 4471e4f7c5874bdaf93762b6047d4a4bebc465df)

Bug: 31684920
Test: m ART_TEST_JIT=true ART_TEST_INTERPRETER=true test-art-host
Change-Id: I92cbae1eaae05711b9069335cf1a5f7eb58b9fd8

7 years agoART: Add ThreadPool mode that creates peers
Andreas Gampe [Tue, 24 Jan 2017 21:12:19 +0000 (13:12 -0800)]
ART: Add ThreadPool mode that creates peers

Add a mode where worker threads in a thread pool will get a Java
peer. Add a test.

(cherry picked from commit b15de0c0580633701c19c32bb60bcd64f30da867)

Bug: 29547798
Bug: 31684920
Test: m test-art-host-gtest-thread_pool_test
Change-Id: I3654cc2be1294a79881b6ac9f84445a1e7f24b70

7 years agoAdd Thread entry to signal if the thread can call into java
Calin Juravle [Thu, 15 Dec 2016 17:57:38 +0000 (17:57 +0000)]
Add Thread entry to signal if the thread can call into java

Compiler threads (AOT or JIT) should not call into Java as they have no
peers (which may lead to crashes, e.g. b/33067273)

(cherry picked from commit ccd56958eb46fbb00c1eb45c7a7b23d5bbfd7698)

Bug: 32602185
Bug: 33067273

Test: m test-art-host-run-test; m test-art-host-gtest
Change-Id: I97dda7a5444643db3c5d5318339a65a602f709e8

7 years agoCache flush/invalidate needs RWX permission
Artem Udovichenko [Thu, 17 Nov 2016 07:51:58 +0000 (10:51 +0300)]
Cache flush/invalidate needs RWX permission

When generating JIT code, perform cache maintenance operations before
removing page write permissions. Errata on some cores require data
flush operations to be followed by data invalidate operations
requiring write permission.

Test: ART_TEST_JIT=true test-art-target on an arm64 device.
bug: 27265969

(cherry picked from commit b18a669259aa6ba08d9ca01b5b32c1aa0417138b)

Change-Id: I53080c664f9e7cfebe25f87cf6a45cd6eb33b281

7 years agoDelete extra arm64/mips64 MterpReturn suspend check
Mathieu Chartier [Tue, 10 Jan 2017 02:48:11 +0000 (18:48 -0800)]
Delete extra arm64/mips64 MterpReturn suspend check

Doing a suspend check after moving the result into the shadow frame
result_register_ is not safe since result_register_ is not a GC
root. The suspend check is unnecessary since the opcodes that branch
to MterpReturn already do a suspend check.

This could maybe explain one crash for CC that was seen after calling
a getter that had no compiled code.

The extra suspend check appears to only be present on arm64 amd mips64.

Test: test-art-target ART_TEST_INTERPRETER=true, N5X booting

(cherry picked from commit aceff18580b94a586a469110565f2ba166f3635a)

Bug: 33211261
Change-Id: I70b8863f40a25a26f278ac8ef0d57e083b663e0f

7 years agoMerge "Add visiting for class loaders in StickyMarkSweep" into nyc-mr2-dev
Mathieu Chartier [Fri, 6 Jan 2017 01:36:37 +0000 (01:36 +0000)]
Merge "Add visiting for class loaders in StickyMarkSweep" into nyc-mr2-dev

7 years agoAdd visiting for class loaders in StickyMarkSweep
neo.chae [Mon, 7 Nov 2016 23:40:46 +0000 (08:40 +0900)]
Add visiting for class loaders in StickyMarkSweep

StickyMarkSweep clear the mark stack,
Because all reachable objects must be referenced by a root or a dirty card.
But, there are some marking hole for class object.

If some object is marked and the object and it's class object is not dirty,
Then class object cannot be marking by card table.

In previous OS including mashmellow,
Class table was maintaned by class linker
and all class object was marked with kVisitRootFlagAllRoots flag.

In N OS,
Class object is not marked with kVisitRootFlagAllRoots.
So, I added new flag to mark class object and using it StickyMarkSweep.

Added regression test in 141-class-unload.

Test: test-art-host
Merged-In: I57599e6db53b260f4c5ef466b63962141b8da5c3

(cherry picked from commit a2d1b28599e38ee0180f0f7130a879eac5be9dec)

Bug: 33924225

Change-Id: I57599e6db53b260f4c5ef466b63962141b8da5c3
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
7 years agoRevert "Revert "Prune uses library classes even without profile DO NOT MERGE""
Mathieu Chartier [Thu, 5 Jan 2017 18:58:45 +0000 (10:58 -0800)]
Revert "Revert "Prune uses library classes even without profile DO NOT MERGE""

No evidence that the fix was causing crashes.

Bug: 33718412
Bug: 30688277
Bug: 31427727

This reverts commit fc9bec20893d50f9c92c7c25845f2f425f4de052.

Test: test-art-host

Change-Id: Ib05e9a3ac6079ac246cb2ff00ea133aeddf5cbf3

7 years agoRevert "Prune uses library classes even without profile DO NOT MERGE"
Griff Hazen [Mon, 19 Dec 2016 19:57:09 +0000 (19:57 +0000)]
Revert "Prune uses library classes even without profile DO NOT MERGE"
am: fc9bec2089

Change-Id: I7037166ff62642a6c75438d59182ba8ccaf111a6

7 years agoRevert "Prune uses library classes even without profile DO NOT MERGE"
Griff Hazen [Mon, 19 Dec 2016 18:15:53 +0000 (18:15 +0000)]
Revert "Prune uses library classes even without profile DO NOT MERGE"

This fix may be causing other crashes e.g. b/33718412.

Bug: 33718412
Bug: 30688277
Bug: 31427727

This reverts commit 8394cee5f0f87ddeeb8f33c199fa21e0cdee9073.

Change-Id: Ie19ece9d8ae1afef8b578482fae1cdbd35ff930d

7 years agoMerge "Prune uses library classes even without profile" into nyc-mr2-dev
Mathieu Chartier [Fri, 16 Dec 2016 01:20:02 +0000 (01:20 +0000)]
Merge "Prune uses library classes even without profile" into nyc-mr2-dev

7 years agoPrune uses library classes even without profile
Mathieu Chartier [Fri, 5 Aug 2016 23:09:09 +0000 (16:09 -0700)]
Prune uses library classes even without profile

The previous pruning relied on the classes being pruned from the
profile, and then using the profile to prune classes. If there was
no profile, the uses library classes were incorrectly left unpruned.

Leaving these classes unpruned caused aborts during compilation.

Bug: 30688277

Test: adb shell dex2oat --runtime-arg -classpath --runtime-arg /system/framework/com.google.android.maps.jar --dex-file=/data/app/comb.BBClient-1/base.apk --dex-location=/data/app/comb.BBClient-1/base.apk --oat-file=/data/app/comb.BBClient-1/oat/arm/base.odex  --app-image-file=/data/app/comb.BBClient-1/oat/arm/base.art --image-format=lz4 --compiler-filter=speed

(cherry picked from commit c27bc405312845bda4e25cd24e93211dfc7d7308)

Change-Id: I261b8894847b5b0a4f7330f49666e823a1b38bb0

7 years agoPrune uses library classes even without profile DO NOT MERGE
Mathieu Chartier [Thu, 15 Dec 2016 05:54:01 +0000 (05:54 +0000)]
Prune uses library classes even without profile DO NOT MERGE
am: 8394cee5f0

Change-Id: I20a21470cee6c52c50b5ed04ec13c3e17528770a

7 years agoPrune uses library classes even without profile DO NOT MERGE
Mathieu Chartier [Fri, 5 Aug 2016 23:09:09 +0000 (16:09 -0700)]
Prune uses library classes even without profile DO NOT MERGE

The previous pruning relied on the classes being pruned from the
profile, and then using the profile to prune classes. If there was
no profile, the uses library classes were incorrectly left unpruned.

Leaving these classes unpruned caused aborts during compilation.

Cherry picked from https://android-review.googlesource.com/#/c/312750/

Bug: 30688277
Bug: 31427727

Test: adb shell dex2oat --runtime-arg -classpath --runtime-arg /system/framework/com.google.android.maps.jar --dex-file=/data/app/comb.BBClient-1/base.apk --dex-location=/data/app/comb.BBClient-1/base.apk --oat-file=/data/app/comb.BBClient-1/oat/arm/base.odex  --app-image-file=/data/app/comb.BBClient-1/oat/arm/base.art --image-format=lz4 --compiler-filter=speed

Change-Id: I261b8894847b5b0a4f7330f49666e823a1b38bb0

7 years agoFix event reporting from the debugger thread
Sebastien Hertz [Tue, 22 Nov 2016 13:55:04 +0000 (14:55 +0100)]
Fix event reporting from the debugger thread

The debugger thread may trigger events (like CLASS PREPARE after the
initalization of a class while processing a command).

This CL removes the incorrect CHECK that makes the runtime abort in
this case. However, we do check that only the debugger thread can
report an event while it is already processing a command.

Bug: 33032664
Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X64'

(cherry picked from commit af8bcf83535cd7bf5651ada2fb08a0ba9c5191d6)

Change-Id: Id2e4362393203935e820586560800b300c6dd3a3

7 years agoART: Prioritize reference table dump
Andreas Gampe [Tue, 15 Nov 2016 01:00:28 +0000 (17:00 -0800)]
ART: Prioritize reference table dump

Sort the reference table summary dump by highest count, prioritizing
repeated types and instances. This will help with triaging leaks.

Add a test.

(cherry picked from commit 6e970e7fa88efd5ee38b0d6f9010a3985c62778f)

Bug: 32857749
Test: m test-art-host-gtest-reference_table_test
Merged-In: Id9c7a118c36c06c7510b13c2a51e63f08a27c564
Change-Id: I7e61881b5badf9ac2b6b72333f31437ab498caee

7 years agoEnsure OpenDexFilesFromImage closes file to prevent file descriptor leak
Brian Carlstrom [Mon, 17 Oct 2016 15:27:26 +0000 (15:27 +0000)]
Ensure OpenDexFilesFromImage closes file to prevent file descriptor leak
am: 645e477c2c

Change-Id: I071d7c8a53641981673387295c51757e5e18e635

7 years agoEnsure OpenDexFilesFromImage closes file to prevent file descriptor leak
Brian Carlstrom [Fri, 14 Oct 2016 08:04:26 +0000 (01:04 -0700)]
Ensure OpenDexFilesFromImage closes file to prevent file descriptor leak

Test: m -j32 test-art-host
Bug: 32095919
Change-Id: I44541edeb403a508e1b9794ee09fb1f55e3f42bf

7 years agoART: Reprint long messages on abort
Andreas Gampe [Wed, 5 Oct 2016 02:31:13 +0000 (02:31 +0000)]
ART: Reprint long messages on abort
am: 47d522b27f

Change-Id: I0b82fa7b714688b9971eae9c7711821a2c0b32b2

7 years agoART: Clean up IRT-related abort messaging
Andreas Gampe [Wed, 5 Oct 2016 02:31:06 +0000 (02:31 +0000)]
ART: Clean up IRT-related abort messaging
am: 15b7c90ab8

Change-Id: I9a5f61d7d6952f88ea457e15365e19cc13071844

7 years agoART: Reprint long messages on abort
Andreas Gampe [Tue, 4 Oct 2016 02:47:08 +0000 (19:47 -0700)]
ART: Reprint long messages on abort

Add an abort message parameter to Runtime::Abort. In case the message
is multiline (and will thus not be completely preserved in the
Android abort reason), reprint the message after all threads have
been dumped.

Bug: 31893081
Test: m test-art-host
Change-Id: I65bc77691fec79f7c868a90d6132805fcc91e473
(cherry picked from commit 90a32b16feb58d4edf932fdcb6a070be3418e365)

7 years agoART: Clean up IRT-related abort messaging
Andreas Gampe [Mon, 3 Oct 2016 18:42:31 +0000 (11:42 -0700)]
ART: Clean up IRT-related abort messaging

Change AbortIfNoCheckJNI to take the abort message as a parameter.
This way it can be passed down.

Bug: 31893081
Test: m test-art-host
Change-Id: Ib24c7060f1b32c9613ab84e6c1966082c866bc14
(cherry picked from commit f1e8630fe8eab89e61e9f0a97135ae7c9d38ce23)

7 years agoDO NOT MERGE: Update Oat version to 088
Alex Light [Wed, 28 Sep 2016 22:09:05 +0000 (22:09 +0000)]
DO NOT MERGE: Update Oat version to 088
am: ae444410cc

Change-Id: I44f82f443b449733dadbc1e262aac83a782c76a5

7 years agoDO NOT MERGE: Update Oat version to 088
Alex Light [Wed, 28 Sep 2016 18:27:11 +0000 (11:27 -0700)]
DO NOT MERGE: Update Oat version to 088

Give N-MR1 a different oat version to prevent compatibility problems
with NYC.

Bug: 31789675
Test: mma test-art-host
Test: Phone boots and runs apps
Change-Id: I6a922e8ac932dbf36a19431c4f34c2ace6f34609

7 years agoART: Dump referenced type in IRT overflows
Andreas Gampe [Wed, 28 Sep 2016 06:46:04 +0000 (06:46 +0000)]
ART: Dump referenced type in IRT overflows
am: 280f32b095

Change-Id: I6dedb3915fd67c08e45218892a7c909d397d9733

7 years agoART: Dump referenced type in IRT overflows
Andreas Gampe [Wed, 28 Sep 2016 01:45:02 +0000 (18:45 -0700)]
ART: Dump referenced type in IRT overflows

When the runtime dumps a reference table, e.g., when aborting for
an overflow, dump the type of stored referents for reference types
to aid in debugging leaks.

Bug: 31600693
Change-Id: Ia892dc84ca8827dd93a8b75d6f571c392f94859c

7 years agoMake test for app-image loading.
Alex Light [Mon, 26 Sep 2016 17:57:40 +0000 (17:57 +0000)]
Make test for app-image loading.
am: d3997bd98a

Change-Id: I19963f3dca87677b02e52dcc403c6c66b33f352c

7 years agoMake test for app-image loading.
Alex Light [Tue, 3 May 2016 22:01:06 +0000 (15:01 -0700)]
Make test for app-image loading.

Bug: 26882072

(cherry picked from commit 2e960a075cd30a1fdfc31597c4a64f1fca026efd)

Test: test/run-test --host --no-relocate 596-app-images

Change-Id: I40a45e7944aec3a5ee28ef3d47e9881f61a7c9e6

7 years agoSmarter image layout
Mathieu Chartier [Fri, 23 Sep 2016 21:51:44 +0000 (21:51 +0000)]
Smarter image layout
am: 4e9c4e7466

Change-Id: Iba240ee3bbb768f258ab7bc3aa22325fd4d7992a

7 years agoSmarter image layout
Mathieu Chartier [Tue, 20 Sep 2016 22:33:31 +0000 (15:33 -0700)]
Smarter image layout

Put strings in the dex file that resolves them.

Depth first traversal with overrides for class and dex cache. The
work list keeps track of what oat_index with each pushed item. This
means the static fields of a class will usually be in the same image.

Added layout test to image_test to make sure things are somewhat
reasonably attributed.

Bug: 28640955

Test: test-art-host

Change-Id: I67a536c33aeed603b252d8e0f75622c9efbf2559

7 years agoMerge "Make image test multi image" into nyc-mr1-dev
Mathieu Chartier [Thu, 22 Sep 2016 02:48:10 +0000 (02:48 +0000)]
Merge "Make image test multi image" into nyc-mr1-dev
am: 41be588f4f

Change-Id: I427a63c24354ca8f6f8df788881730b95128e16b

7 years agoMake image test multi image
Mathieu Chartier [Thu, 22 Sep 2016 02:48:09 +0000 (02:48 +0000)]
Make image test multi image
am: 25adcfb7dc

Change-Id: Iea181f7ef946b7a063d3424845774517011fc706

7 years agoMerge "Make image test multi image" into nyc-mr1-dev
TreeHugger Robot [Thu, 22 Sep 2016 02:00:45 +0000 (02:00 +0000)]
Merge "Make image test multi image" into nyc-mr1-dev

7 years agoMake image test multi image
Mathieu Chartier [Wed, 21 Sep 2016 22:24:18 +0000 (15:24 -0700)]
Make image test multi image

Required for testing multi image layout in future CLs.

Bug: 28640955

Test: clean-oat-hos, test-art-host, device booting

Change-Id: I14809f56e711b4a87e01056c327eddbbd087f4ee

7 years agoEnsure class is initialized when reading its fields from debugger.
Jeff Hao [Tue, 20 Sep 2016 18:12:03 +0000 (18:12 +0000)]
Ensure class is initialized when reading its fields from debugger.
am: 894f3fd2bb

Change-Id: Iadd8832ab37487dd838c164c066637972c549c17

7 years agoEnsure class is initialized when reading its fields from debugger.
Jeff Hao [Wed, 14 Sep 2016 22:56:35 +0000 (15:56 -0700)]
Ensure class is initialized when reading its fields from debugger.

Bug: 31016523
Test: mm run-jdwp-tests-ri & mm run-jdwp-tests-host

(cherry-picked from commit de19a25625823496bcf8f92352f709c7a3924bfa)

Change-Id: I02f6c66116f4507c89f7ca1cb480d7029d97c485

7 years agoMerge "Fix vtable corruption issue" into nyc-mr1-dev
Alex Light [Fri, 9 Sep 2016 21:56:37 +0000 (21:56 +0000)]
Merge "Fix vtable corruption issue" into nyc-mr1-dev
am: 949ce9c1da

Change-Id: Ic5fc1c6cd47d3620676a5fb4357f09f4727087b9

7 years agoFix vtable corruption issue
Alex Light [Fri, 9 Sep 2016 21:56:37 +0000 (21:56 +0000)]
Fix vtable corruption issue
am: b47a1cc17f

Change-Id: I0f94ef0789b8a15525e38765e45c4a3383af643e

7 years agoMerge "Fix vtable corruption issue" into nyc-mr1-dev
TreeHugger Robot [Fri, 9 Sep 2016 21:51:51 +0000 (21:51 +0000)]
Merge "Fix vtable corruption issue" into nyc-mr1-dev

7 years agoDon't assume resolved classses are filled in for ResolvedFieldAccessTest
Mathieu Chartier [Fri, 9 Sep 2016 20:20:59 +0000 (20:20 +0000)]
Don't assume resolved classses are filled in for ResolvedFieldAccessTest
am: c90450a201

Change-Id: Iacd940d12b4d9a54cd2f7ac21063f6178cf35031

7 years agoFix vtable corruption issue
Alex Light [Wed, 7 Sep 2016 19:04:20 +0000 (12:04 -0700)]
Fix vtable corruption issue

We were adding duplicate methods to the vtable in some cases where
default methods (and conflict methods) were used. This caused issues
where they were not correctly overridden in subclasses that implement
these methods directly. When overridden only one of the vtable entries
was updated meaning it was still possible to reach the overridden code
using a virtual call.

This change prevents the duplicate methods from being added to the
vtable in this circumstance. It also adds a debug check that ensures
that the vtable has no duplicates to prevent regressions.

Bug: 31280371

Test: mma test-art-host
Test: mma test-art-host-run-test-960-default-smali

Change-Id: I17d88fb8949c8d5d75b4de3c734fd98660b81e61
(cherry picked from commit 1f3925d4f067438d3689ef2736fd2af063c98668)

7 years agoDon't assume resolved classses are filled in for ResolvedFieldAccessTest
Mathieu Chartier [Fri, 9 Sep 2016 00:34:25 +0000 (17:34 -0700)]
Don't assume resolved classses are filled in for ResolvedFieldAccessTest

The assumption that the dex cache type for class of the field is
resolved is not correct since FindClass does not fill in the
resolved type array. This resulted in crashes if dex_access_to ==
nullptr.

Also implemented for ResolvedMethodAccessTest

Bug: 31277064

Test: Launch ZeroTouch with profile guided compilation.

Change-Id: I40cfb15f3ae4fbfe941fd01ea46211bd86b6e6f7

7 years agoSave environment snapshot and use at fork/exec
David Sehr [Wed, 31 Aug 2016 20:15:46 +0000 (20:15 +0000)]
Save environment snapshot and use at fork/exec
am: 0e4a2f0d6b

Change-Id: I0f0ab67798266911cd8209dfdd9cde0cf371c815

7 years agoSave environment snapshot and use at fork/exec
David Sehr [Wed, 17 Aug 2016 02:22:57 +0000 (19:22 -0700)]
Save environment snapshot and use at fork/exec

Some applications may inadvertently or maliciously set of environment
variables such as LD_LIBRARY_PATH before spawning subprocesses.
To make this more difficult, save the environment at the time the
runtime starts and use the saved copy anytime Exec is called.

BUG: 30160149
TEST: make test-art-{host,target}

Change-Id: I887b78bdb21ab20855636a96da14a74c767bbfef
(cherry picked from commit d106d9f871c957286ccdeb79c1c2a5ed41f859a6)

7 years agoPass the right class loader when inlining. am: c770fe0480 am: 5b5ee2a89f
Nicolas Geoffray [Mon, 29 Aug 2016 23:25:25 +0000 (23:25 +0000)]
Pass the right class loader when inlining. am: c770fe0480 am: 5b5ee2a89f
am: 91373ca410

Change-Id: I3d75cc076f4d7eb9db65ed686a8e27f6e93afa76

7 years agoPass the right class loader when inlining. am: c770fe0480
Nicolas Geoffray [Mon, 29 Aug 2016 22:50:54 +0000 (22:50 +0000)]
Pass the right class loader when inlining. am: c770fe0480
am: 5b5ee2a89f

Change-Id: I47bfba0654850a6e15ef0337556ed6a12e02fb90

7 years agoPass the right class loader when inlining.
Nicolas Geoffray [Mon, 29 Aug 2016 22:47:31 +0000 (22:47 +0000)]
Pass the right class loader when inlining.
am: c770fe0480

Change-Id: If6f2946d649addef8381079eb0132d35ee1fd62f

7 years agoPass the right class loader when inlining.
Nicolas Geoffray [Thu, 28 Jul 2016 02:49:14 +0000 (03:49 +0100)]
Pass the right class loader when inlining.

Otherwise, method and type resolution can resolve to the wrong
things and as a side effect update the dex cache with wrong data.

bug:30403437
Change-Id: I23f94486f51c65e0a1328c6185b36084627e09b3
test:./art/test/run-test --host --jit --dev --no-prebuild 613
(cherry picked from commit 0a210d9b108c87c0e7c1d430a92ce6fc89790c95)

7 years agoAdd lock when iterating over BacktraceMap.
Christopher Ferris [Fri, 26 Aug 2016 18:00:45 +0000 (18:00 +0000)]
Add lock when iterating over BacktraceMap.
am: 250a966717

Change-Id: I220924343cbf4a510473fba8d896b438307dc567

7 years agoAdd lock when iterating over BacktraceMap.
Christopher Ferris [Fri, 17 Jun 2016 06:19:36 +0000 (23:19 -0700)]
Add lock when iterating over BacktraceMap.

In order to avoid a race condition in the maps data, acquire
a read lock while iterating over the maps data.

Bug: 29387050
Bug: 31067025

(cherry picked from commit 56f8b5631ab2874dc2ec385802e38555acac0d90)

Change-Id: I48ecd2705b4aa4eedfed1daae2eb3b9b8bf8dda9

7 years agoCard mark holding class instead of declaring class
Mathieu Chartier [Thu, 25 Aug 2016 20:34:45 +0000 (20:34 +0000)]
Card mark holding class instead of declaring class
am: db16f2a0a7

Change-Id: Ifa6f51e997bc1283cc892d3b00ed8c8b2f187307

7 years agoCard mark holding class instead of declaring class
Mathieu Chartier [Fri, 5 Aug 2016 17:46:36 +0000 (10:46 -0700)]
Card mark holding class instead of declaring class

For profiling info, we need to mark the card of the holding class
instead of declaring class. This is required for GC correctness since
the GC relies on the card table to track cross space references.

Test: test-art-host ART_TEST_JIT=true

Bug: 30655270

(cherry picked from commit 65975776f807d55c83af6cca1e447f8daa794413)

Change-Id: I3de518693d3cac1ad9770eae671db740ebdf1d8d

7 years agoRevert "Revert "Use try lock to fix class resolution race""
Mathieu Chartier [Wed, 24 Aug 2016 16:36:42 +0000 (16:36 +0000)]
Revert "Revert "Use try lock to fix class resolution race""
am: 23da026ec7

Change-Id: Icc27f56679886cddbacdd2fcb198bdeeafdd1904

7 years agoRevert "Use try lock to fix class resolution race"
Mathieu Chartier [Wed, 24 Aug 2016 16:36:37 +0000 (16:36 +0000)]
Revert "Use try lock to fix class resolution race"
am: adc538a57a

Change-Id: I5dc4f5291800c124beed080e46bfee437b40669b

7 years agoUse try lock to fix class resolution race
Mathieu Chartier [Wed, 24 Aug 2016 16:36:32 +0000 (16:36 +0000)]
Use try lock to fix class resolution race
am: 1386f8619b

Change-Id: Ic196684640f2bad1b24837bdefd902305b4eb785

7 years agoRevert "Revert "Use try lock to fix class resolution race""
Mathieu Chartier [Fri, 29 Jul 2016 23:26:01 +0000 (16:26 -0700)]
Revert "Revert "Use try lock to fix class resolution race""

Fix possible deadlock in EnsureResolved caused by interaction with
GC. Since we were sleeping while holding the mutator lock, it could
block thread suspension. This would deadlock if the thread that
had locked h_class is already suspended since we would spin forever
and not make progress.

Bug: 27417671
Bug: 30500547

Test: test-art-host ART_TEST_GC_STRESS=true

This reverts commit 69bf969c055c31a75d17ea92aeee756042678114.

(cherry picked from commit 4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114)

Change-Id: If5766c2c3c8a130cbb83735cdb9970038570dafd

7 years agoRevert "Use try lock to fix class resolution race"
Mathieu Chartier [Fri, 29 Jul 2016 20:06:45 +0000 (20:06 +0000)]
Revert "Use try lock to fix class resolution race"

This reverts commit a704eda0078989a73cac111ed309aca50d2e289b.

Bug: 27417671
Bug: 30500547

(cherry picked from commit 69bf969c055c31a75d17ea92aeee756042678114)

Change-Id: I4354d1c9f1c554f054e99efd7aa52d8a2c5d402c

7 years agoUse try lock to fix class resolution race
Mathieu Chartier [Wed, 13 Jul 2016 16:53:35 +0000 (09:53 -0700)]
Use try lock to fix class resolution race

There was some possible deadlocks related to EnsureResolved caused by
acquiring an object lock.

Scenario:
Thread 1 acquires lock on obj1
Thread 1 begins to resolve / initialize class1
Thread 1 blocks since it sees that class1 is already being resolved and
gets preempted before it can acquire the object lock on class1
Thread 2 finishes resolving and initializing class1 and locks class1
Thread 2 blocks attempting to lock obj1
Thread 1 blocks attempting to lock class1
Deadlock

Fixed the deadlock by changing EnsureResolved to use a try lock for the
unresolved case.

Added a test.

Test: Device boot, test-art-host, monitor_test

Bug: 27417671

(cherry picked from commit a704eda0078989a73cac111ed309aca50d2e289b)

Change-Id: I1150b19bdc1a5cc87ae95eda4f2b6b4bca215a60

7 years agoMerge "Revert "Save environment snapshot and use at fork/exec"" into nyc-mr1-dev
David Sehr [Tue, 23 Aug 2016 17:10:20 +0000 (17:10 +0000)]
Merge "Revert "Save environment snapshot and use at fork/exec"" into nyc-mr1-dev
am: 7ae0862d40

Change-Id: I8cb8282d61aea83ec09bbcd68e9bdb329a02db51

7 years agoRevert "Save environment snapshot and use at fork/exec"
David Sehr [Tue, 23 Aug 2016 17:10:20 +0000 (17:10 +0000)]
Revert "Save environment snapshot and use at fork/exec"
am: 47393386aa

Change-Id: Id9ef46ef85495132dd9b9d3e8471fe94cd06d75c

7 years agoMerge "Revert "Save environment snapshot and use at fork/exec"" into nyc-mr1-dev
David Sehr [Tue, 23 Aug 2016 16:44:25 +0000 (16:44 +0000)]
Merge "Revert "Save environment snapshot and use at fork/exec"" into nyc-mr1-dev

7 years agoRevert "Save environment snapshot and use at fork/exec"
David Sehr [Tue, 23 Aug 2016 15:59:24 +0000 (15:59 +0000)]
Revert "Save environment snapshot and use at fork/exec"

This reverts commit 1488ff8aa3b041734ef0fbd113df512a2376e44e.

Change-Id: I3c237c94ffa865378f8efd9aa2b0fb2ad33867c2

7 years agoMerge "Save environment snapshot and use at fork/exec" into nyc-mr1-dev
David Sehr [Mon, 22 Aug 2016 23:37:09 +0000 (23:37 +0000)]
Merge "Save environment snapshot and use at fork/exec" into nyc-mr1-dev
am: 19d9b1e227

Change-Id: Iad472ba0d242bfad43211692d1c28b4f43f00600

7 years agoSave environment snapshot and use at fork/exec
David Sehr [Mon, 22 Aug 2016 23:37:09 +0000 (23:37 +0000)]
Save environment snapshot and use at fork/exec
am: 1488ff8aa3

Change-Id: I904562490ccc66831a4513864719019bd4b761ad

7 years agoMerge "Save environment snapshot and use at fork/exec" into nyc-mr1-dev
David Sehr [Mon, 22 Aug 2016 23:07:35 +0000 (23:07 +0000)]
Merge "Save environment snapshot and use at fork/exec" into nyc-mr1-dev

7 years agoFix debugger calling new String().
Jeff Hao [Mon, 22 Aug 2016 20:35:56 +0000 (20:35 +0000)]
Fix debugger calling new String().
am: 95ca9d2099

Change-Id: Ia5b2477311036d4d55fb84f4895ba6167fea3d13

7 years agoFix debugger calling new String().
Jeff Hao [Sat, 20 Aug 2016 01:31:39 +0000 (18:31 -0700)]
Fix debugger calling new String().

Used to return an empty string instead of the newly created String.
Requires accompanying jdwp test fix to test String contents.

Bug: 30951794
Test: mm -j24 run-jdwp-tests-host

Merges two cherry-picks:
f15ec05896ddc5fec1f224ef97bdfebb72b5a855
9e0878494cdacd0877a1614041efc38ebb053017

Change-Id: Idc4725b82798a9b6d636c72e76715bc97ad30d23

7 years agoSave environment snapshot and use at fork/exec
David Sehr [Wed, 17 Aug 2016 02:22:57 +0000 (19:22 -0700)]
Save environment snapshot and use at fork/exec

Some applications may inadvertently or maliciously set of environment
variables such as LD_LIBRARY_PATH before spawning subprocesses.
To make this more difficult, save the environment at the time the
runtime starts and use the saved copy anytime Exec is called.

BUG=b/30160149
TEST=make test-art-{host,target}-gtest-utils_test

Change-Id: Ice0097bf0de30db3d4ead124caf93316f39e3df3

7 years agoMerge "Fix pending exception failure for encoded statics" into nyc-mr1-dev
Mathieu Chartier [Thu, 11 Aug 2016 18:03:33 +0000 (18:03 +0000)]
Merge "Fix pending exception failure for encoded statics" into nyc-mr1-dev
am: b6f58cbfad

Change-Id: I69786ff4810ccf8b625832382d9f752b5811ba99

7 years agoFix pending exception failure for encoded statics
Mathieu Chartier [Thu, 11 Aug 2016 18:03:33 +0000 (18:03 +0000)]
Fix pending exception failure for encoded statics
am: 5464c73567

Change-Id: Id83316ec538a13bd70e77b669c60ba37ee76d4ea

7 years agoMerge "Fix pending exception failure for encoded statics" into nyc-mr1-dev
Mathieu Chartier [Thu, 11 Aug 2016 17:56:04 +0000 (17:56 +0000)]
Merge "Fix pending exception failure for encoded statics" into nyc-mr1-dev

7 years agoMerge "ART: Check for more low-space situations in zygote" into nyc-mr1-dev
Andreas Gampe [Thu, 11 Aug 2016 02:09:09 +0000 (02:09 +0000)]
Merge "ART: Check for more low-space situations in zygote" into nyc-mr1-dev
am: 546ca1b013

Change-Id: I9a6e6f16636c369eb03e407a47e083183c465732

7 years agoART: Check for more low-space situations in zygote
Andreas Gampe [Thu, 11 Aug 2016 02:09:09 +0000 (02:09 +0000)]
ART: Check for more low-space situations in zygote
am: f242f66cf7

Change-Id: I8043e4a91d7aebe9a7c9fbd90cb0382eb8fa6789

7 years agoMerge "ART: Check for more low-space situations in zygote" into nyc-mr1-dev
TreeHugger Robot [Thu, 11 Aug 2016 02:01:53 +0000 (02:01 +0000)]
Merge "ART: Check for more low-space situations in zygote" into nyc-mr1-dev

7 years agoFix pending exception failure for encoded statics
Mathieu Chartier [Wed, 10 Aug 2016 20:57:39 +0000 (13:57 -0700)]
Fix pending exception failure for encoded statics

ReadValueToField may allocate a string and cause OOME, we were
not checking this each loop iteration. Throwing an exception
with a pending exception causes an abort.

Bug: 30690988

Test: test-art-host

(cherry picked from commit da595bec0f9af0b087822e4febc282fe8ec28192)

Change-Id: I4701a4dcc63553aeb5c7970f99fd7f136443b266

7 years agoART: Check for more low-space situations in zygote
Andreas Gampe [Wed, 10 Aug 2016 03:19:18 +0000 (20:19 -0700)]
ART: Check for more low-space situations in zygote

Even if a boot image exists and can be loaded, the rest of the
platform may not be able to boot. We previously only checked
after full image generation and missed this case.

Also prune the cache if there wasn't even space to put the boot
marker.

Bug: 30765660
Change-Id: Icd43746e681c62ce2e4e8745fb17bda65ca60372

7 years agoPut the deletion of profiling info under a GC critical section.
Nicolas Geoffray [Wed, 10 Aug 2016 10:43:16 +0000 (10:43 +0000)]
Put the deletion of profiling info under a GC critical section.
am: 99c959f386

Change-Id: I8302de355f210b78573d2a4b14a7bc1c53c2af7f

7 years agoPut the deletion of profiling info under a GC critical section.
Nicolas Geoffray [Sat, 30 Jul 2016 21:49:11 +0000 (22:49 +0100)]
Put the deletion of profiling info under a GC critical section.

Otherwise the GC could see dangling pointers.

bug:30033802

(cherry picked from commit cf48fa030780c3185f225d558b704c396f7713cc)

Change-Id: I2c43e973878f50dc147aa0af81551ecc942a790d

7 years agoFix profiling output to properly display class info.
Jeff Hao [Mon, 1 Aug 2016 23:38:02 +0000 (23:38 +0000)]
Fix profiling output to properly display class info.
am: 6b9c54c8ae

Change-Id: I789734e0aaa3d217b4221cab79e5a268c9c21675

7 years agoFix profiling output to properly display class info.
Jeff Hao [Wed, 27 Jul 2016 17:35:03 +0000 (10:35 -0700)]
Fix profiling output to properly display class info.

The profiler stores class def indexes, not type ids.

Bug: 30436198

(cherry-picked from commit 58d40f3a7245e65d57a5daf6bf27c3b209260044)

Change-Id: I63524957547c5e0dbaf1d752220de8d05473638f

7 years agoPass the right class loader when inlining.
Nicolas Geoffray [Thu, 28 Jul 2016 04:26:16 +0000 (04:26 +0000)]
Pass the right class loader when inlining.
am: 0a210d9b10

Change-Id: I21bb2189eb9220bab756a58408fc7099ff710996

7 years agoPass the right class loader when inlining.
Nicolas Geoffray [Thu, 28 Jul 2016 02:49:14 +0000 (03:49 +0100)]
Pass the right class loader when inlining.

Otherwise, method and type resolution can resolve to the wrong
things and as a side effect update the dex cache with wrong data.

bug:30403437
Change-Id: I23f94486f51c65e0a1328c6185b36084627e09b3
test:./art/test/run-test --host --jit --dev --no-prebuild 613

7 years agoJIT: Don\'t update the dex cache of another class loader.
Nicolas Geoffray [Thu, 21 Jul 2016 23:32:11 +0000 (23:32 +0000)]
JIT: Don\'t update the dex cache of another class loader.
am: e50a7b834b

Change-Id: Ib2019ac3afafebaa01c8b74f7e8e1744c85f367d

7 years agoJIT: Don't update the dex cache of another class loader.
Nicolas Geoffray [Tue, 19 Jul 2016 16:06:23 +0000 (17:06 +0100)]
JIT: Don't update the dex cache of another class loader.

This only works for properly delegating class loaders. But Java allows
non-delegating ones :(

bug:29964720

test:612-jit-dex-cache

(cherry picked from commit 491617a612c8a1c890e72d8ba780a151ddee8e11)
(cherry picked from commit a2d7cbb44e570ec0a9064dc93f57441e6ab9e45a)

(cherry picked from commit ae093d69f58c2b6257c3e5b82a32c135a1f33641)

Change-Id: I73df55286a9bdb3f96963e0756e3a8b784aa9077

7 years agoJIT: Don't update the dex cache of another class loader.
Nicolas Geoffray [Tue, 19 Jul 2016 16:06:23 +0000 (17:06 +0100)]
JIT: Don't update the dex cache of another class loader.

This only works for properly delegating class loaders. But Java allows
non-delegating ones :(

bug:29964720

test:612-jit-dex-cache

(cherry picked from commit 491617a612c8a1c890e72d8ba780a151ddee8e11)
(cherry picked from commit a2d7cbb44e570ec0a9064dc93f57441e6ab9e45a)

Change-Id: I2523ce1fd4cd36dc83394d0f77ffc3f844e80c69

7 years agoMerge "Do allocation fence before pushing on allocation stack" into nyc-mr1-dev
TreeHugger Robot [Tue, 19 Jul 2016 22:34:10 +0000 (22:34 +0000)]
Merge "Do allocation fence before pushing on allocation stack" into nyc-mr1-dev

7 years agoDo allocation fence before pushing on allocation stack
Mathieu Chartier [Mon, 18 Jul 2016 18:11:45 +0000 (11:11 -0700)]
Do allocation fence before pushing on allocation stack

Heap::VisitObjects relies on having valid classes for objects in
the allocation stack. If the writes reorder, the thread calling
VisitObjects could see the free list pointer instead of the class
of the object. I believe this is causing crashes in VisitObjects.

Bug: 28790624

Test: Volantis booted

(cherry picked from commit 011dc2c4b9f3a064cba801679aedd3251fe191e3)

Change-Id: Ib620acbcd641ccd59fea9a66f5587c5026110a22

7 years agoMerge "Add API for getting location of odex or oat file" into nyc-mr1-dev
Philip Cuadra [Thu, 14 Jul 2016 22:26:20 +0000 (22:26 +0000)]
Merge "Add API for getting location of odex or oat file" into nyc-mr1-dev

7 years agoAdd API for getting location of odex or oat file
Philip Cuadra [Tue, 12 Jul 2016 23:37:40 +0000 (16:37 -0700)]
Add API for getting location of odex or oat file

Add an API for getting the file path of odex or oat file given a dex
path.

Bug 28251566

Change-Id: Ibebaa20f15d8135b25d9eb5927b7979801ebf0b2

7 years agoFix a bug in ClassTableGet code generation for IMTs.
Nicolas Geoffray [Wed, 13 Jul 2016 13:13:48 +0000 (14:13 +0100)]
Fix a bug in ClassTableGet code generation for IMTs.

Introduced by:
  https://android-review.googlesource.com/#/c/244980/

test:566-polymorphic-inling for fixing x86 crash. Also
fixes a performance regression.
bug:29188168

(cherry picked from commit ff484b95b25a5181a6a8a191cbd11da501c97651)

Change-Id: Iae5a63cb24017222c3fefda695a0a39673719f51

7 years agoMerge "ART: Remove zygote OTA code" into nyc-mr1-dev
Andreas Gampe [Wed, 13 Jul 2016 18:29:47 +0000 (18:29 +0000)]
Merge "ART: Remove zygote OTA code" into nyc-mr1-dev

7 years agoMerge "Fix System.arraycopy when doing same array copying." into nyc-mr1-dev
Nicolas Geoffray [Mon, 11 Jul 2016 12:33:16 +0000 (12:33 +0000)]
Merge "Fix System.arraycopy when doing same array copying." into nyc-mr1-dev

7 years agoART: Remove zygote OTA code
Andreas Gampe [Sat, 9 Jul 2016 17:51:12 +0000 (10:51 -0700)]
ART: Remove zygote OTA code

The renaming and relabeling of the A/B artifacts is now done in
a special-purpose script started by init, so as to not complicate
the logic here (e.g., name of the current slot).

Partially reverts commit 754479f7aa056602de8282f4f03718b42c20b89b.

Bug: 25612095
Bug: 28069686
Change-Id: I4d965361000fd448e199c9af059b6d18bfe928bb

7 years agoRevert "Revert "Optimize IMT""
Artem Udovichenko [Thu, 30 Jun 2016 09:18:25 +0000 (09:18 +0000)]
Revert "Revert "Optimize IMT""

This reverts commit 88f288e3564d79d87c0cd8bb831ec5a791ba4861.

Test: Includes smali tests to exercise cts failures that led to revert.
These tests check that objects that don't implement any interfaces are
handled properly when interface methods are invoked on them.

Bug: 29188168 (for initial CL)
Bug: 29778499 (reason for revert)

Change-Id: I49605d53692cbec1e2622e23ff2893fc51ed4115

7 years agoFix System.arraycopy when doing same array copying.
Nicolas Geoffray [Thu, 7 Jul 2016 11:07:42 +0000 (12:07 +0100)]
Fix System.arraycopy when doing same array copying.

At compile time, if constant source < constant destination, and we don't
know if the arrays are the same, then we must emit code that checks
if the two arrays are the same. If so, we jump to the slow path.

test:610-arraycopy

bug:30030084

(cherry picked from commit 9f65db89353c46f6b189656f7f55a99054e5cfce)

Change-Id:Ida67993d472b0ba4056d9c21c68f6e5239421f7d

7 years agoWork around Jack optimizations in arm64 shifter operand test.
Vladimir Marko [Tue, 26 Apr 2016 16:55:55 +0000 (17:55 +0100)]
Work around Jack optimizations in arm64 shifter operand test.

And also in the ror test.

Bug: 28392114

(cherry picked from commit 5bc80b9994bde67184adc1a168538c2a9b99fc8b)

Change-Id: I597a2556a81792d7a5289cc4925cb057ee57438d

7 years agoART: Add very-large threshold to dex2oat
Andreas Gampe [Sat, 25 Jun 2016 04:05:23 +0000 (21:05 -0700)]
ART: Add very-large threshold to dex2oat

Add a variable threshold to dex2oat. If the total dex file size for
an app reaches this threshold, dex2oat will punt all compilation and
compile the app with verify-at-runtime. This ensures smaller compile
time and memory thrashing, while still extracting the dex files and
thus helping with dirty memory later.

Added tests.

Bug: 29557002
Bug: 29790079
Test: m test-art-host-gtest-dex2oat_test
Change-Id: I78870e4a80ccaafcbbe56839e61ced0acd2ca05e