OSDN Git Service

android-x86/art.git
9 years agoBump oat version.
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

9 years agoMerge "Keep original order of fields in Class." into lmp-mr1-dev
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

9 years agoART: Implicit null check should break def tracking
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

9 years agoMerge "ART: Compiled-classes list for compiler-driver" into lmp-mr1-dev
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

9 years agoKeep original order of fields in Class.
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

9 years agoFix bad OOM check in Thread::CreatePeer().
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

9 years agoMerge "Prune image cache if the boot marker is still in place." into lmp-mr1-dev
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

9 years agoMerge "Reduce suspend check threshold" 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

9 years agoART: Compiled-classes list for compiler-driver
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

9 years agoMerge "Add null check for thread name creation" into lmp-mr1-dev
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

9 years agoPrune image cache if the boot marker is still in place.
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

9 years agoAdd null check for thread name creation
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

9 years agoam d00804c6: ART: Prune links in the dalvik cache
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

9 years agoam e225eab4: art: Fix classlinker and nopatchoat test for PIC case
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

9 years agoam 48447025: ART: Add support for patching and loading OAT files compiled with PIC
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

9 years agoam 998ee7d0: (-s ours) ART: Add pic flag to oat header store
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

9 years agoam 300590bd: dex2oat: Add a --compile-pic option
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

9 years agoART: Prune links in the dalvik cache
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

9 years agoart: Fix classlinker and nopatchoat test for PIC case
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

9 years agoART: Add support for patching and loading OAT files compiled with PIC
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

9 years agoART: Add pic flag to oat header store
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

9 years agodex2oat: Add a --compile-pic option
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

9 years agoMerge "ART: Prune links in the dalvik cache" into lmp-mr1-dev
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

9 years agoART: Prune links in the dalvik cache
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

9 years agoMerge "Delete unused imtable field" into lmp-mr1-dev
Mathieu Chartier [Mon, 10 Nov 2014 18:01:04 +0000 (18:01 +0000)]
Merge "Delete unused imtable field" into lmp-mr1-dev

9 years agoDelete unused imtable field
Mathieu Chartier [Sat, 8 Nov 2014 02:38:47 +0000 (18:38 -0800)]
Delete unused imtable field

Bug: 17643507

Change-Id: I1fc7ca2d3bdf1810bcc3b46f867b68a4a6d28ed3

9 years agoMerge "ART: Fix possible soft+hard failure in verifier" into lmp-mr1-dev
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

9 years agoART: Fix possible soft+hard failure in verifier
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

9 years agoReduce suspend check threshold
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

9 years agoMerge "Add hash map, reduce excessive hashing" into lmp-mr1-dev
Mathieu Chartier [Fri, 7 Nov 2014 19:27:45 +0000 (19:27 +0000)]
Merge "Add hash map, reduce excessive hashing" into lmp-mr1-dev

9 years agoAdd hash map, reduce excessive hashing
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

9 years agoMerge "Fix thread priorities for unstarted threads." into lmp-mr1-dev
Narayan Kamath [Fri, 7 Nov 2014 12:45:28 +0000 (12:45 +0000)]
Merge "Fix thread priorities for unstarted threads." into lmp-mr1-dev

9 years agoOptimize get/set reflection performance
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)

9 years agoam f0cb1eb5: ART: Missing EndTiming()s in dex2oat
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

9 years agoMerge "Add hash set" into lmp-mr1-dev
Mathieu Chartier [Fri, 7 Nov 2014 00:03:34 +0000 (00:03 +0000)]
Merge "Add hash set" into lmp-mr1-dev

9 years agoAdd hash set
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

9 years agoART: Missing EndTiming()s in dex2oat
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

9 years agoFix thread priorities for unstarted threads.
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

9 years agoART: Add miranda checking
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

9 years agoMerge "Check null this pointer for direct methods in FindMethodFast." into lmp-mr1-dev
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

9 years agoCheck null this pointer for direct methods in FindMethodFast.
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

9 years agoMerge "Add image strings to intern table" into lmp-mr1-dev
Mathieu Chartier [Mon, 3 Nov 2014 18:07:18 +0000 (18:07 +0000)]
Merge "Add image strings to intern table" into lmp-mr1-dev

9 years agoAdd image strings to intern table
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

9 years agoam 64d79730: am 9a783d6a: Fix FindDeclaredVirtualMethod(DexCache...) for miranda...
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

9 years agoMerge "ART: Discard generated image in a low-memory environment" into lmp-mr1-dev
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

9 years agoART: Discard generated image in a low-memory environment
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

9 years agoart: Fix classlinker and nopatchoat test for PIC case
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

9 years agoART: Add support for patching and loading OAT files compiled with PIC
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

9 years agoART: Add pic flag to oat header store
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

9 years agodex2oat: Add a --compile-pic option
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

9 years agoam 9a783d6a: Fix FindDeclaredVirtualMethod(DexCache...) for miranda methods
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

9 years agoFix 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

9 years agoMerge "Add hash table to link virtual methods" into lmp-mr1-dev
Mathieu Chartier [Thu, 30 Oct 2014 22:19:51 +0000 (22:19 +0000)]
Merge "Add hash table to link virtual methods" into lmp-mr1-dev

9 years agoAdd hash table to link virtual methods
Mathieu Chartier [Wed, 29 Oct 2014 01:23:02 +0000 (18:23 -0700)]
Add hash table to link virtual methods

Added a hash table for turning the O(m*n) lookup average case to
O(m+n) average case. There is probably still some room for improvement.

Before:
WaitTime: 2121
WaitTime: 2051
WaitTime: 2134
WaitTime: 2104
WaitTime: 2237
WaitTime: 2391
4.99% art::MethodNameAndSignatureComparator::HasSameNameAndSignature(art::mirror::ArtMethod)
1.65% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)

After:
WaitTime: 2038
WaitTime: 1965
WaitTime: 1979
WaitTime: 1976
WaitTime: 1957
WaitTime: 2004
0.46% art::MethodNameAndSignatureComparator::HasSameNameAndSignature(art::mirror::ArtMethod*)
1.39% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)

Bug: 18054905
Bug: 16828525

Change-Id: If847afb7194daa05ace38d15862e4b871dfffae1

9 years agoMerge "ART: Do not abort on most verifier failures" into lmp-mr1-dev
Andreas Gampe [Thu, 30 Oct 2014 16:59:15 +0000 (16:59 +0000)]
Merge "ART: Do not abort on most verifier failures" into lmp-mr1-dev

9 years agoMerge "Fix deoptimization bugs" into lmp-mr1-dev
Sebastien Hertz [Thu, 30 Oct 2014 10:14:44 +0000 (10:14 +0000)]
Merge "Fix deoptimization bugs" into lmp-mr1-dev

9 years agoam 2759810f: am 7dd72618: Work around relocated boot.oat corruption
Brian Carlstrom [Wed, 29 Oct 2014 18:51:44 +0000 (18:51 +0000)]
am 2759810f: am 7dd72618: Work around relocated boot.oat corruption

* commit '2759810fc4dab86c52f23c8603e5c7479182ae21':
  Work around relocated boot.oat corruption

9 years agoam f4e60fb4: am efb9f850: ART: Fix ImageSpace error message.
Andreas Gampe [Wed, 29 Oct 2014 18:50:54 +0000 (18:50 +0000)]
am f4e60fb4: am efb9f850: ART: Fix ImageSpace error message.

* commit 'f4e60fb49f96aeb13a58523b7f9f9e91ab4b533c':
  ART: Fix ImageSpace error message.

9 years agoam d7c581cc: am a6b2affa: Remove boot.art/boot.oat on failure to create
Brian Carlstrom [Wed, 29 Oct 2014 18:49:10 +0000 (18:49 +0000)]
am d7c581cc: am a6b2affa: Remove boot.art/boot.oat on failure to create

* commit 'd7c581cc076a03da2b00a9a3ceaeb5d04ec815df':
  Remove boot.art/boot.oat on failure to create

9 years agoFix deoptimization bugs
Sebastien Hertz [Wed, 29 Oct 2014 11:21:55 +0000 (12:21 +0100)]
Fix deoptimization bugs

Only concerns long and double variables which use a register pair.

Bug: 18167243

(partial cherry-pick of commit 07140838a3ee44a6056cacdc78f2930e019107da)

Change-Id: Ibbbd9b1ed576a1502ca0025a3e27176014ed2548

9 years agoMerge "Make ObjectRegistry::InternalAdd GC safe" into lmp-mr1-dev
Sebastien Hertz [Wed, 29 Oct 2014 08:30:53 +0000 (08:30 +0000)]
Merge "Make ObjectRegistry::InternalAdd GC safe" into lmp-mr1-dev

9 years agoam 7dd72618: Work around relocated boot.oat corruption
Brian Carlstrom [Wed, 29 Oct 2014 01:33:42 +0000 (01:33 +0000)]
am 7dd72618: Work around relocated boot.oat corruption

* commit '7dd7261845258b7c29b588829c80164b878f4424':
  Work around relocated boot.oat corruption

9 years agoART: Do not abort on most verifier failures
Andreas Gampe [Tue, 28 Oct 2014 03:08:46 +0000 (20:08 -0700)]
ART: Do not abort on most verifier failures

Changes hard aborts to hard verifier failures, which rejects a
class instead of killing the process.

Bug: 17625962
Change-Id: Iba8e15676e13ea6dcd6e1e5d0484031d9ab52ae9

9 years agoTidy MethodProtoHelper.
Ian Rogers [Tue, 28 Oct 2014 16:34:57 +0000 (09:34 -0700)]
Tidy MethodProtoHelper.

Move to place of only use, class_linker.cc. Be lazy in computing the name.

Before:
WaitTime: 2699
WaitTime: 2791
WaitTime: 2653
WaitTime: 2929
WaitTime: 2651
WaitTime: 2971

After:
WaitTime: 2749
WaitTime: 2786
WaitTime: 2852
WaitTime: 2856
WaitTime: 2703
WaitTime: 2784

Bug: 18054905
Bug: 16828525

(cherry picked from commit 03b6eafba8ace9a9c4d5ee9c47723d1910ccd7a8)

Change-Id: I1438efbda58369ddd0ac36eda8a5a0a6c6fdff77

9 years agoWork around relocated boot.oat corruption
Brian Carlstrom [Tue, 28 Oct 2014 22:53:43 +0000 (15:53 -0700)]
Work around relocated boot.oat corruption

Bug: 18143314
Change-Id: Ibecade061d6c887bde2f8a085ed7dede3345125a

9 years agoMerge "Fill resolved static fields during class initialization" into lmp-mr1-dev
Mathieu Chartier [Tue, 28 Oct 2014 22:09:35 +0000 (22:09 +0000)]
Merge "Fill resolved static fields during class initialization" into lmp-mr1-dev

9 years agoFill resolved static fields during class initialization
Mathieu Chartier [Tue, 28 Oct 2014 20:57:04 +0000 (13:57 -0700)]
Fill resolved static fields during class initialization

Previously everytime we resolved static fields we linear searched
the class to find the field with the specified field id. Now we
eagerly set these fields in the dex cache when we initialize classes.

FB launch timings before:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792

Timings after:
WaitTime: 2699
WaitTime: 2791
WaitTime: 2653
WaitTime: 2929
WaitTime: 2651
WaitTime: 2971

Perf before:
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
After:
0.00% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)

Bug: 18054905
Bug: 16828525

Change-Id: I33255f85d10c29cae085584880196c45ac0ea230

9 years agoam efb9f850: ART: Fix ImageSpace error message.
Andreas Gampe [Tue, 28 Oct 2014 21:37:02 +0000 (21:37 +0000)]
am efb9f850: ART: Fix ImageSpace error message.

* commit 'efb9f850292a2ea5aae4ab56556c9ab25b308a96':
  ART: Fix ImageSpace error message.

9 years agoART: Fix ImageSpace error message.
Andreas Gampe [Sat, 25 Oct 2014 04:55:52 +0000 (21:55 -0700)]
ART: Fix ImageSpace error message.

Use *error_msg instead of error_msg.

(cherry picked from commit 50f2e9a6b935ba1c456a687e5f0822d9356d71e5)

Bug: 18143314
Change-Id: I62f6aeda142235eb1a412a4c1ae1104b813e6967

9 years agoMerge "[native bridge] Make sure we always unload the native bridge" into lmp-mr1-dev
Calin Juravle [Tue, 28 Oct 2014 17:17:10 +0000 (17:17 +0000)]
Merge "[native bridge] Make sure we always unload the native bridge" into lmp-mr1-dev

9 years agoMerge "[native bridge] Add test to verify code_cache existance." into lmp-mr1-dev
Calin Juravle [Tue, 28 Oct 2014 17:16:46 +0000 (17:16 +0000)]
Merge "[native bridge] Add test to verify code_cache existance." into lmp-mr1-dev

9 years agoMake ObjectRegistry::InternalAdd GC safe
Sebastien Hertz [Thu, 23 Oct 2014 13:39:33 +0000 (15:39 +0200)]
Make ObjectRegistry::InternalAdd GC safe

Because a call to IdentityHashCode may cause GC, the object pointer
may become invalid (if the object has been moved) on next uses. We
now access the object through a Handle to be GC safe.

Also remove unused methods.

Bug: 18098424

(cherry picked from commit e2d628b5b0a1b9c29c173f3cbad3ef6cb6c24d2d)

Change-Id: I4fdff54053aa947765a39adf67345b08816387e5

9 years agoMerge "Fixed debugger for threads attached from JNI" into lmp-mr1-dev
Sebastien Hertz [Tue, 28 Oct 2014 08:24:22 +0000 (08:24 +0000)]
Merge "Fixed debugger for threads attached from JNI" into lmp-mr1-dev

9 years agoMerge "Fix JDWP Virtualmachine.Resume command" into lmp-mr1-dev
Sebastien Hertz [Tue, 28 Oct 2014 08:23:48 +0000 (08:23 +0000)]
Merge "Fix JDWP Virtualmachine.Resume command" into lmp-mr1-dev

9 years agoam a6b2affa: Remove boot.art/boot.oat on failure to create
Brian Carlstrom [Tue, 28 Oct 2014 06:21:37 +0000 (06:21 +0000)]
am a6b2affa: Remove boot.art/boot.oat on failure to create

* commit 'a6b2affaf99e03f938f6f26e42606488d43f2efe':
  Remove boot.art/boot.oat on failure to create

9 years agoFix 64 bit build
Mathieu Chartier [Tue, 28 Oct 2014 00:30:20 +0000 (17:30 -0700)]
Fix 64 bit build

Buggy compiler.

Change-Id: Id16c83fc7963ca89fd7fae32dd15ae342cc7f064

9 years agoRemove boot.art/boot.oat on failure to create
Brian Carlstrom [Mon, 27 Oct 2014 23:27:06 +0000 (16:27 -0700)]
Remove boot.art/boot.oat on failure to create

Bug: 18143314
Change-Id: I5f4733ed7f359158a2bda58ff4f228ba60e2f493

9 years agoMerge "Optimize method linking" into lmp-mr1-dev
Mathieu Chartier [Mon, 27 Oct 2014 23:04:22 +0000 (23:04 +0000)]
Merge "Optimize method linking" into lmp-mr1-dev

9 years agoOptimize method linking
Mathieu Chartier [Thu, 23 Oct 2014 23:48:06 +0000 (16:48 -0700)]
Optimize method linking

Added more inlining, removed imt array allocation and replaced it
with a handle scope. Removed some un-necessary handle scopes.

Added logic to base interface method tables from the superclass so
that we dont need to reconstruct for every interface (large win).

Facebook launch Dalvik KK MR2:
TotalTime: 3165
TotalTime: 3652
TotalTime: 3143
TotalTime: 3298
TotalTime: 3212
TotalTime: 3211

Facebook launch TOT before:
WaitTime: 3702
WaitTime: 3616
WaitTime: 3616
WaitTime: 3687
WaitTime: 3742
WaitTime: 3767

After optimizations:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792

LinkInterfaceMethods no longer one of the hottest methods, new list:
4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>)
3.07% art::DexFile::FindClassDef(char const*) const
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
2.90% art::DexFile::FindStringId(char const*) const

Bug: 18054905
Bug: 16828525

Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321

9 years ago[native bridge] Make sure we always unload the native bridge
Calin Juravle [Wed, 22 Oct 2014 20:02:23 +0000 (21:02 +0100)]
[native bridge] Make sure we always unload the native bridge

libnativebridge may allocate some resources during loading and
intialization and de-allocate them when unloading. This makes sure that
we don't leak anything.

Bug: 18097480

(cherry picked from commit 07d83c7a25022064ac0a8dac4fe2a7a38681fa4b)

Change-Id: I3a5155a6760399ccfaf9130c72679615a3d4f2e7

9 years ago[native bridge] Add test to verify code_cache existance.
Calin Juravle [Wed, 22 Oct 2014 19:17:58 +0000 (20:17 +0100)]
[native bridge] Add test to verify code_cache existance.

Bug: 18027433

(cherry picked from commit 44a3506627833deb17d21d6a7d51245a5af2c3e9)

Change-Id: I9ce578949dbe522d5033465df7ca49fdd3aa3cbf

9 years agoFix JDWP Virtualmachine.Resume command
Sebastien Hertz [Tue, 14 Oct 2014 15:27:15 +0000 (17:27 +0200)]
Fix JDWP Virtualmachine.Resume command

We used to call ThreadList::UndoDebuggerSuspensions but this is not
correct. Indeed Virtualmachine.Resume command should be performed
as many times as all threads have been suspended (either by the
Virtualmachine.Suspend command or the application of suspend policy
ALL for event).

This CL fixes this issue by adding ThreadList::ResumeAllForDebugger.
It decrements suspend count and debug suspend count by 1 (globally
and for each thread).

It also handles the case where Virtualmachine.Resume is called while
threads have not been suspended (global debug suspend count is 0). In
this case we just print a warning and do nothing.

Bug: 17974047

(cherry picked from commit 253fa555d9424a56c52879449eabe73d5c96cf61)

Change-Id: I38b38240f84f141670506e88fa5c2480f856fdd6

9 years agoMerge "Only watch location for BREAKPOINT event" into lmp-mr1-dev
Sebastien Hertz [Fri, 24 Oct 2014 07:57:49 +0000 (07:57 +0000)]
Merge "Only watch location for BREAKPOINT event" into lmp-mr1-dev

9 years agoam c63a505a: Fix concurrent start bytes race
Mathieu Chartier [Fri, 24 Oct 2014 00:44:43 +0000 (00:44 +0000)]
am c63a505a: Fix concurrent start bytes race

* commit 'c63a505ae9992cc6ad154179734f078594c72d01':
  Fix concurrent start bytes race

9 years agoFix concurrent start bytes race
Mathieu Chartier [Thu, 23 Oct 2014 00:18:34 +0000 (17:18 -0700)]
Fix concurrent start bytes race

Previously, we set concurrent start bytes to max int when we
requested a concurrent GC, but there was a race if another thread
was doing another GC and had already completed GrowForUtilization
but had not yet finished the GC. This meant that the thread doing
the GC would update the concurrent start bytes properly, but the
allocating thread would re-update it to max int. Then when the
concurrent GC thread woke up, it would call WaitForGcToComplete
and see that there was a collector running and avoid doing the
concurrent GC, leaving the concurrent start bytes set to max int.

This meant that there would be no more concurrent GC until either
the next explicit GC or the next GC for alloc.

The fix is to only set concurrent start bytes to max int inside of
the CollectGarbageInternal code such that there isn't any way for
two threads to race.

Bug: 17942071
Change-Id: I2a4b067d99ae0aeebcc32fa4970024dcdff2ddc3
(cherry picked from commit 0133ec454d8dd3fa5ffe35649b5704aa18f15a49)

9 years agoFix concurrent start bytes race
Mathieu Chartier [Thu, 23 Oct 2014 00:18:34 +0000 (17:18 -0700)]
Fix concurrent start bytes race

Previously, we set concurrent start bytes to max int when we
requested a concurrent GC, but there was a race if another thread
was doing another GC and had already completed GrowForUtilization
but had not yet finished the GC. This meant that the thread doing
the GC would update the concurrent start bytes properly, but the
allocating thread would re-update it to max int. Then when the
concurrent GC thread woke up, it would call WaitForGcToComplete
and see that there was a collector running and avoid doing the
concurrent GC, leaving the concurrent start bytes set to max int.

This meant that there would be no more concurrent GC until either
the next explicit GC or the next GC for alloc.

The fix is to only set concurrent start bytes to max int inside of
the CollectGarbageInternal code such that there isn't any way for
two threads to race.

Bug: 17942071
Change-Id: I2a4b067d99ae0aeebcc32fa4970024dcdff2ddc3

9 years agoFixed debugger for threads attached from JNI
Daniel Mihalyi [Mon, 20 Oct 2014 09:47:56 +0000 (11:47 +0200)]
Fixed debugger for threads attached from JNI

Dbg::PostThreadStart was not invoked in Thread::Attach,
thus when attaching existing native thread to JNI, JDWP
events from that thread are not handled correctly by the
debugger, because the thread keeps being unannounced.

The issue was reproduced on Eclipse 4.3 and 4.4.

Bug: 18030371
(cherry picked from commit dfafeef139dbc77e86fdb465d960b4a17a7ac4a0)

Change-Id: Ia91dcf1aa98913aea2742c90b3e21b10d2cb36d4
Signed-off-by: Daniel Mihalyi <daniel.mihalyi@mattakis.com>
9 years agoAvoid strict-aliasing problems with Handles.
Ian Rogers [Tue, 21 Oct 2014 22:05:36 +0000 (15:05 -0700)]
Avoid strict-aliasing problems with Handles.

Replace use of reinterpret_cast with down_cast.

Bug: 18074773

Change-Id: Id42d462f2798f69a2210e5912f441c868b8b5812
(cherry picked from commit b5cb18a116dce45fc077b3f5b94af9e521e79e8d)

9 years agoShut down FaultManager after shutting down threads.
Vladimir Marko [Mon, 20 Oct 2014 17:13:22 +0000 (18:13 +0100)]
Shut down FaultManager after shutting down threads.

Bug: 17703163

(cherry picked from commit 2beeb82523bd3b8015851b69ccd088553ec0c226)

Change-Id: Ic4beae99734ec15b8ead362fbf76a69eceae5980

9 years agoFix mac build (second attempt)
Dmitriy Ivanov [Wed, 15 Oct 2014 00:55:28 +0000 (17:55 -0700)]
Fix mac build (second attempt)

  It appears that the version of mac ld with
  -export_dynamic is pretty recent.

  Remove -export_dynamic to fix build for older
  mac versions (?)

(cherry picked from commit 8b5b69813ef4d718db2e38e51867883511a3eeea)

Change-Id: I272d4b2c95411cc8126f27468f5199ff932fc9ef

9 years agoFixing mac build
Dmitriy Ivanov [Tue, 14 Oct 2014 19:18:10 +0000 (12:18 -0700)]
Fixing mac build

 MacOS static linker does not understand --export-dynamic
 and --version-script. According to man ld there is
 -export_dynamic option which should do the same
 thing.

(cherry picked from commit 1d74e57fa22fbcad1e14d776c771472b2d8438fb)

Change-Id: If9c096e099c8c070b62dda87dd0ed3ce77addcd6

9 years agoUntie gtest executables from LD_PRELOAD
Dmitriy Ivanov [Tue, 14 Oct 2014 18:38:46 +0000 (11:38 -0700)]
Untie gtest executables from LD_PRELOAD

Bug: 15345057
Bug: 15426766

(cherry picked from commit 8508a436efa7979ad54f644e60dad483c8499be2)

Change-Id: Id710c87c050f573fec1e4c36f06f88def5de5887

9 years agoRemove libsigchain from LD_PRELOADS
Dmitriy Ivanov [Tue, 7 Oct 2014 20:43:23 +0000 (13:43 -0700)]
Remove libsigchain from LD_PRELOADS

  Link sigchain.cc statically with dalvikvm, app_process,
  surfaceflinger, dex2oat, patchoat and objdump.

  Replace libsigchain.so with dummy implementaions to avoid
  situations when it is used incorrectly.

Bug: 15345057
Bug: 15426766

(cherry picked from commit f57874dddefc03fef9ad36fbdd87e39a08a8d641)

Change-Id: I07fe3ca4eeef423d78d7e9a639f03fc59aae3b29

9 years agoam 4b4af816: am 1f24296c: Add way to ensure we are at the front of the sigaction...
Mathieu Chartier [Fri, 17 Oct 2014 18:52:25 +0000 (18:52 +0000)]
am 4b4af816: am 1f24296c: Add way to ensure we are at the front of the sigaction chain

* commit '4b4af816f2c5924cc173c84bc62c12d57123442e':
  Add way to ensure we are at the front of the sigaction chain

9 years agoMerge "Add test for equals and hashCode in ParameterizedType" into lmp-mr1-dev
Narayan Kamath [Fri, 17 Oct 2014 11:19:10 +0000 (11:19 +0000)]
Merge "Add test for equals and hashCode in ParameterizedType" into lmp-mr1-dev

9 years agoam 1f24296c: Add way to ensure we are at the front of the sigaction chain
Mathieu Chartier [Fri, 17 Oct 2014 07:29:32 +0000 (07:29 +0000)]
am 1f24296c: Add way to ensure we are at the front of the sigaction chain

* commit '1f24296c7c8a6501ee2388c0d20b48f471b48660':
  Add way to ensure we are at the front of the sigaction chain

9 years agoTracking change to make Class.getDeclaredFields/Methods public
Brian Carlstrom [Fri, 17 Oct 2014 05:02:23 +0000 (22:02 -0700)]
Tracking change to make Class.getDeclaredFields/Methods public

Bug: 17375269
Change-Id: Ib3bc256e2034258210e153ff664ee9b1f2d806f7

9 years agoAdd way to ensure we are at the front of the sigaction chain
Mathieu Chartier [Wed, 15 Oct 2014 23:59:47 +0000 (16:59 -0700)]
Add way to ensure we are at the front of the sigaction chain

Calling this after jni_on_load fixes the unity apps. This is
not exactly correct since we may already have the following chain.

Start up:
Us -> debuggerd

After app goes in front:
App -> us -> debuggerd

After we put ourself back at the front:
Us -> app -> us -> app -> .... stack overflow.

Bug: 17620677
Change-Id: I9183997e3d5ebd51c320b5d51425be5142e938f3

9 years agoam 1fc7a271: am edfc4ca2: Fix oatdump for no image
Mathieu Chartier [Wed, 15 Oct 2014 18:13:41 +0000 (18:13 +0000)]
am 1fc7a271: am edfc4ca2: Fix oatdump for no image

* commit '1fc7a271f6c8ce844f0af67165c437c859e4e20c':
  Fix oatdump for no image

9 years agoam edfc4ca2: Fix oatdump for no image
Mathieu Chartier [Wed, 15 Oct 2014 18:09:19 +0000 (18:09 +0000)]
am edfc4ca2: Fix oatdump for no image

* commit 'edfc4ca2c8e1de6a1d42700cc0bc41d5b243ea04':
  Fix oatdump for no image