History log of /art/runtime/native/dalvik_system_DexFile.cc
Revision Date Author Comments
71b768168908052484e1aea9b076e939e422dac8 13-Jul-2016 Philip Cuadra <philipcuadra@google.com> 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
b4827ace453b9280060a826e8f22cc8c9b6edb7d 13-Jul-2016 Philip Cuadra <philipcuadra@google.com> 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
c9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6 04-Jun-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Hold dex caches live in class table""

Bug: 29083330

This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.

Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
f102faf1bcbdb2149e3e7bf27b1819f621b7894b 04-Jun-2016 Brian Carlstrom <bdc@google.com> Revert "Hold dex caches live in class table"

This reverts commit d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e.

Bug: 29083330
Change-Id: Ie209b27897b8079f2d13fd0837fe5f83a7e61afc
d6d49e56c2b7b11f474acb80cb02bb1fe9b7861e 02-Jun-2016 Mathieu Chartier <mathieuc@google.com> Hold dex caches live in class table

Prevents temporary dex caches being unloaded for the same dex file.
Usually this is OK, but if someone resolved a string in that dex
cache, it could leave stale pointers in BSS. Also it can use extra
memory in linear alloc if we allocate dex cache arrays multiple
times.

Bug: 29083330

(cherry picked from commit f284d448e3edd428b6ade473d0993028638b2064)

Change-Id: Ie1b0b0cf835a998e19227cbb90014011a6cd40c4
10267549f5ea8acc07ea6163a87c9b4b8ea62be4 25-May-2016 Richard Uhler <ruhler@google.com> Base isDexOptNeeded result on OatFileAssistant::IsUpToDate.

So that it is consistent with when ART will try to run dex2oat.

Bug: 28826195
Change-Id: Idf64b96bf9a6f4ee67dd1af78e6177e078a3c593
cd7e7f78b8e97c1f6419f3f44e0d5fdc6eddfdc6 02-May-2016 Narayan Kamath <narayan@google.com> DexFile: Add an API to query oat file status.

Adds DexFile.getDexFileStatus(path), which returns an opaque,
human-readable string representation of the oat file status. This
representation isn't guaranteed to be stable and can change from
release to release.

bug: 27494108

Change-Id: I5fc42225ae65eb19dcd0c619a40cf674b34fc49c
fead81964f2f5d0d9a62f915a1a428bfde9f6376 22-Apr-2016 Jeff Hao <jeffhao@google.com> Add ability to see if a dex file is backed by an oat file.

Native support for new DexFile.isBackedByOatFile.

Part of a multi-project change.

Bug: 26880306

(cherry-picked from commit 93a66cc779898d46c620e5d9c8bc71e2a71f6610)

Change-Id: I15e8ec44a216b13e494affd2fd3ff5f66fa79597
86a785d23ba3956b78c33aa3b623df4b6ec8b901 31-Mar-2016 Andreas Gampe <agampe@google.com> ART: Add support for DexFile compiler filter function

Add support for getting a non-profile-guided version of a given
compiler filter.

Bug: 27921071

(cherry picked from commit fd97429f258acde6ee24a6f74c9050b2343e40cd)

Change-Id: I54735b61732e6a5c9dc62425d04bc740dd365083
fd97429f258acde6ee24a6f74c9050b2343e40cd 31-Mar-2016 Andreas Gampe <agampe@google.com> ART: Add support for DexFile compiler filter function

Add support for getting a non-profile-guided version of a given
compiler filter.

Bug: 27921071
Change-Id: I54735b61732e6a5c9dc62425d04bc740dd365083
c38be810ce939267c004f72b3cf0b9339414f0f9 23-Mar-2016 Andreas Gampe <agampe@google.com> ART: Update DexFile for compiler-filter pass-down

Update getDexOptNeeded. Add implementations for isValidCompilerFilter
and isProfileGuidedCompilerFilter.

Bug: 27689078

(cherry picked from commit 1d23d43e29e41adb3d504332c8833acaacb49e50)

Change-Id: I06b9d75f58c59cb07ef5170f784ea6745168efaa
1d23d43e29e41adb3d504332c8833acaacb49e50 23-Mar-2016 Andreas Gampe <agampe@google.com> ART: Update DexFile for compiler-filter pass-down

Update getDexOptNeeded. Add implementations for isValidCompilerFilter
and isProfileGuidedCompilerFilter.

Bug: 27689078
Change-Id: I20dca2b5b3ddb891c19e2a4f86dc78dbab592b72
7bcfcb80a31f57a84d754e00bca8698829365208 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

(cherry picked from commit 29d38e77c553c6cf71fc4dafe2d22b4e3f814872)

Bug: 27689078
Change-Id: I6274188610f31dcd9d086fc080b2be93afae5a6b
29d38e77c553c6cf71fc4dafe2d22b4e3f814872 23-Mar-2016 Andreas Gampe <agampe@google.com> Revert "Revert "Use compiler filter to determine oat file status.""

This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.

Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.

Bug: 27689078
Change-Id: I0c578705a9921114ed1fb00d360cc7448addc93a
845e5064580bd37ad5014f7aa0d078be7265464d 23-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Use compiler filter to determine oat file status."

Bots are red. Tentative reverting as this is likely the offender.

Bug: 27689078

This reverts commit a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931.

Change-Id: I3ec6947a5a4be878ff81f26f17dc36a209734e2a
a62d2f04a6ecf804f8a78e722a6ca8ccb2dfa931 18-Mar-2016 Richard Uhler <ruhler@google.com> Use compiler filter to determine oat file status.

Record the compiler filter in the oat header. Use that to determine
when the oat file is up-to-date with respect to a target compiler
filter level.

New xxx-profile filter levels are added to specify if a profile should
be used instead of testing for the presence of a profile file.

This change should allow for different compiler-filters to be set for
different package manager use cases.

Bug: 27689078
Change-Id: Id6706d0ed91b45f307142692ea4316aa9713b023
b077e15d2d11b7c81aacbcd4a46c2b1e9c9ba20d 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430

(cherry picked from commit d91b8a2464b99625efe03caf7d30c8372bc378ed)

Change-Id: I6ce450350f388451f7bab7d285c1846d539a4b13
d91b8a2464b99625efe03caf7d30c8372bc378ed 18-Feb-2016 Calin Juravle <calin@google.com> Update GetDexOptNeeded to handle the different levels of compilation

extract-only or profile-guide oat files are considered up to date from
runtime perspective as they don't necessary need (re)compilation or
relocation. However, it is useful to return a more refined code to the
caller so that they can decide whether or not that's good enough.

For example, the package manager might decide to still compile a
previous extract-only and during profile guide compilation we should
always recompile even if we have an oat file.

Note that dex files compiled via ClassLoaders will still be fully
compiled.

This change introduces:
- a new key in the oat header kCompilationType to capture what type of
compilation has been made. Note tha the key might be missing. The
distinction is needed in order to avoid recompilation of a previous
fully compiled file during profile guide compilation analysis.
- a new argument to GetDexOptNeeded which tells the runtime to cast its
opinion whether or not the oat file is up to date relative to the
desired target type of compilation.

Bug: 27189430
Change-Id: Icd9794b1df6f6e21242e1dd1d5b5d064963dbbb7
fbc31087932a65e036a153afab3049dc5298656a 24-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Load app images""

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
1bc977cf2f8199311a97f2ba9431a184540e3e9c 23-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Load app images"

Fails when a method is duplicated (see test 097-duplicate-method)

Bug: 22858531

This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46.

Change-Id: Ib30ae5be00cc568e799290be6b3c8f29cbbe4c20
f7fd970244f143b1abb956e29794c446e4d57f46 09-Nov-2015 Mathieu Chartier <mathieuc@google.com> Load app images

Support in-place patching of the app image based on boot image
location and app oat location. Only loads for art run test so far
since we do not automatically generate app images for app installs.

N5 maps launch time (~200 runs):
Before: 930ms
After: 878.18ms
After + image class table: 864.57ms

TODO:
Oatdump support.
Store class loaders as class roots in image.

Bug: 22858531

Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
689a700d1c8a7c9e7ce74e6a2b45dae94c79cb7c 20-Nov-2015 Mathieu Chartier <mathieuc@google.com> Pass DexPathList.Element array to openDexFileNative

App images will use this to check for conflicts. It is required to
pass down since the class loader won't have the element array until
after all of the elements in the dex path list are loaded.

Bug: 22858531
Change-Id: I4f3d85b5e0ad542298fc8458bafe6504c263dc41
04302dbb106d590ff72c0dfecda23d85b6565059 12-Nov-2015 Hiroshi Yamauchi <yamauchi@google.com> Fix class unloading with the CC collector.

Avoid unnecessarily decoding dex cache and class loader weak roots,
which would trigger read barriers.

Re-enable 141-class-unload with the CC collector.

Bug: 12687968
Bug: 24468364
Change-Id: Ib4c19f25000873cab0e06047040442d135285745
b190d945459253c329062dab2440671828275767 12-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add class loader argument to openDexFileNative

Bug: 22858531
Change-Id: I315919d91822db0c73cf16b21d660d5870d5746f
00310e0bb4ee541b99f0b687dbf5f706db2aabca 17-Oct-2015 Mathieu Chartier <mathieuc@google.com> Keep dex files live in class table

The DexFile.loadClass API allows callers to load classes using a
dex file without having that dex file owned by the specified class
loader. We now add the dex file to the class table to make sure it
stays live until the class loader is unreachable.

Fixes interpreter gcstress test 087 with 64 bit.

Bug: 22720414
Change-Id: Ia4341149f45b6293312f8b275c7a68cea179f718
d57d454a11ac6f49eaa397ec14d6231e3a2727b7 14-Oct-2015 Mathieu Chartier <mathieuc@google.com> Allocate dex cache arrays in their class loader's linear alloc

Fixes memory leak for class unloading where the dex cache arrays
used to be in the runtime linear alloc which never got freed.

TODO: Some of the callers like the compiler just use the runtime
linear alloc. We could clean this up if we want to have class
unloading during compilation for some reason.

Added regression test.

Bug: 22720414

Change-Id: Ia50333a06a339efbdaedb5ad94b7a1ae841124ec
80b37b7e679a530738c9bcbd39873b6dacf177e5 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Fix structural class checks

Enabled for debug builds to prevent bit rotting. Changed
DexFileAndClassPair to work with std::queue.

Re-enabled structural check tests.

Change-Id: Ia981564650bf1c7e418d8a73efcc15733ddf7501
fdccbd418694a4216151e562faa5fd9fe6e12057 14-Oct-2015 Mathieu Chartier <mathieuc@google.com> Do not attempt to unregister null oat files

The oat file in the DexFile array may be null if we are running
without dex2oat.

Bug: 22720414
Change-Id: Ie1014b740caa77c3484a1671f29edb42bcc746c0
e58991b3b2282b5761f1a6023a16c803e1c4eb45 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Unload oat files""

Fixed a race where two threads calling OatFile::Open could both use
dlopen on the host.

Bug: 22720414

This reverts commit 72da5e7461fec3b1e116050f2e6f233efb9c54f3.

Change-Id: I1636045b724944d2a09417527280784967957095
72da5e7461fec3b1e116050f2e6f233efb9c54f3 13-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Unload oat files"

Tentative, will monitor bots if flakiness is fixed.

Bug: 22720414

This reverts commit 18656fefc7e68e2549a8fa93455074d359d1efa8.

Change-Id: I53b645b73207ccd21cad6ddac1de483bcc158794
18656fefc7e68e2549a8fa93455074d359d1efa8 10-Oct-2015 Mathieu Chartier <mathieuc@google.com> Unload oat files

Unregister and delete oat file when we call DexFile.closeDexFile if
all of the dex files are no longer in use. We store the oat file as
the first element of the dex files array (cookie).

Added a test that reads the proc maps to ensure there are no
unload-ex maps. Also some clean up.

Bug: 22720414

Change-Id: I52ab84562d1045e94b9a37aafe57609a14f188f7
f9c6fc610b27887f832e453a0da1789187293408 07-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add OatFileManager

Takes over a large amount of functionality from the class linker.

Changed OatFile to loading the same OatFile multiple times. This is
required for unloading OatFiles and moving dex caches to BSS since
these require a different OatFile for each dex cache and class
loader.

Bug: 22720414

Change-Id: I0321096723a294dc72949f21e66da82727b512fc
1d7d7f15f9fbb1111d4b7d79c1dab2f49a5960dc 26-Sep-2015 Mathieu Chartier <mathieuc@google.com> Delete DexFiles in closeDexFiles

TODO: Also unmap oat code.

Bug: 22720414
Change-Id: I4d003d9b7f8c22890e7b40121a73081524e71f42
673ed3d8aedc5462a47ded827c99f35d46525457 28-Aug-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Change dex caches to be weak roots""

This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.

Boot.oat creation time goes from 4.7s to 4.9s on host due to extra
locking. Will try to improve this in another CL.

Bug: 23602225
Bug: 22720414

Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
81a9087f0df0518c39405b7d18ba5858a6d8b77b 28-Aug-2015 Brian Carlstrom <bdc@google.com> Revert "Change dex caches to be weak roots"

This reverts commit 3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4.
3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4 14-Aug-2015 Mathieu Chartier <mathieuc@google.com> Change dex caches to be weak roots

Changed dex caches to be weak roots. This is necessary for class
unloading since the resolved types arrays would keep classes live
when they should be unloaded. Currently the dex caches still don't
get freed due to the class loader roots.

Also deleted some unused functionality in image writer.

Bug: 22720414
Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7 04-Aug-2015 Igor Murashkin <iam@google.com> Revert "cleanup: Replace pointers with out-parameters and fix-up formatting"

This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.

--

Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.

--

Revert "base: replace raw pointers for out-parameters with safer out<T>"

This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
bc1d78daa463572c5a770cdca858a3b51d8e1b7b 31-Jul-2015 Igor Murashkin <iam@google.com> runtime: cleanup class_linker out-parameters and formatting

* Use out<T> instead of parameters
* Fixes up some other signatures to be more correct
* Reformat parameters to be one per line if they can't fit on one line
* Reformat locks to be one per line if they can't fit on the decl line

Change-Id: Ib71b08707d3ed0bb85299406c0b23a1de4e92a1c
40c8141b48275afd1680b99878782848ab3a6761 01-Aug-2015 Igor Murashkin <iam@google.com> Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit 0de694ed3efe8412b83622a24074831edcc7e384.

Change-Id: I4b185584d6e47918179b16d76709cc3366872f3c
0de694ed3efe8412b83622a24074831edcc7e384 31-Jul-2015 Igor Murashkin <iam@google.com> runtime: cleanup class_linker out-parameters and formatting

* Use out<T> instead of parameters
* Fixes up some other signatures to be more correct
* Reformat parameters to be one per line if they can't fit on one line
* Reformat locks to be one per line if they can't fit on the decl line

Change-Id: I1031cf4edc41f95b89edb343d43ef93e15384206
2cebb24bfc3247d3e9be138a3350106737455918 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Replace NULL with nullptr

Also fixed some lines that were too long, and a few other minor
details.

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
95abd04d211470ea4b9b9191b96dd0f32e7ce3a4 24-Mar-2015 Richard Uhler <ruhler@google.com> Rename isDexOptNeededInternal and add kSelfPatchOatNeeded

This change renames isDexOptNeededInternal to getDexOptNeeded and adds
another possible result: kSelfPatchOatNeeded. kSelfPatchOatNeeded is
returned when there is no odex file to relocate from but there is an
oat file that can be relocated in place.

Change-Id: Ib9a6373f98474f1242367b5285086251a9d580e5
66d874d96d5699bb090c59f47a5a528956ca053e 15-Jan-2015 Richard Uhler <ruhler@google.com> Create OatFileAssistant class for assisting with oat files.

The oat file assistant is used for determining whether dex2oat or
patchoat is needed, for running dex2oat or patchoat as needed to make
an oat file up to date, and to load dex files associated with a given
dex location.

The introduction of the OatFileAssistant class is meant to clean up and
consolidate code related to the management of oat files that was
duplicated and spread across dalvik_system_DexFile.cc and
class_linker.cc.

Bug: 11301553
Change-Id: I0c16027b9bae4570c2c50faa9c14f581c0cbafb8
324b9bb2f48be39e20077c1d7da45cf3dc47fe06 24-Feb-2015 Andreas Gampe <agampe@google.com> ART: Move DexFile vector to Java array

To avoid having native vectors only referenced by Java objects,
which look like leaks to Valgrind, use a Java array to store
references to native DexFile objects.

Change-Id: If3c2b31b9d0914ed1965cfd5e3fdb94ea41b1477
fbef44de596d298dc6430f482dffc933a046dd28 23-Dec-2014 Richard Uhler <ruhler@google.com> Use unique_ptr to track ownership of dex files.

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
0b1b1354d53f764ae9582ef04f9f11782b75442b 06-Jan-2015 Brian Carlstrom <bdc@google.com> Mute common case DexFile.isDexOptNeeded log spam

Bug: 18914409

(cherry picked from commit 9851595177fec4d5e328f201f1992719fb40db2a)

Change-Id: If9b741ff8e09400a421e0a0ba1bc0d9ef13a9f99
9851595177fec4d5e328f201f1992719fb40db2a 06-Jan-2015 Brian Carlstrom <bdc@google.com> Mute common case DexFile.isDexOptNeeded log spam

Bug: 18914409
Change-Id: I885f1aa87c48ff25353d44b720c7cff24ed01e45
48447025389cd67605041a28d4ded1528381bc4e 22-Oct-2014 Igor Murashkin <iam@google.com> 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
e7c9a8c2b8481aafbc6af4ce6229bd361ba24742 07-Nov-2014 Mathieu Chartier <mathieuc@google.com> 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

(cherry picked from commit 564ff985184737977aa26c485d0c1a413e530705)
564ff985184737977aa26c485d0c1a413e530705 07-Nov-2014 Mathieu Chartier <mathieuc@google.com> 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
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
90ca5c0301651101de0e363842e5d08ae65233f7 22-Oct-2014 Igor Murashkin <iam@google.com> 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
46774767fcf7780d1455e755729198648d08742e 22-Oct-2014 Igor Murashkin <iam@google.com> 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>.

Bug: 18035729
Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
667ab7c174ebdb16fc18487901c6857709adcdb8 17-Oct-2014 Brian Carlstrom <bdc@google.com> Some additional verbose logging for DexFile_defineClassNative

Change-Id: I6a86352e9eecf4cc5b529feb784e6cd5e8ec0a45
e8e39895249d24c9fe6f4eb0afa78b39ce0648bb 23-Sep-2014 Brian Carlstrom <bdc@google.com> Restore kReasonLogging for kDexoptNeeded and kPatchoatNeeded

Bug: 17565501

(cherry picked from commit 63582f211b7123d02f18dfa7075f6758ccb2b07c)

Change-Id: Ie1196191d92286e543ed099c7d1ea4712802912d
63582f211b7123d02f18dfa7075f6758ccb2b07c 23-Sep-2014 Brian Carlstrom <bdc@google.com> Restore kReasonLogging for kDexoptNeeded and kPatchoatNeeded

Bug: 17565501
Change-Id: Id40438b3d3deb36450fd56aee2a93c1c77ee26d4
3c13a794845e0cf7887e33b2ec20de7e6ba85f8f 19-Sep-2014 Andreas Gampe <agampe@google.com> ART: Only allow the zygote to create the global boot image

Do not allow arbitrary processes, even when root, to write the
boot image in /data/dalvik-cache.

Bug: 17478752, 17510489, 17439961
Change-Id: Iba2b74be6d0752f4221f4ff5ee295b45a34cb2e1
(cherry picked from commit 33c36d4f22ab6a5e61eb47b654deaf647c34e49c)
33c36d4f22ab6a5e61eb47b654deaf647c34e49c 19-Sep-2014 Andreas Gampe <agampe@google.com> ART: Only allow the zygote to create the global boot image

Do not allow arbitrary processes, even when root, to write the
boot image in /data/dalvik-cache.

Bug: 17478752, 17510489, 17439961
Change-Id: Iba2b74be6d0752f4221f4ff5ee295b45a34cb2e1
7b078e8c04f3e1451dbdd18543c8b9692b5b067e 10-Sep-2014 Ian Rogers <irogers@google.com> Compile time performance improvements focusing on interpret-only.

Reduce virtual method dispatch in the method verifier and make more code
inline-able.
Add a StringPiece with const char* equality operator to avoid redundant
StringPieces and strlens.
Remove back link from register line to verifier and pass as argument to reduce
size of RegisterLine.
Remove instruction length from instruction flags and compute from the
instruction, again to reduce size.
Add suspend checks to resolve and verify to allow for more easy monitor
inflation and reduce contention on Locks::thread_list_suspend_thread_lock_.
Change ThrowEarlierClassFailure to throw pre-allocated exception.
Avoid calls to Thread::Current() by passing self.
Template specialize IsValidClassName.
Make ANR reporting with SIGQUIT run using checkpoints rather than suspending
all threads. This makes the stack/lock analysis less lock error prone.
Extra Barrier assertions and condition variable time out is now returned as a
boolean both from Barrier and ConditionVariable::Wait.

2 threaded host x86-64 interpret-only numbers from 341 samples:
Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms
After change: Avg 139.163% 99% CI 3.027ms to 838.257ms
Reduction in average compile time after change is 20.9%.
Slow-down without change is 26.5%.

Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable
could return unresolved type when class loading is disabled.
Bug: 17398101

Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
20c89303a9d89ba857bf969ad14a31f12c3be878 20-Aug-2014 Andreas Gampe <agampe@google.com> ART: Relax GetInstructionSetFromString

Do not abort on an unknown instruction set string. Instead return
kNone and let the caller handle this.

Also simplify the patchoat tool to use this.

Bug: 17136416

(cherry picked from commit aabbb2066a715b3fd8e752291f74c6d77b970450)

Change-Id: I24131914bcf91c04ae93179bf809a2907f1f2b7a
aabbb2066a715b3fd8e752291f74c6d77b970450 20-Aug-2014 Andreas Gampe <agampe@google.com> ART: Relax GetInstructionSetFromString

Do not abort on an unknown instruction set string. Instead return
kNone and let the caller handle this.

Also simplify the patchoat tool to use this.

Bug: 17136416
Change-Id: I24131914bcf91c04ae93179bf809a2907f1f2b7a
9c290012b7f505ae1943ab87236f775b97a46e2d 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Execute an application even when dex2oat crashes.

Bug: 17000769

(cherry picked from commit 4fcdc94d22a4608e355aa8df36240181149d10e8)

Change-Id: Iccb1fec94fe64ce4c3097510952f275482b86aa9
4fcdc94d22a4608e355aa8df36240181149d10e8 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Execute an application even when dex2oat crashes.

Bug: 17000769

Change-Id: Iffeb582862a5e794b6c7364c7ec2368cfd0f2214
8c6c52110c5afd438741694520203a6d7e81a2a4 06-Aug-2014 Calin Juravle <calin@google.com> Revert "Rename openDexFileNative to openDexFile."

https://android-review.googlesource.com/#/c/103383/ introduces
absolute paths so we need back the old method name

Bug: 16644204
Bug: 16930747

This reverts commit 350b626eb1cfbaee7619e9453a4c018c07aed003.

(cherry picked from commit a2069c7152eb46e8c64b4c8d7e19e5fab5de6df4)

Change-Id: I55c8cb31bb79b1ed8ea51f63ec504d77f76a582a
202d1f0fd21260216cead743376c6eb4de0f7298 08-Aug-2014 Narayan Kamath <narayan@google.com> Use the right instruction set for checking dex-cache staleness.

We should use the instruction set we're asked to use, and not
the instruction set of the current runtime.

bug: 16876489

(cherry picked from commit 24e928bddaf8b4af6cdf6d64a7c35bfde059995c)

Change-Id: I07901f059f9966b961e76bc055eaa04ea0227824
24e928bddaf8b4af6cdf6d64a7c35bfde059995c 08-Aug-2014 Narayan Kamath <narayan@google.com> Use the right instruction set for checking dex-cache staleness.

We should use the instruction set we're asked to use, and not
the instruction set of the current runtime.

bug: 16876489
Change-Id: Ic2a30b7e7d23192b0189c1f868b73c5f4c7eb8f9
a2069c7152eb46e8c64b4c8d7e19e5fab5de6df4 06-Aug-2014 Calin Juravle <calin@google.com> Revert "Rename openDexFileNative to openDexFile."

https://android-review.googlesource.com/#/c/103383/ introduces
absolute paths so we need back the old method name

Bug: 16644204

This reverts commit 350b626eb1cfbaee7619e9453a4c018c07aed003.

Change-Id: I10f430a536bb1906a8452fea5846ec9e725e84bd
345c4b19758703793ed31024cfb79940e2c63b75 18-Jul-2014 Alex Light <allight@google.com> Make system use patchoat to relocate during runtime.

Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.

Bug: 15358152

(cherry picked from commit 6e183f2e973a20f2eaca135c240908e1bf98c5d0)

Change-Id: Ib21f4f41b6cbf18094e3ca1a30d65a3b197b71b0
6e183f2e973a20f2eaca135c240908e1bf98c5d0 18-Jul-2014 Alex Light <allight@google.com> Make system use patchoat to relocate during runtime.

Change dalvik_system_DexFile.cc so that isDexOptNeededInternal will be
able to indicate that a patchoat is required. Change default of relocate
option to be on.

Bug: 15358152

Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
350b626eb1cfbaee7619e9453a4c018c07aed003 16-Jul-2014 Calin Juravle <calin@google.com> Rename openDexFileNative to openDexFile.

We no longer need two distinct methods.

Bug: 15563230

(cherry picked from commit 8edcb9c8bc62fcbd181e136c32086f2b970306a4)

Change-Id: Ib95098af0dd26733b5946d8e24ae4dfbcdbec3ba
8edcb9c8bc62fcbd181e136c32086f2b970306a4 16-Jul-2014 Calin Juravle <calin@google.com> Rename openDexFileNative to openDexFile.

We no longer need two distinct methods.

Bug: 15563230
Change-Id: I71ae9e32da18fe1e6a06879579b53e11d29e98f7
833a48501d560c9fa7fc78ef619888138c2d374f 22-May-2014 Andreas Gampe <agampe@google.com> ART: Native support for multidex

Native support for zip files with multiple classesX.dex.

Works by explicitly looking for those files in ascending order. As
these files have no file system representation for themselves,
introduce synthetic dex locations: the name of the originating file
plus a colon plus the name of the dex file, e.g., test.jar:classes2.dex.

Opening a zip dex file will return all dex files in this way. This
keeps the changes to dex2oat minimal.

To hide multidex/synthetic names from the Java layer, let the handle
of dalvik.system.DexFile refer to a vector of DexFile objects. When
opening a location, test possible synthetic names and add them to the
vector. Thus, the original multidex jar in the classpath will be
associated with all embedded dex files.

Change-Id: I0de107e1369cbc94416c544aca3b17525c9eac8b
c5f17732d8144491c642776b6b48c85dfadf4b52 06-Jun-2014 Ian Rogers <irogers@google.com> Remove deprecated WITH_HOST_DALVIK.

Bug: 13751317
Fix the Mac build:
- disable x86 selector removal that causes OS/X 10.9 kernel panics,
- madvise don't need does zero memory on the Mac, factor into MemMap
routine,
- switch to the elf.h in elfutils to avoid Linux kernel dependencies,
- we can't rely on exclusive_owner_ being available from other pthread
libraries so maintain our own when futexes aren't available (we
can't rely on the OS/X 10.8 hack any more),
- fix symbol naming in assembly code,
- work around C library differences,
- disable backtrace in DumpNativeStack to avoid a broken libbacktrace
dependency,
- disable main thread signal handling logic,
- align the stack in stub_test,
- use $(HOST_SHLIB_SUFFIX) rather than .so in host make file variables.

Not all host tests are passing on the Mac with this change. dex2oat
works as does running HelloWorld.
Change-Id: I5a232aedfb2028524d49daa6397a8e60f3ee40d3
7bfa86ddf31a961a61e2994fe771345acd1717b4 12-Jun-2014 Nick Kralevich <nnk@google.com> consolidate profiles and profile-cache

Ownership problems originally prevented using the same directory
for /data/dalvik-cache/profiles and /data/dalvik-cache/profile-cache.
Now that ownership is assigned via init.rc, we can consolidate these
two directories.

Old profile files are stored in /data/dalvik-cache/profiles/ with
the "@old" extension. We use "@" instead of "." to avoid conflicts
should someone create a package ending in ".old".

Change-Id: Ic1b44009faa30d704855e97631006c4b990a4ad3
c1b643cc6ac45dbd0eabdcd7425c7e86006c27d6 31-May-2014 Calin Juravle <calin@google.com> Fixed and refactored profiler options handling

- extracted profiler options in a separate class
- switched from system property reading to command line arguments
- added profile based compilation options to CompilerOptions
- removed no longer used kProfile compilation filter
- optimize dex files only if the profiler is enabled
- clean up unused arguments

Bug: 12877748
Bug: 15275634
Change-Id: I37ff68e7694370950ce8db2360562e9058ecebb7
bb0b53f58f11c628f077603b56077dfed1a18f11 23-May-2014 Calin Juravle <calin@google.com> Clean up the sampling profiler

- rename variables/fields names to match the code style (use
_underscore_names_)
- extract common property parsing in utils.cc
- fail to load profile file if any line is malformed
- added ProfileFile to manage the profile data generate in the previous
runs (replaces ProfileHelper and nests ProfileData)

Bug: 12877748
Change-Id: Ie7bda30bfdeb7e78534c986615b0649eac12a97b
5221410e960d9af0edcba4206cc48ebdfbfe6be0 04-Jun-2014 Calin Juravle <calin@google.com> Use sendfile when copying profile file.

This removes the 4k stack allocation and allow to activate
-Wframe-larger-than=1728 compiler opion.

Bug: 15278350
Change-Id: I389ffe06feb3c1c1bf620e20164cca04a0594788
177b429a54a57adbe922037b1210e596d8348d2a 03-Jun-2014 Calin Juravle <calin@google.com> Fix a possible file descriptor leakage

Bug: 15279918
Change-Id: I7909a53f9028d2f445fb97a0a4293f36b3c012dd
8d1db3b178b793d7f48abfa1ebbbe72a3c51c3a9 28-May-2014 Brian Carlstrom <bdc@google.com> Fix DexFile.entries to return class names, not class descriptors

Bug: 15141726
Change-Id: I6caef98cdd49e85a65c033708180231a948ac352
(cherry picked from commit f2f9daf9ba33b15abddfc8f8d03a708a7908b765)
cf790bb92d8e0dcc7b38da6873d982b9e9881682 28-May-2014 Brian Carlstrom <bdc@google.com> Fix DexFile.entries to return class names, not class descriptors

Bug: 15141726

(cherry picked from commit f2f9daf9ba33b15abddfc8f8d03a708a7908b765)

Change-Id: I28ce8aae1713a9826a3373e1eb60e0edf267f64c
f2f9daf9ba33b15abddfc8f8d03a708a7908b765 28-May-2014 Brian Carlstrom <bdc@google.com> Fix DexFile.entries to return class names, not class descriptors

Bug: 15141726
Change-Id: I6caef98cdd49e85a65c033708180231a948ac352
e1ff199b3bbcf58ed9462e1b7aa47027294f4e4b 19-May-2014 Brian Carlstrom <bdc@google.com> Up-to-date odex files should take precedence over profile checks

Change-Id: I70b1e2537dc7c45334a70a4b9ec75329221090bc
46889ea4c43f1e3238851d1120c5f16a7212f4b6 20-May-2014 Ian Rogers <irogers@google.com> Fix DexFile.getClassNameList.

Bug: 15086891
Change-Id: I8eaf0d19a56ecaea236e93e84131f5e4ff0843f6
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
0e12bdc49744eb6d5c29b9611a8dbe10bac4cd53 15-May-2014 Brian Carlstrom <bdc@google.com> Add ISA directory to image and odex pathnames.

Bug: 14882223
Bug: 14694978
Change-Id: Ic1b5ae836b8e91ea461dcd4f3da8e38dc3bec00f
dd157d732b557a854b3689faf8a24170fb47c270 15-May-2014 Ian Rogers <irogers@google.com> Avoid some unnecessary use of stl types.

May be a minor performance win but really done for libc++ as this removes a
dependency on a library function whose prototype includes a std::string.

Change-Id: Ifc07a9caef1206caf2a69a6e1b0bfc0ba56c8c62
eb8167a4f4d27fce0530f6724ab8032610cd146b 08-May-2014 Mathieu Chartier <mathieuc@google.com> Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
52f84884433f3875f4b1bc5595b8d5a2d6fb3d99 02-May-2014 Narayan Kamath <narayan@google.com> Prevent spurious dexopts in 32-64 builds.

When we're checking if a file needs to be dexopted, we
need to compare oat file checksums with the image checksum
for the oat file's target instruction set and not the current
runtime's target instruction set.

bug:14475807

Change-Id: Ib44d8e3c6cdf3a37fce6332c694a6602c658e925
11d9f06a96a6909905c248ed684366190140095c 23-Apr-2014 Narayan Kamath <narayan@google.com> Use instruction specific dalvik cache dirs.

- All oat & art files are now placed under /data/dalvik-cache/<isa>/.
- GetDalvikCacheOrDie now requires a mandatory subdirectory argument,
and is implicitly rooted under /data/.
- Added helper methods to convert InstructionSet enums into strings
and vice versa.

(cherry picked from commit 2974bc3d8a5d161d449dd66826d668d87bdc3cbe)

Change-Id: Ic7986938e6a7091a2af675ebafec768f7b5fb8cd
2974bc3d8a5d161d449dd66826d668d87bdc3cbe 23-Apr-2014 Narayan Kamath <narayan@google.com> Use instruction specific dalvik cache dirs.

- All oat & art files are now placed under /data/dalvik-cache/<isa>/.
- GetDalvikCacheOrDie now requires a mandatory subdirectory argument,
and is implicitly rooted under /data/.
- Added helper methods to convert InstructionSet enums into strings
and vice versa.

Change-Id: I9bff2e2ca534e0b93842a50d5b272ddf6d5745f3
b0fa5dc7769c1e054032f39de0a3f6d6dd06f8cf 29-Apr-2014 Ian Rogers <irogers@google.com> Force inlining on trivial accessors.

Make volatility for GetFieldObject a template parameter.
Move some trivial mirror::String routines to a -inl.h.

Bug: 14285442

Change-Id: Ie23b11d4f18cb15a62c3bbb42837a8aaf6b68f92
09881a85579cab1779ddf6ba9a91eed861a13cb2 19-Apr-2014 Brian Carlstrom <bdc@google.com> Do not require dexopt when previous profile does not exist

Also turn down some dex2oat related noise

Bug: 14184659
Change-Id: I134890f2c452d7f85ca4b736b5724f42533c2a7f
329d18806792771dfee064203fe27875d79cd53a 08-Apr-2014 Andreas Gampe <agampe@google.com> Better error reporting when loading dex files

Collect all partial error messages and return them as cause
exceptions for the top-level exception returned.

Change-Id: I9661b8aed2a571dc88bf0f06d447108eeaed1409
9dae5b4b952824da45e9fd9c12cfcde9858f0974 07-Apr-2014 Calin Juravle <calin@google.com> Tweaked profile significant_difference.

- renamed to 'change_thr'
- now it represents how much the top K leading samples need to change
(in percents) in order to trigger compilation.
- extracted ProfileData & file parsing in profiler.h

Bug: 12877748
Change-Id: I10f66120dd5e68b8a690bfa0e9914c07f63c50d5
39c3bfbd03d85c63cfbe69f17ce5800ccc7d6c13 29-Jan-2014 Dave Allison <dallison@google.com> Make use of profiling information for dex2oat

If the profile file exists, the compiler driver will read it
and store the data in an internal map. Then, when we want to work
out whether to compile a method or not, the map is consulted and if
the method shows up with a high enough percentage of use we compile it.

The profile file itself is created by installd and is writeable by the
app. The file is in /data/dalvik-cache/profiles and is named by
the package name.

This also modifies the profiler itself to:

1. Only count runnable threads (not suspended threads) in the profile
2. Use system properties to allow tuning of the profile parameters
3. Merge profiles from multiple processes using file locking.

Bug: 12877748
Change-Id: Iab2f3a327a2860db2a80d5724277d6c626227f2b

Conflicts:
compiler/dex/frontend.cc
compiler/dex/mir_analysis.cc
compiler/dex/verification_results.cc
compiler/driver/compiler_driver.cc
dex2oat/dex2oat.cc
runtime/class_linker.cc
runtime/runtime.cc
runtime/runtime.h
9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40 28-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Remove oat file location in the image.

The oat file is now always in the same directory, and has the
same name as the image file. Only difference is the extension.

This also removes the need for host-prefix.

Change-Id: I16d1f7aeb1d58372d41921694664e9c321afc1ad
ef7d42fca18c16fbaf103822ad16f23246e2905d 06-Jan-2014 Ian Rogers <irogers@google.com> Object model changes to support 64bit.

Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.

Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.

Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
2d983907d6c3cf1d69f753e3db275158bdcb69a3 05-Feb-2014 Elliott Hughes <enh@google.com> Switch art over to a long in DexFile.

Change-Id: I4ced147941f0d564eaf7f314bc21f6fd9caf3cbb
60836d5a9bcf8b30984aae4279a4f6233b0bf622 16-Jan-2014 Vladimir Marko <vmarko@google.com> Fix opening oat files that are out of date.

Make sure we're not using an old MAP_PRIVATE mapping of an
OatFile after a forked process modifies the underlying file.

Change-Id: I5c6caaf34272c805e40e95ee690dd948d7406751
08cbf66dc4632913f80f8ac18082c39b7d52c7dd 11-Dec-2013 Brian Carlstrom <bdc@google.com> Do not require classes.dex to support stripped zip files

Change-Id: Ief34c1b559dbebda85d181ae49da7d35446c9b37
590fee9e8972f872301c2d16a575d579ee564bee 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Compacting collector.

The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.

Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.

Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.

Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.

Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.

Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..

TODO: Enable switching allocators, compacting on background, etc..

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
2ec3f71bee23d97ec35c80222c1d073b87b42a0f 30-Oct-2013 Jeff Hao <jeffhao@google.com> Fix openDexFileNative to throw pending exception when it fails.

Bug: 11391006
Change-Id: I2331d73a2ab8f70d46b1afb2649550c296e7393a
0d3bbff796454aca1495131ab4a866ebfef2e857 28-Oct-2013 Brian Carlstrom <bdc@google.com> Fix DexFile_isDexOptNeeded to clear an error_msg in a recoverable case

Change-Id: Id4a6d0ab8fb259fa0edcc18ce768b33e95afc28a
8d31bbd3d6536de12bc20e3d29cfe03fe848f9da 13-Oct-2013 Ian Rogers <irogers@google.com> Throw IOException at source of failing to open a dex file.

Before is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more
And after is:
java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex
at dalvik.system.DexFile.openDexFile(Native Method)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexFile.<init>(DexFile.java:59)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235)
at dalvik.system.DexPathList.<init>(DexPathList.java:113)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128)
at java.lang.ClassLoader.access$000(ClassLoader.java:65)
at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137)
Suppressed: java.lang.ClassNotFoundException: GCBench
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 1 more
Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found
... 5 more

Also, move dex file verifier messages out of logs.
In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller
scope. Bug 11301553.

Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
1eb512d33f94d1dd7ea38263307ba0f7a0dfa653 19-Oct-2013 Ian Rogers <irogers@google.com> Fast JNI support.

Use a modifier to signal a native method is a fast JNI method. If the
modifier is set then don't perform runnable transitions.

Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
756ee4e090bc1e1812b41fb7b4661df601a32ef9 04-Oct-2013 Brian Carlstrom <bdc@google.com> Find OatDexFile by DexFile name and checksum, not just checksum

Bug: 10614658
Change-Id: Ie0b5a34fd396b6299000c37909108c5e7e6ab80f
7c3d13aebdd8611cae58a1048bffb13cbdc465cb 05-Sep-2013 Brian Carlstrom <bdc@google.com> Use file magic to determine file type, not file extension.

Bug: 10614658
Change-Id: I9156dfca78ac8cd1c62fb258825cc791629270a4
ee39a10e45a6a0880e8b829525c40d6055818560 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
8b2c0b9abc3f520495f4387ea040132ba85cae69 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
Depends on:
https://googleplex-android-review.git.corp.google.com/362363
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
2e450bf45e1bacc9c356f6ab239ccfb31bd8d7e4 07-Sep-2013 Brian Carlstrom <bdc@google.com> Revert "Remove bogus fastpath from String::Equals(const StringPiece&)"

This reverts commit 8438ed31e10f3881ed92f03877d5edaca7d5b48c.

Bug: 10614658
Change-Id: I335f10a7140e1644957bc1cee21a9b310a558499
8438ed31e10f3881ed92f03877d5edaca7d5b48c 05-Sep-2013 Brian Carlstrom <bdc@google.com> Remove bogus fastpath from String::Equals(const StringPiece&)

Bug: 10614658
Change-Id: I907ec77a65c1ae29e800356abdf755a457620081
7dfb28c066159e6cde8181720f0c451a700ef966 22-Aug-2013 Ian Rogers <irogers@google.com> Don't scan image space when starting runtime.

Bug 10432288.
Find Classes and Strings from dex caches lazily rather than when the image is
loaded.
Make class status changes do notifies when there can be waiters.
For Class lookup there's a pathology if we always search dex caches and
so after 1000 failures move all classes into the class table.
Be consistent in using "const char*" for class linker descriptors as this
most easily agrees with the type in the dex file.
Improve the intern run-test so that it has a case of a literal contained in the
image.
Modify image_test to allow any valid lock word rather than expecting 0, ideally
we wouldn't see inflated monitors but we do due to NotifyAll (see bug 6961405).

Change-Id: Ia9bfa748eeccb9b4498784b97c6823141b1f6db8
02e25119b15a6f619f17db99f5d05124a5807ff3 15-Aug-2013 Mathieu Chartier <mathieuc@google.com> Fix up TODO: c++0x, update cpplint.

Needed to update cpplint to handle const auto.

Fixed a few cpplint errors that were being missed before.

Replaced most of the TODO c++0x with ranged based loops. Loops which
do not have a descriptive container name have a concrete type instead
of auto.

Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
414af10d719603fb4d8d972f5a022c17957b44e1 13-Aug-2013 Brian Carlstrom <bdc@google.com> Add flock(2)ing on dex-cache files to prevent races

Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
7571e8b761ebc2c923525e12ea9fcf07e62cb33e 13-Aug-2013 Brian Carlstrom <bdc@google.com> Add flock(2)ing on dex-cache files to prevent races

Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
f1d3455064792ac1c486a4a9c24279a37b4af473 13-Jul-2013 Brian Carlstrom <bdc@google.com> Do not mark pages executable unnecessarily to play nice with selinux

Change-Id: Ief4a5da38ac7c2cf7bf6f7a640cb63c5e8ed03bd
7940e44f4517de5e2634a7e07d58d0fb26160513 12-Jul-2013 Brian Carlstrom <bdc@google.com> Create separate Android.mk for main build targets

The runtime, compiler, dex2oat, and oatdump now are in seperate trees
to prevent dependency creep. They can now be individually built
without rebuilding the rest of the art projects. dalvikvm and jdwpspy
were already this way. Builds in the art directory should behave as
before, building everything including tests.

Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81