History log of /art/runtime/oat_file.h
Revision Date Author Comments
96dca1c979325cdd8d543982ced4ad4fd01994d7 19-Apr-2018 Nicolas Geoffray <ngeoffray@google.com> Pass the fd to OatFile::Setup to avoid selinux errors.

bug: 77853712
Test: test.py

(cherry picked from commit 30025095524e471ec347633e39f26ed0606bea65)

Change-Id: I2af5c784f2ca12cd5b0859d93500c16be6a03428
8f4b056427a9d2321e3aa4f21ca8ffb18b3e5ae6 02-Mar-2018 David Sehr <sehr@google.com> Move most of runtime/base to libartbase/base

Enforce the layering that code in runtime/base should not depend on
runtime by separating it into libartbase. Some of the code in
runtime/base depends on the Runtime class, so it cannot be moved yet.
Also, some of the tests depend on CommonRuntimeTest, which itself needs
to be factored (in a subsequent CL).

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host

Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
Merged-In: c431b9dc4b23cc950eb313695258df5d89f53b22

(cherry picked from commit c431b9dc4b23cc950eb313695258df5d89f53b22)
67bf42e89592c3a1c648f927f2ce3ccb189a1161 27-Feb-2018 David Sehr <sehr@google.com> Header library to remove dependence on runtime/

Add a new header library to remove libdexfile and others' dependence on
runtime (typically runtime/base) includes in libdexfile. Also a small step
to tease dexlayout and profman away from relying on these as well.

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host-gtest

Change-Id: I38e2fe399a75f4bc6318c77a71954c00ea73ec2b
0e09dfc9cbdd6c2510dbe50dba95cf9d2d815e79 13-Feb-2018 Calin Juravle <calin@google.com> Add --compilation-reason option to dex2oat

The compilation reason is an optional metadata specifying the reason for
compiling the apk. If specified, the string will be embedded verbatim in
the key value store of the oat file.

This will allow a more precise performance monitoring based on the actual
reason for compilation (e.g. install time vs background dexopt time).

Test: dex2oat_test
Bug: 73102540
Change-Id: I73c7fcc73e37a695f1684d9e282c7cc5be3030f8
0225f8e2939a9340cb7dcebfcfe7996a2bd9bce9 31-Jan-2018 David Sehr <sehr@google.com> Revert "Revert "Make libdexfile build independent of runtime dir""

This reverts commit 787784f9effb126b5d0d3dc97d544c4a477b5daf.

Reason for revert: Bot configuration issue.

Change-Id: I6a10bb4a9571f89c7e4dd095f9157e830a44e2de
Bug: 22322814
Test: make -j 50 checkbuild
787784f9effb126b5d0d3dc97d544c4a477b5daf 30-Jan-2018 David Sehr <sehr@google.com> Revert "Make libdexfile build independent of runtime dir"

This reverts commit b40b7e73469339a6b667b4a2e2b8690112a74dc9.

Reason for revert: on device libdexfile.so missing

Change-Id: I9bd61a98bef870400580e8c991cb061d3f57fa72
b40b7e73469339a6b667b4a2e2b8690112a74dc9 26-Jan-2018 David Sehr <sehr@google.com> Make libdexfile build independent of runtime dir

Remove libdexfile's dependency on utils.cc and move utf.cc into
/dex. Remove libdexfile's constituent sources from libart and
use libdexfile wherever libart is. Also remove some ART-specific
interfaces. Libdexfile's tests remain to be converted, plus
moving the files to a new directory peer to runtime/.

Bug: 22322814
Test: make -j 50 test-art-host
Change-Id: Ifaf695216e4a0e43d3aa377984d933f7a2a243c2
f30752709e1131ae1a4c16f22cc7a0960c198e77 08-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Don't embed the dex code in the oat file if dex is uncompressed.""

Bug: 63920015
Bug: 70854754

Test: oat_writer_test.cc, test.py

Revert was due to userdebug/user differences, which is fixed with:
https://googleplex-android-review.googlesource.com/#/c/platform/build/+/3434091/

This CL also fixes oatdump when the dex code is not in the .vdex file.

This reverts commit e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d.

Change-Id: Iec924be2ff8f03cf2ebe306e7a0018241f33beb0
210531f8775c89feb90d430cd5b6026b4cf8ef89 12-Jan-2018 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Move quickening info logic to its own table""

Bug: 71605148
Bug: 63756964

Test: test-art-target on angler

This reverts commit 6716941120ae9f47ba1b8ef8e79820c4b5640350.

Change-Id: Ic01ea4e8bb2c1de761fab354c5bbe27290538631
6716941120ae9f47ba1b8ef8e79820c4b5640350 12-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Revert "Move quickening info logic to its own table"

Bug: 71605148
Bug: 63756964

Seems to fail on armv7.

This reverts commit f5245188d9c61f6b90eb30cca0875fbdcc493b15.

Change-Id: I37786c04a8260ae3ec4a2cd73710126783c3ae7e
7a26f948204377130be7b738d70d7365c86a804b 05-Jan-2018 Mathieu Chartier <mathieuc@google.com> Move quickening info logic to its own table

Added a table that is indexed by dex method index. To prevent size
overhead, there is only one slot for each 16 method indices. This
means there is up to 15 loop iterations to get the quickening info
for a method. The quickening infos are now prefixed by a leb
encoded length. This allows methods that aren't quickened to only
have 1.25 bytes of space overhead.

The value was picked arbitrarily, there is little advantage to
increasing the value since the table only takes 1 byte per 4 method
indices currently. JIT benchmarks do not regress with the change.

There is a net space saving from removing 8 bytes from each
quickening info since most scenarios have more quickened methods than
compiled methods.

For getting quick access to the table, a 4 byte preheader was added
to each dex in the vdex file

Removed logic that stored the quickening info in the CodeItem
debug_info_offset field.

The change adds a small quicken table for each method index, this
means that filters that don't quicken will have a slight increase in
size. The worst case scenario is compiling all the methods, this
results in 0.3% larger vdex for this case. The change also disables
deduping since the quicken infos need to be in dex method index
order.

For filters that don't compile most methods like quicken and
speed-profile, there is space savings. For quicken, the vdex is 2%
smaller.

Bug: 71605148
Bug: 63756964
Test: test-art-host

Change-Id: I89cb679538811369c36b6ac8c40ea93135f813cd
9e734c7ab4599d7747a05db0dc73c7b668cb6683 05-Jan-2018 David Sehr <sehr@google.com> Create dex subdirectory

Move all the DexFile related source to a common subdirectory dex/ of
runtime.

Bug: 71361973
Test: make -j 50 test-art-host
Change-Id: I59e984ed660b93e0776556308be3d653722f5223
2c64a837e62c2839521c89060b5bb0dcb237ddda 04-Jan-2018 Vladimir Marko <vmarko@google.com> Change ClassStatus to fit into 4 bits.

In preparation for extending the type check bit string from
24 to 28 bits, rewrite ClassStatus to fit into 4 bits. Also
perform a proper cleanup of the ClassStatus, i.e. change it
to an enum class, remove the "Status" word from enumerator
names, replace "Max" with "Last" in line with other
enumerations and remove aliases from mirror::Class.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Bug: 64692057
Bug: 65318848
Change-Id: Iec1610ba5dac2c527b36c12819f132e1a77f2d45
ec2cdf4286921131a5f9b3ed12060657ec40f636 08-Dec-2017 David Srbecky <dsrbecky@google.com> Try to mmap vdex file within the address range of the ELF file.

Add ELF section for the vdex file and mmap it there at runtime.
This ensures that the data is at predictable location, which
is needed to be able to reference it from native debug-info.

This does not change the amount of memory allocated, or the
location of the data on disk. However, it does change how
the memory is allocated - it replaces two allocations
(ELF and vdex) by just one (ELF which includes the vdex).

Bug: 71579677
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing

Change-Id: Ie2abd36c8b6617a527368e71f932998bbe5ad38c
808c7a57bb913b13c22884f57cdacd59bf1fdb3f 15-Dec-2017 Mathieu Chartier <mathieuc@google.com> Make CodeItem fields private

Make code item fields private and use accessors. Added a hand full of
friend classes to reduce the size of the change.

Changed default to be nullable and removed CreateNullable.
CreateNullable was a bad API since it defaulted to the unsafe, may
add a CreateNonNullable if it's important for performance.

Motivation:
Have a different layout for code items in cdex.

Bug: 63756964
Test: test-art-host-gtest
Test: test/testrunner/testrunner.py --host
Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X32' --debug

Change-Id: I42bc7435e20358682075cb6de52713b595f95bf9
7314ad133572b52335d7232361e86bd6b8cc5f50 19-Dec-2017 Andreas Gampe <agampe@google.com> Revert "Don't embed the dex code in the oat file if dex is uncompressed."

This reverts commit ae7e83817e546848ef6b2949dd9065b153e14316.

Reason for revert: Broken wrt/ preopted apps and stripping

Bug: 63920015
Bug: 70777774
Change-Id: I39580684d46fa57bd780d2d8bedd65a47d58cf5e
Test: m
(cherry picked from commit e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d)
e166e67666bf4b23e4ed0a98f5e2bb3cae9cee7d 19-Dec-2017 Andreas Gampe <agampe@google.com> Revert "Don't embed the dex code in the oat file if dex is uncompressed."

This reverts commit ae7e83817e546848ef6b2949dd9065b153e14316.

Reason for revert: Broken wrt/ preopted apps and stripping

Bug: 63920015
Bug: 70777774
Change-Id: I39580684d46fa57bd780d2d8bedd65a47d58cf5e
Test: m
ae7e83817e546848ef6b2949dd9065b153e14316 20-Nov-2017 Nicolas Geoffray <ngeoffray@google.com> Don't embed the dex code in the oat file if dex is uncompressed.

Take uncompressed dex code as a signal that the app wants to
opt into b/63920015.

bug: 63920015
Test: dex2oat_test, 071-dexfile-clean-map

Change-Id: I878e7bb80fc895a2d9aafe81aa7666b86af1f808
58cc1cb66c1a96ffba4a314edb2c5b4e8b235d5b 20-Nov-2017 Nicolas Geoffray <ngeoffray@google.com> Pass the debug_info_offset explicitly.

In order to use debug_info_offset for encoding implementation details,
rewrite all indirect users of it to fetch it before calling DexFile
methods.

This allows keeping the DexFile interface clean of runtime
considerations.

Test: test.py
Change-Id: I4591e0039b5f822f4409aae411071ecbe97082b1
f3c52b42a035902245d00a619fed0275afb063d2 17-Nov-2017 Vladimir Marko <vmarko@google.com> Fill Class and String .bss slots in runtime.

Shift the responsibility for filling Class and String .bss
slots from compiled code to runtime. This reduces the size
of the compiled code.

Make oatdump list .bss slot mappings (ArtMethod, Class and
String) for each dex file.

aosp_taimen-userdebug boot image size:
- before:
arm boot*.oat: 36534524
arm64 boot*.oat: 42723256
- after:
arm boot*.oat: 36431448 (-101KiB, -0.3%)
arm64 boot*.oat: 42645016 (-76KiB, -0.2%)

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing
Test: m dump-oat, manually inspect output.
Bug: 65737953
Change-Id: I1330d070307410107e12c309d4c7f8121baba83c
b22dea05178034a40b84953a661f3ea613395d16 05-Oct-2017 Shubham Ajmera <shubhamajmera@google.com> Provide an option to pass odex and vdex fds in dexoptanalyzer

Test: test-art-host-gtest-oat_file_assistant
Bug: 67111829
Change-Id: I10b23e665987d4a4a7d0eab67f11bda3d5809554
44e5efa4ae79cf76c65f37fc41c1fa0ed431ec4a 12-Sep-2017 Calin Juravle <calin@google.com> Add check that classpath is up to date to getDexOptNeeded

Extend getDexOptNeeded to factor into the decision the expected class
loader context. If the context does not match, oat file assistant and
dexoptanalyzer will advise kDex2OatFromScratch.

Note that this does not currently extend the java side
DexFile.getDexOptNeeded. The calls coming from the java side will continue
to ignore the classpath checks by passing null as the class loader
context.

Bug: 62269291
Test: m test-art-host
Change-Id: Ia01728c06810e418bbcbfe2a774d1f904d2525ba
659a7dccd73c6b67e2d8bf56c84c09cbe69215c1 12-Sep-2017 Calin Juravle <calin@google.com> Add check that classpath is up to date to getDexOptNeeded

Extend getDexOptNeeded to factor into the decision the expected class
loader context. If the context does not match, oat file assistant and
dexoptanalyzer will advise kDex2OatFromScratch.

Note that this does not currently extend the java side
DexFile.getDexOptNeeded. The calls coming from the java side will continue
to ignore the classpath checks by passing null as the class loader
context.

Bug: 62269291
Test: m test-art-host
Change-Id: Ia01728c06810e418bbcbfe2a774d1f904d2525ba
0f3c7003e08a42a4ed8c9f8dfffb1bee1118de59 07-Sep-2017 Vladimir Marko <vmarko@google.com> Remove DexCache arrays from app oat .bss.

Their presence in the .bss was no longer necessary and
it doesn't really matter for memory usage whether they
are in the .bss or in the LinearAlloc. This removes
a lot of unnecessary code.

Test: m test-art-host
Test: testrunner.py --host
Change-Id: I63ccd4412fcb267341b8b012b7e3b09903f86625
120aa286ab6adf3e76a31bc61fb4e583e5158d71 06-Aug-2017 Mathieu Chartier <mathieuc@google.com> Store layout info in dex files

Store layout info for code sections inside of the oat file. This will
be used to advise the kernel when dex files are loaded in
a follow up CL.

Added unit test in dex2oat_test.

Bug: 63178181
Test: test-art-host

(cherry-picked from commit 75c5ed6e75f70002db5fa7c609137c04dd2bdf40)

Change-Id: I4777506886bde42ff0affdac412a8395e8013a40
75c5ed6e75f70002db5fa7c609137c04dd2bdf40 06-Aug-2017 Mathieu Chartier <mathieuc@google.com> Store layout info in dex files

Store layout info for code sections inside of the oat file. This will
be used to advise the kernel when dex files are loaded in
a follow up CL.

Added unit test in dex2oat_test.

Bug: 63178181
Test: test-art-host

Change-Id: I4777506886bde42ff0affdac412a8395e8013a40
a308a327884920cbb1e3e62964c4b5a01c29af8c 19-Jul-2017 Calin Juravle <calin@google.com> Change kMultiDexSeparator from ':' to '!'

The ':' separator is commonly used to separate class path elements. That
means that we cannot easily encode multidex location in a classpath
without complicating the parsing logic unnecessarily (e.g. when encoding
classpaths in the oat file).

For easy parsing and understanding kMultiDexSeparator and
kClassPathSeparator should have different values. ':' is a wide spread
classpath separator so this CL changes the value of kMultiDexSeparator to
'!' which is also commonly used to denote an object inside a given
container.

Test: m test-art-host
Bug: 38138251
Change-Id: I30995c553d9131478c6c071b27327df6d2de06a7
7b0648aa7cb4b7a58e73bf353e031dfe4553d9d7 08-Jul-2017 Calin Juravle <calin@google.com> Move dex files dependencies (en/de)coding to ClassLoaderContext

Encode the full class loader context in the oat file (rather than just a
list of dex files).

The context encoding matches the format used by dex2oat with the addition
of checksums.

Temporarily assert that at decoding time we are operating on a
PathClassLoader until the checking logic covers all supported cases.

Also, bump the version of the oat file because the format of the classpath
key has changed.

This is a transition step to minimize the size of follow up changes.

Test: m test-art-host
Bug: 38138251
Change-Id: I9ec0cfe092ce1afccb741a36e737896880d5f1d2
87e2cb64ab02d9bdc48255130c67168c809c5f62 14-Jun-2017 Calin Juravle <calin@google.com> Add support for processing class loader contexts

Initial support for recognizing the class loader contexts.

In order to correctly compile dex files which at runtime are loaded with
a non-trivial class loader chain we need to make dex2oat aware of the
precise runtime context.

This CL adds the infrastructure to process arbitrary and arbitrary chain
of class loaders. ClassLoaderContext is able to parse a class loader
spec from a string and create the runtime structure based on it.

The integration with dex2oat and oat file assistant will follow up.

The string specification looks like
"PCL[lib1.dex:lib2.dex];DLC[lib3.dex]"

It describes how the class loader chain should be build in order to
ensure classes are resolved during dex2aot as they would be resolved at
runtime. This spec will be encoded in the oat file. If at runtime the
dex file will be loaded in a different context, the oat file will be
rejected.

The chain is interpreted in the natural 'parent order', meaning that
class loader 'i+1' will be the parent of class loader 'i'. The
compilation sources will be added to the classpath of the last class
loader. This allows the compiled dex files to be loaded at runtime in a
class loader that contains other dex files as well (e.g. shared
libraries).

Note that we accept chains for which the source dex files specified
with --dex-file are found in the classpath. In this case the source dex
files will be removed from the any class loader's classpath possibly
resulting in empty class loaders.

* This is the first CL, which adds the infrastructure for processing
a class loader context. Currently it CHECKS that only a single
PathClassLoader is created.

Test: m test-art-host
Bug: 38138251
Change-Id: I312aa12b5732288f3c1df4746b5775a32e0bfb04
0eb882bfc5d260e8014c26adfda11602065aa5d8 15-May-2017 Vladimir Marko <vmarko@google.com> Use ArtMethod* .bss entries for HInvokeStaticOrDirect.

Test: m test-art-host-gtest
Test: testrunner.py --host
Test: testrunner.py --target
Test: Nexus 6P boots.
Test: Build aosp_mips64-userdebug.
Bug: 30627598
Change-Id: I0e54fdd2e91e983d475b7a04d40815ba89ae3d4f
513061a792b22c417c938d31c19581390709561c 01-Jun-2017 Andreas Gampe <agampe@google.com> ART: Clean up thread.h and thread_list.h

Remove dependency on stack.h and gc_root.h. Remove unused object
callbacks include. Factor out ManagedStack into its own set of files.
Fix up users of transitive includes.

Test: m test-art-host
Change-Id: I01286c43d8c7710948c161b1348faabb05922e59
e681bf7685ecf6a0645affe8a9c78b10a875d835 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

(cherry-picked from commit f79ac83a8c18b0bd81aafc9c8823f6bed35d8847)

Change-Id: Ib1f93b6920474d4ed008492da67d3a63174c5397
16d4843433e024100b4ecd183f827ad5bd8772a6 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Merged-In: I9667f0069c8d12e94598f8a78888d3855d870824
(cherry-picked from commit f79ac83a8c18b0bd81aafc9c8823f6bed35d8847)

Change-Id: I8e4703fdd4bfeb94f982e93abb7eb0cd71060fce
f79ac83a8c18b0bd81aafc9c8823f6bed35d8847 06-Apr-2017 Jeff Hao <jeffhao@google.com> Allow dex2oat to handle relative paths.

During installation at compile time, the PackageManager is passing
shared libraries to dex2oat with -classpath. For split apps, we want the
splits to have the proper dependencies, and are now passing previous
parts of the split apk as shared libraries as we compile them all. These
apks are staged in a temp dir during compilation, so we pass a relative
path for them instead.

Since PackageManager can now pass relative paths to dex2oat as shared
libraries, dex2oat has an added --classpath-dir switch to specify the
directory to use for relative class paths. At runtime when checking
shared libraries, we use oat file functionality to resolve relative paths
to determine if the paths match.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Change-Id: I9667f0069c8d12e94598f8a78888d3855d870824
84f50aecdeed2d9ed3206681820e41ad6af73a9c 06-Feb-2017 Richard Uhler <ruhler@google.com> Remove remaining uses of DexFile::GetChecksum.

Remove or replace with DexFile::GetMultiDexChecksums as appropriate.

Bug: 34604632
Test: m test-art-host, added image_space_test to test ValidateOatFile.
Change-Id: I1042e87f29a242046d055f0be374ad9fbce4671a
72ab684871f870aead76b23cb67deb046107b380 20-Jan-2017 Vladimir Marko <vmarko@google.com> Add class status for resolved erroneous classes.

Split the old ambiguous status mirror::Class::kStatusError
into kStatusErrorUnresolved and kStatusErrorResolved. Once
a class has been resolved, IsResolved() shall return true
even if the class later becomes erroneous. Allow returning
erroneous class from ClassLinker::EnsureResolved() if it has
been previously resolved. This allows consistent behavior
for retrieving classes, immune to multi-threaded races and
multi-dex weirdness. It also allows JVMTI to properly report
"prepared" (i.e. resolved) classes that are also erroneous.

The new behavior is consistent with the RI.

Add regression tests to 008-exceptions for inconsistent
behavior for multi-dex retrieval of erroneous resolved class
(wrapping or not wrapping the old exception based on which
dex file is used for lookup) and for a CHECK(IsResolved())
crash in ClassLinker::LoadSuperAndInterfaces() (without any
tests for similar checks that could have previously failed
only due to extremely unlikely race conditions; these should
now also be fixed).

Inconsistency still remains for class verification as shown
by the new exceptionsForSuperClassInitFailure() test in
008-exceptions, where interpreter and Optimizing still
cause different exceptions to be thrown.

Note: This is partially changing behavior implemented for
bug 28787733. Since we allow the class loader to retrieve an
erroneous resolved class, the ExceptionInInitializerError is
not thrown at all from VMClassLoader_findLoadedClass(), so
there is nothing to wrap in ClassNotFoundException.

Test: m test-art-host
Bug: 30627598
Bug: 28787733
Change-Id: I86cdca00f35a0d6221d2559e3026ac0428a3613c
5923b5238091d9cd65f988fc059deb4fbb2e7f08 08-Dec-2016 Richard Uhler <ruhler@google.com> Do not return patchoat for dexopt needed.

Dex preopt now always compiles PIC, so patchoat is no longer needed to
relocate prebuilts on first boot or system update when the boot image is
relocated.

The only remaining case when patchoat would be used on oat files is the rare,
unexpected case when something bad happens to the device, such as a boot loop,
to cause the prebuilt boot image to be relocated again. In this case, non-PIC
oat files compiled on device may have up-to-date dex and image checksums but
wrong patch deltas. In this case, it is fine to recompile the oat file from
scratch using dex2oat rather than using patchoat.

Test: oat_file_assistant_test
Bug: 33192586
Change-Id: If3f2457c7b358e1328476a460a0f15bfa89b7def
1b868498a176705b867e2572cc1bcbd58dbd62d6 17-Nov-2016 Mathieu Chartier <mathieuc@google.com> Use type lookup tables in compiler

This recently regressed and stopped happening, the fix creates fake
OatDexFiles so that the compiler uses the type lookup tables instead
of slow FindClassDef and FindTypeId.

Perf on host compile Facebook:
Before:
2.49%: art::DexFile::FindClassDef(unsigned short) const
1.59%: art::DexFile::FindTypeId(char const*) const

After:
0.42%: art::OatDexFile::FindClassDef(art::DexFile const&, char const*, unsigned long)
0%: art::DexFile::FindTypeId(char const*) const
0%: art::DexFile::FindClassDef(unsigned short) const

Average install (N6P 960 mhz average of 40 samples): 38.2s -> 35.64s

Bug: 32641252

Test: test-art-host, adb install.

Change-Id: I34df21dc2c155bc2579c5cafdd91f9cb0fead1a9
4acefd33064d37b41ca55c3c9355345a20e5f9c2 24-Oct-2016 Nicolas Geoffray <ngeoffray@google.com> Encode quickening info in .vdex.

We quicken vdex files for performance reasons, but when taking an OTA,
we need to revert the quickening to the original instructions. As vdex
should be independent of the oat file and oat file versions, we encode
the quickening data in the vdex.

test: m test-art-host-jit m test-art-host-gtest
bug:30937355

Change-Id: I9a543a161b70aa1cff99f8fe6f5b5cab7a6c4d31
97d7e1cd7f733cb33a0e238bec6d7ed525638cd1 04-Oct-2016 Vladimir Marko <vmarko@google.com> Remove #include "oat_file.h" from class_linker.h .

Refactor the OatClass and OatMethod related functions from
ClassLinker to OatFile and ArtMethod, respectively. Refactor
the remaining ClassLinker dependencies on OatFile to break
the #include dependency and reduce incremental build times.

Test: m test-art-host
Change-Id: Iebc5b9f81b48fbcf79821cc827a5d7c4a0261bf6
aad75c6d5bfab2dc8e30fc99fafe8cd2dc8b74d8 03-Oct-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Store resolved Strings for AOT code in .bss.""

Fixed oat_test to keep dex files alive. Fixed mips build.
Rewritten the .bss GC root visiting and added write barrier
to the artResolveStringFromCode().

Test: build aosp_mips-eng
Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test
Test: Run ART test suite on host and Nexus 9.
Bug: 20323084
Bug: 30627598

This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0.

Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
5f926055cb88089d8ca27243f35a9dfd89d981f0 30-Sep-2016 Vladimir Marko <vmarko@google.com> Revert "Store resolved Strings for AOT code in .bss."

There are some issues with oat_test64 on host and aosp_mips-eng.

Also reverts "compiler_driver: Fix build."

Bug: 20323084
Bug: 30627598

This reverts commit 63dccbbefef3014c99c22748d18befcc7bcb3b41.
This reverts commit 04a44135ace10123f059373691594ae0f270a8a4.

Change-Id: I568ba3e58cf103987fdd63c8a21521010a9f27c4
63dccbbefef3014c99c22748d18befcc7bcb3b41 21-Sep-2016 Vladimir Marko <vmarko@google.com> Store resolved Strings for AOT code in .bss.

And do some related refactorings.

Bug: 20323084
Bug: 30627598
Test: Run ART test suite including gcstress on host and Nexus 9.
Test: Run ART test suite including gcstress with baker CC on host and Nexus 9.
Test: Build aosp_mips64-eng.
Change-Id: I1b12c1570fee8e5da490b47f231050142afcbd1e
9aa352e92b6ca0f2250cb7f54dfbf4b1be714c19 16-Sep-2016 David Sehr <sehr@google.com> Remove TypeLookupTable from DexFile.

One more step towards removing runtime dependencies from the DexFile
API. This severs the ties to OatFile. Work remains to move MemMap out
of DexFile.

Bug: 22322814
Change-Id: I29e7ad8fd292c7919ed2689dc754b958b88d6819
Test: test-art-host
c93b3be140f6a57a572f2a4cdaf46aba87235a02 12-Sep-2016 David Brazdil <dbrazdil@google.com> Fix run-test after introduction of VDEX

Run-test 119-noimage-patchoat used to fail due to a codepath in
OatFile which allows to create an instance of the class from an
existing ElfFile instance. This patch updates the codepath to require
an existing VdexFile as well.

Test: art/test/run-test 119
Bug: 30937355
Change-Id: I8fd0e47f07921aaee999f73711766ada9c35d214
7b49e6cade09bc65b3b5f22d45fc9d0a7184e4f2 01-Sep-2016 David Brazdil <dbrazdil@google.com> Introduce VDEX file, use it for DEX files

This patch introduces a new output file called VDEX. In the future,
VDEX files will store pre-validated DEX files which do not need to be
re-extracted and re-verified when recompiling, e.g. due to new
profiling information or after a system update.

With this CL, the OatWriter writes DEX files into the VDEX and the
rest of its output into OAT. The OatFile class and related classes
are updated to load the VDEX at runtime and mmap the DEX file section
from it. Patchoat creates symlinks to the source VDEX files in the
target directory or copies the files if passed in as file descriptors.

The feature can be disabled by setting the environment variable
ART_ENABLE_VDEX to false.

Test: m test-art-host
Bug: 30937355
Change-Id: I54dcaececf6814c258c80524ec15e2e2ef69c8dd
9a37efc6e1a8dd9fe6978f209fb493510267c528 06-Aug-2016 Richard Uhler <ruhler@google.com> Clean up VLOG(oat) in OatFileAssistant.

Refactor GetOatDexFile to have an error message out parameter.

Change-Id: I6b933f1fcfc9726c051a9d9678d92587cc02501e
Test: OatFileAssistantTest with and without -verbose:oat logging turned on.
Test: m test-art-host
f0192c86a58b2f43378c9a2113007538dd38ddbf 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I72a352abdfc37eacd8bedfa6c218e3809ca8e39c
2ba8895b4257d0e32a7b269bc2e7f6a3ec39a86a 30-Apr-2016 Andreas Gampe <agampe@google.com> ART: Dump more OatDexFile data in oatdump

Add some stats about the enclosed dex file and type table when
dumping an oat file.

Bug: 28251566

(cherry picked from commit 00bb716039d23e02797a3858fcdb0380a9bb8855)

Change-Id: I80c14e85d68cd1e3e4c64b7b9d86059d5ac8a6ad
00bb716039d23e02797a3858fcdb0380a9bb8855 30-Apr-2016 Andreas Gampe <agampe@google.com> ART: Dump more OatDexFile data in oatdump

Add some stats about the enclosed dex file and type table when
dumping an oat file.

Bug: 28251566
Change-Id: I80c14e85d68cd1e3e4c64b7b9d86059d5ac8a6ad
5872d7cd6ceffe67550d0b021191ec66f1a34c5d 27-Apr-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Includes fix from a6d46161aea07ebd1cbd6ab78b2b323f940e9c1e

Bug: 26880306

(cherry-picked from commit 26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8)

Change-Id: I6bfc13693dbb835ca52fed2d03ec5346d43ec5d9
26e8a2f150cd7f7195a10650ab8a5b6fa5014bc8 29-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Bug: 26880306

Change-Id: Ib70a48ff700a5db9a5b4aaf731552556878ad8f7
9d07e3d128ccfa0ef7670feadd424a825e447d1d 31-Mar-2016 Vladimir Marko <vmarko@google.com> Clean up OatQuickMethodHeader after Quick removal.

This reduces the size of the pre-header by 8 bytes, reducing
oat file size and mmapped .text section size. The memory
needed to store a CompiledMethod by dex2oat is also reduced,
for 32-bit dex2oat by 8B and for 64-bit dex2oat by 16B. The
aosp_flounder-userdebug 32-bit and 64-bit boot.oat are each
about 1.1MiB smaller.

Disable the broken StubTest.IMT, b/27991555 .

Change-Id: I05fe45c28c8ffb7a0fa8b1117b969786748b1039
1c4eb04b6cb1427f96e9587bd425ee269b8c8479 29-Mar-2016 Richard Uhler <ruhler@google.com> Don't return kPatchOatNeeded if there is no patch info.

Bug: 27693977
(cherry picked from commit d1537b569b6cd18297c5e02d13cdd588c4366c51)

Change-Id: Icd25da796fc2c2b7542a47d1d8d3bcbcace145fb
d1537b569b6cd18297c5e02d13cdd588c4366c51 29-Mar-2016 Richard Uhler <ruhler@google.com> Don't return kPatchOatNeeded if there is no patch info.

Bug: 27693977
Change-Id: Ie1f27cc45f3cb434108a375136480cb92fd95e26
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
0b4cbd0c2a75b47ae09d21e5d73d2b1709cb5b9e 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

(cherry picked from commit bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0)

Change-Id: I9d1aa7eaa16795e5fbabc6974d245849e16b1d03
bcb6a72569a1401b36a3ad3b6aa4d13e29966cf0 09-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add oatdump support for app images

Example usage on host:
oatdumpd --app-oat=art/plus32.odex --app-image=art/plus32.art
--image=art/oats/system@framework@boot.art --instruction-set=arm

TODO: Add to oatdump test.

Bug: 27408512
Bug: 22858531

Change-Id: I320db8b76c780c6eadabcb45ce88f45950741484
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
6ea1a0e2168c8d9b6d97c075c73a72d84080f45b 29-Jan-2016 Mingyao Yang <mingyao@google.com> AOT compile framework code as non-debuggable

When a debugger attaches, we patch method entry points in framework
code to interpreter bridge. The code will later be jitted as debuggable.

Change-Id: Id148069ccad95e2339ba214742ae3ef4f084f495
df0a8275abadc96a6363b59f31c64981571d6ed9 18-Feb-2016 Mathieu Chartier <mathieuc@google.com> Use image oat file instead of image header for immune spaces

The old immune spaces logic used the oat file information in the
image header instead of the actual oat file pointer. This was
incorrect for the app image case since the app image oat file is
not necessarily at the address specified in the header. This bug
could cause an incorrect immune region that caused large objects
to get freed if they were within this immune region.

Added test.

Bug: 22858531

(cherry picked from commit 5351da0225d027a19420153615634a1c78966bca)

Change-Id: Ibf41b0c0a9a7b0d093146311e2603a186033e339
5351da0225d027a19420153615634a1c78966bca 18-Feb-2016 Mathieu Chartier <mathieuc@google.com> Use image oat file instead of image header for immune spaces

The old immune spaces logic used the oat file information in the
image header instead of the actual oat file pointer. This was
incorrect for the app image case since the app image oat file is
not necessarily at the address specified in the header. This bug
could cause an incorrect immune region that caused large objects
to get freed if they were within this immune region.

Added test.

Bug: 22858531
Change-Id: I243253e61ea1afd42c3bb2414c02ce6dd36d0f9c
ce4b0ba4d762775a86b3529ac76cb89199c0cc1e 28-Jan-2016 David Brazdil <dbrazdil@google.com> Ignore image checksum for ExtractOnly oat files

Oat files compiled with --compiler-filter=verify-at-runtime contain
no compiled code and therefore are independent of the boot image.
This patch stores an ExtractOnly flag in the oat header and skips
the image checksum test if the flag is set, rendering the oat file
up to date even after OTAs.

Bug: 26813999

Change-Id: I25291d5b49d9e9d0018844e957a2dc88ef6bdc27
049cff0ed5e28aa17a17e456efe3121b6d58910f 02-Dec-2015 Andreas Gampe <agampe@google.com> ART: Refactor oat_file.h/cc for better maintainability

Refactor the code so that generic oat file initialization (checking
ART symbols etc) is common between dlopen and ART's ElfFile
implementation. Reduce methods and fields exposed in the oat_file
header.

Change-Id: I5bf65dd8b7047a007c6bf435b55bdde306595e8d
d9786b0e5be23ea0258405165098b4216579209c 14-Oct-2015 Artem Udovichenko <artem.u@samsung.com> Implementation of fast lookup table to search class_def by descriptor

Lookup table is a hash table which built at compile time and stored
into oat file. At runtime the table is restored and used in the
method DexFile::FindClassDef(const char*) to perform fast search of
the class_def_idx by class descriptor. Advantages of the lookup table
over the HashSet (runtime/base/hash_set.h) are:
1. Lookup table is built at compile time and uses read-only memory at
runtime
2. Lookup table uses less memory then DexFile::Index (less by 80% for
/system/framework/framework.jar on Nexus5)
3. Lookup table does less string comparisons compared with HashSet
(less by 70% for zygote process on Nexus5)
The disadvantage of the lookup table is it increased boot.oat size by
0.2% on Nexus5 and application .oat file by 0.3% in average on Nexus5.

mathieuc changes:
Create lookup table in dex2oat to speed up compilation. Clean up code
to follow style guide and use less static functions. Added
performance measurements.

Compile ~100 APKs 5 times with filter interpret-only:
Before:
real 1m8.989s
user 0m59.318s
sys 0m7.773s

After:
real 1m1.493s
user 0m52.055s
sys 0m7.581s

App launch (AOSP N5 maps, average of 45 runs):
Before: 966.84ms
After: 923.733ms
Launch speedup is 4.7%

Memory usage compared to HashSet index on 50 various APK:
32 bit: HashSet ~625694b vs TypeLookupTable ~404268b
64 bit: HashSet ~1251390b vs TypeLookupTable ~404268b

Bug: 10921004
Bug: 20269715

Change-Id: I7246c1d9ad9fe81fe5c5907a4bf70396d8f9242a
06d7aaa75f3d6d21fe904d54208b28e486673d97 16-Oct-2015 Vladimir Marko <vmarko@google.com> Clean up OatFile.

In Setup(), avoid reading beyond the end and use the %zu
format specifier instead of %zd for size_t output.

Make the .bss section pointers non-const.

Change-Id: Ic8f066effe8037b552d8e911c6a5d17370d79ff4
09d0943f5efe92c1f3a6b9dbdf255adb0f960a22 08-Sep-2015 Vladimir Marko <vmarko@google.com> ART: Use .bss section for dex cache arrays.

Change-Id: I5fd507973b56f6a662a02a8c1dd9ac4493fb7b36
6bc4374e3fa00e3ee5e832e1761c43e0b8a71558 12-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Add an abstraction over a compiled code.

That's just step 1, moving code-related functions of ArtMethod to
another class. That class is only a wrapper on an ArtMethod, but will
be changed to be a wrapper around compiled code.

Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
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.
a315f5c546b796f55f4872bb6efc15eb858d9639 01-Aug-2015 Igor Murashkin <iam@google.com> cleanup: Replace pointers with out-parameters and fix-up formatting

Cleans all of oat_file.h/.cc, parsed_options.h./cc, runtime.h/.cc

Other files are touched only incidentally to use outof(x) instead of &x.

Change-Id: I0bb15111149d53bb21aac2199ef33bd35333b0ca
90443477f9a0061581c420775ce3b7eeae7468bc 17-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move to newer clang annotations

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

Future work:
Use capabilities to implement uninterruptible annotations to work
with AssertNoThreadSuspension.

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
c04c800e7bda94abfadc8c2d30f58c50b261b612 14-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Revert "Make dex2dex return a CompiledMethod after quickening.""""

This reverts commit ed6195a514e3253576af27ea9ba13038509d29ac.

Change-Id: Icb58854301e8982147cdebe3edf2e0d9e0a63a56
a26cb57f46fd3f27a930d9d688fe8670c1f24754 23-Apr-2015 David Srbecky <dsrbecky@google.com> ART stack unwinding fixes for libunwind/gdb/lldb.

dex2oat can already generate unwinding and symbol information which
allows tools to create backtrace of mixed native and Java code.

This is a cherry pick from aosp/master which fixes several issues.
Most notably:
* It enables generation of ELF-64 on 64-bit systems (in dex2oat, C
compilers already produce ELF-64). Libunwind requires ELF-64 on
64-bit systems for backtraces to work.
* It enables loading of ELF files with dlopen. This is required for
libunwind to be able to generate backtrace of current process (i.e.
the process requesting backtrace of itself).
* It adds unit test to test the above (32 vs 64 bit, in-proces vs
out-of-process, application code vs framework code).
* Some other fixes or clean-ups which should not be of much
significance but which are easier to include to make the
important CLs cherry-pick cleanly.

This is squash of the following commits from aosp/master:
7381010 ART: CFI Test
e1bbed2 ART: Blacklist CFI test for non-compiled run-tests
aab9f73 ART: Blacklist CFI test for JIT
4437219 ART: Blacklist CFI test for Heap Poisoning
a3a49fe Switch to using ELF-64 for 64-bit architectures.
297ed22 Write 64-bit address in DWARF if we are on 64-bit architecture.
24981a1 Set correct size of PT_PHDR ELF segment.
1a146bf Link .dynamic to .dynstr
67a0653 Make some parts of ELF more (pointer) aligned.
f50fa82 Enable 64-bit CFI tests.
49e1fab Use dlopen to load oat files.
5dedb80 Add more logging output for dlopen.
aa03870 Find the dlopened file using address rather than file path.
82e73dc Release dummy MemMaps corresponding to dlopen.
5c40961 Test that we can unwind framework code.
020c543 Add more log output to the CFI test.
88da3b0 ART: Fix CFI test wrt/ PIC
a70e5b9 CFI test: kill the other process in native code.
ad5fa8c Support generation of CFI in .debug_frame format.
90688ae Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write.
97dabb7 Fix build breakage in dwarf_test.
388d286 Generate just single ARM mapping symbol.
f898087 Split .oat_patches to multiple sections.
491a7fe Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write (again).
8363c77 Add --generate-debug-info flag and remove the other two flags.
461d72a Generate debug info for core.oat files.

Bug: 21924613
Change-Id: I3f944a08dd2ed1df4d8a807da4fee423fdd35eb7
82e73dcc290ae8603c8a2e533d6a8a19cc2983a3 17-Jun-2015 David Srbecky <dsrbecky@google.com> Release dummy MemMaps corresponding to dlopen.

This fixes memory leak.

Change-Id: I857f078e8559a56b2d10dd081256c41ab28c8ec6
3d21bdf8894e780d349c481e5c9e29fe1556051c 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

Added root visiting for runtime methods, not currently required
since the GcRoots in these methods are null.

Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes
--trace run-tests 005, 044.

Fixed optimizing compiler bug where we used a normal stack location
instead of double on ARM64, this fixes the debuggable tests.

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

ART: Fix casts for 64-bit pointers on 32-bit compiler.

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

Fixes Throwable::GetStackDepth for exception event detection after
internal stack trace representation change.

Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of
proxy method.

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

Was always using the conflict trampoline. Also included fix for
regression in GC time caused by extra roots. Most of the regression
was IMT.

Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to
detached thread.

EvaluateAndApplyChanges:
From ~2500 -> ~1980
GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

Previously we were comparing the size of the non moving space to
size of the image file.

Now we properly compare the size of the image space against the size
of the image file.

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

ArtMethod reference's size got bigger, so we need to move other args
and leave enough space for ArtMethod* and 'this' pointer.

This fixes mips64 boot.

Bug: 19264997
Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
e401d146407d61eeb99f8d6176b2ac13c4df1e33 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move mirror::ArtMethod to native

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS.
Some of the savings are from removal of virtual methods and direct
methods object arrays.

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
094ff2c0c1f736521c634d5f606e274cb6c55345 13-May-2015 Sebastien Hertz <shertz@google.com> Fix debuggable compiler flag detection for secondary dex files

Compiles secondary dex files like the primary dex file: if it has
been compiled with the --debuggable flag, compile secondary dex files
with the --debuggable flag too.

Therefore, dex files loaded at runtime are compiled the same way as
dex files compiled at install time on the classpath (excluding the
boot image that is not compiled debuggable).

Also adds debuggable key in the oat header and bump the oat version.

Bug: 20944228

(cherry picked from commit 0de1133ba600f299b3d67938f650720d9f859eb2)

Change-Id: If6b2236e7fe547cc421f57b573043748018d3ae0
0de1133ba600f299b3d67938f650720d9f859eb2 13-May-2015 Sebastien Hertz <shertz@google.com> Fix debuggable compiler flag detection for secondary dex files

Compiles secondary dex files like the primary dex file: if it has
been compiled with the --debuggable flag, compile secondary dex files
with the --debuggable flag too.

Therefore, dex files loaded at runtime are compiled the same way as
dex files compiled at install time on the classpath (excluding the
boot image that is not compiled debuggable).

Also adds debuggable key in the oat header and bump the oat version.

Bug: 20944228
Change-Id: I59119f3468adb27ab1d6026f2cefbebbd814224c
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
fa8429b967fe2260ece572337534c9dda6c50d8a 08-Apr-2015 Andreas Gampe <agampe@google.com> ART: Re-add dlopen

Re-add an oat-file path that uses dlopen to load oat files. This
code-path will be necessary to support libunwind unwinding through
properly CFI-annotated oat files, as libunwind consults the linker
about loaded ELF files.

We avoid the original dlopen issue, namely that the semantics of
dlopen disallow loading the same soname twice, by using an extension
of bionic that supersedes the specified behavior.

Change-Id: I4a7e3cb00d1ea156dad84f76826def2a5967c9ca
7848da48a0a4241dedc1cc83ac4931e61575eb92 09-Apr-2015 Andreas Gampe <agampe@google.com> ART: Store classpath information into oat file

Store a "dependency list" of class-path dex-files into the key-value
store of an oat file. The list is made up of dex locations and
corresponding checksums.

Add tests for encoding, decoding and checking the list.

Bug: 19781184
Change-Id: Ie700dd37e6e086db599c95d329ac1f1d2ff0b758
758a801b66c134361a7b43f7e83f85d1fb800c4c 04-Apr-2015 Andreas Gampe <agampe@google.com> ART: Enable Clang's -Wdeprecated

Replace throw() with noexcept.

Add default copy constructors and copy assignment constructors for
cases with destructors, as the implicit definition is deprecated.

Change-Id: Ice306a3f510b072b00bec4d4360f7c8055135c9d
07b3c2351bb527ea91c084dc19434600af9ae66b 01-Apr-2015 Richard Uhler <ruhler@google.com> Store OatDexFile instead of OatFile in DexFile.

This requires moving OatDexFile out of the OatFile class so that
a forward class declaration can be used for OatDexFile.

Bug: 19071355
Change-Id: Ibda85b78d0577e9e81073090616fc0f2fa526be3
e5fed03772144595c0904faf3d6974cc55214c8c 18-Mar-2015 Richard Uhler <ruhler@google.com> Support relative encoded dex locations in oat files.

Now when opening an oat file, the caller can pass an absolute dex
location used to resolve the absolute path for any relative
encoded dex locations in the oat file.

Bug: 19550105
Change-Id: I6e9559afe4d86ac12cf0b90176b5ea696a83d0e7
5c42c29b89286e5efa4a4613132b09051ce5945b 25-Feb-2015 Vladimir Marko <vmarko@google.com> Add support for .bss section in oat files.

Change-Id: I779b80b8139d9afdc28373f8c68edff5df7726ce
e5f13e57ff8fa36342beb33830b3ec5942a61cca 24-Feb-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add JIT""

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
a5ca888d715cd0c6c421313211caa1928be3e399 24-Feb-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add JIT"

Sorry, run-test crashes on target:
0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000'
10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000
10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c
10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0
10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010
10-05 12:15:51.633 I/DEBUG (27995):

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
2535abe7d1fcdd0e6aca782b1f1932a703ed50a4 17-Feb-2015 Mathieu Chartier <mathieuc@google.com> Add JIT

Currently disabled by default unless -Xjit is passed in.

The proposed JIT is a method JIT which works by utilizing interpreter
instrumentation to request compilation of hot methods async during
runtime.

JIT options:
-Xjit / -Xnojit
-Xjitcodecachesize:N
-Xjitthreshold:integervalue

The JIT has a shared copy of a compiler driver which is accessed
by worker threads to compile individual methods.

Added JIT code cache and data cache, currently sized at 2 MB
capacity by default. Most apps will only fill a small fraction of
this cache however.

Added support to the compiler for compiling interpreter quickened
byte codes.

Added test target ART_TEST_JIT=TRUE and --jit for run-test.

TODO:
Clean up code cache.
Delete compiled methods after they are added to code cache.
Add more optimizations related to runtime checks e.g. direct pointers
for invokes.
Add method recompilation.
Move instrumentation to DexFile to improve performance and reduce
memory usage.

Bug: 17950037

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

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
956af0f0cb05422e38c1d22cbef309d16b8a1a12 11-Dec-2014 Elliott Hughes <enh@google.com> Remove portable.

Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
957ca1cd025104fccb0b08928f955f9bdb4ab91c 22-Nov-2014 Mathieu Chartier <mathieuc@google.com> Delete ArtMethod gc_map_ field

Moved the gc_map field from OatMethod to OatQuickMethodHeader.
Deleted the ArtMethod gc_map_ field.

Bug: 17643507

Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48

(cherry picked from commit 807140048f82a2b87ee5bcf337f23b6a3d1d5269)
c6fc909c6b42b4c365b1e7f86639ee4b360249fa 22-Nov-2014 Mathieu Chartier <mathieuc@google.com> Delete ArtMethod gc_map_ field

Moved the gc_map field from OatMethod to OatQuickMethodHeader.
Deleted the ArtMethod gc_map_ field.

Bug: 17643507

Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48
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
998ee7d0f62a1ee7efaaad49e728d19c38b4c9c3 23-Oct-2014 Andreas Gampe <agampe@google.com> 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
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
d7392faea80acb5d73a027bb384e3222bc2c2e43 23-Oct-2014 Andreas Gampe <agampe@google.com> 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
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
7ba649636c4475c3992fa15a57acd2546d69ff38 23-Oct-2014 Andreas Gampe <agampe@google.com> 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.

Change-Id: Ie1f1ef37125386a968228033d1e2bec565315510
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
2cbaccb67e22c0b313a9785bfc65bcb4b25d0676 15-Sep-2014 Brian Carlstrom <bdc@google.com> Avoid printing absolute addresses in oatdump

- Added printing of OatClass offsets.
- Added printing of OatMethod offsets.
- Added bounds checks for code size size, code size, mapping table, gc map, vmap table.
- Added sanity check of 100k for code size.
- Added partial disassembly of questionable code.
- Added --no-disassemble to disable disassembly.
- Added --no-dump:vmap to disable vmap dumping.
- Reordered OatMethod info to be in file order.

Bug: 15567083

(cherry picked from commit 34fa79ece5b3a1940d412cd94dbdcc4225aae72f)

Change-Id: I2c368f3b81af53b735149a866f3e491c9ac33fb8
34fa79ece5b3a1940d412cd94dbdcc4225aae72f 15-Sep-2014 Brian Carlstrom <bdc@google.com> Avoid printing absolute addresses in oatdump

- Added printing of OatClass offsets.
- Added printing of OatMethod offsets.
- Added bounds checks for code size size, code size, mapping table, gc map, vmap table.
- Added sanity check of 100k for code size.
- Added partial disassembly of questionable code.
- Added --no-disassemble to disable disassembly.
- Added --no-dump:vmap to disable vmap dumping.
- Reordered OatMethod info to be in file order.

Bug: 15567083
Change-Id: Id86a21e06d4a28f29f16fd018cba7e55c57f849a
be4e64303cc66bda0a12eaab835caa0bcfda3cd9 05-Sep-2014 Vladimir Marko <vmarko@google.com> Improve dex location canonicalization-related performance.

Eagerly add canonical dex file locations to the OatFile's
primary lookup map in Setup(). This moves the boot.oat work
from every app startup to the zygote initialization. Since
we always ended up initializing the canonical location map
anyway due to the way that we're loading dex files, the lazy
initialization didn't save anything.

Clean up dex file name canonicalization to make sure we
free() the memory returned by realpath() rather than using
std::unique_ptr<> with the default deleter.

Avoid some unnecessary duplicate OatDexFile lookups.

Bug: 16828525
Bug: 17346103

(cherry picked from commit aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4)

Change-Id: Icc4b14ebe903282ca91ce24e33a6d7c75dff991c
aa4497db59f1eeec954f2ba5da6d458fcdf9b3a4 05-Sep-2014 Vladimir Marko <vmarko@google.com> Improve dex location canonicalization-related performance.

Eagerly add canonical dex file locations to the OatFile's
primary lookup map in Setup(). This moves the boot.oat work
from every app startup to the zygote initialization. Since
we always ended up initializing the canonical location map
anyway due to the way that we're loading dex files, the lazy
initialization didn't save anything.

Clean up dex file name canonicalization to make sure we
free() the memory returned by realpath() rather than using
std::unique_ptr<> with the default deleter.

Avoid some unnecessary duplicate OatDexFile lookups.

Bug: 16828525
Bug: 17346103
Change-Id: Id8fbc8992f62996138eb2006a0046c6529747c09
bad0267eaab9d6a522d05469ff90501deefdb88b 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82

(cherry picked from commit 5369c40f75fdcb1be7a7c06db212ce965c83a164)
5369c40f75fdcb1be7a7c06db212ce965c83a164 25-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add native memory accounting through custom allocator.

Added a custom allocator that lets you pass in a special tag which
specifices where the allocation came from. This is used when
dumping. The performance overhead is low since each allocation only
does a atomic add/sub for each allocation/free.

The measurements are dumped to traces.txt during SIGQUIT.

Example output:
I/art (27274): AllocatorTagHeap active=120 max=120 total=168
I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724
I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608
I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080
I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392
I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044
I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688
I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760
I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136
I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56
I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8
I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156
I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020
I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864
I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320
I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852

Bug: 16238192

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82
fb7775981c7e6ecca78dcce774e9cc4db63e6e99 23-Aug-2014 Alex Light <allight@google.com> Support booting without functioning boot.oat/art patchoat.

Bug: 17000769

(cherry picked from commit 84d7605f93f1e6e86a16e02017e305c90e93117a)

Change-Id: I89c26a905af12ea288742368c2c038afd57a879a
84d7605f93f1e6e86a16e02017e305c90e93117a 23-Aug-2014 Alex Light <allight@google.com> Support booting without functioning boot.oat/art patchoat.

Bug: 17000769

Change-Id: I89c26a905af12ea288742368c2c038afd57a879a
0a112bbbcd761c749c346bfec0ec39c1ef37a590 14-Aug-2014 Alex Light <allight@google.com> Make apps able to run with a failing patchoat

Bug: 17000769

(cherry picked from commit 9dcc4572949f6a8231a1b4ed859676ba6f411726)

Change-Id: I0a1a4dc7f5d4bb268530840302ecfb1555231e05
9dcc4572949f6a8231a1b4ed859676ba6f411726 14-Aug-2014 Alex Light <allight@google.com> Make apps able to run with a failing patchoat

Bug: 17000769

Change-Id: I0a1a4dc7f5d4bb268530840302ecfb1555231e05
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
97b52f89e5e0b52a08d4b9a3953d0973a3cf5636 14-Aug-2014 Ian Rogers <irogers@google.com> Make OatClass and OatMethod immutable once more.

OatClass and OatMethod are representation of disk data and we don't want the
runtime to mutate this.

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

Bug: 17000769

Change-Id: Iffeb582862a5e794b6c7364c7ec2368cfd0f2214
4bb932773e47b1ce04602d81ffa5a8a7d863eb10 07-Aug-2014 Vladimir Marko <vmarko@google.com> Fix performance regression in OatFile::GetOatDexFile().

Try to avoid calculating the canonical location of the
dex file if possible and when we have to calculate it,
cache the lookup result for subsequent lookups.

Bug: 16828525
Bug: 16859671

(cherry picked from commit 3f5838d7d0b9fc63db0ccc35c2ea05ed29264986)

Change-Id: Ifd9a45dada2cc724382fd03c10f6437a6b71e666
3f5838d7d0b9fc63db0ccc35c2ea05ed29264986 07-Aug-2014 Vladimir Marko <vmarko@google.com> Fix performance regression in OatFile::GetOatDexFile().

Try to avoid calculating the canonical location of the
dex file if possible and when we have to calculate it,
cache the lookup result for subsequent lookups.

Bug: 16828525
Bug: 16859671
Change-Id: I0f03007ba5adf08656615900cf125075a3f2c541
a59dd80f9f48cb750d329d4d4af2d99d72b484d1 03-Jul-2014 Alex Light <allight@google.com> Runtime can now be set to require relocation

Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force
the runtime to require that all files that are run are relocated, to
prevent attacks based on the known art base address.

Add support for running patchoat on oat files compiled without an image.

Change run-test to have new --prebuild and --relocate flags.

Bug: 15358152

Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
98d1cc8033251c93786e2fa8c59a2e555a9493be 16-May-2014 Mingyao Yang <mingyao@google.com> Improve performance of invokevirtual/invokeinterface with embedded imt/vtable

Add an embedded version of imt/vtable into class object. Both tables start at
fixed offset within class object so method/entry point can be loaded directly
from class object for invokeinterface/invokevirtual.

Bug: 8142917
Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c 12-Jun-2014 Alex Light <allight@google.com> Add patchoat tool to Art.

Add a new executable called patchoat to art. This tool takes already
compiled images and oat files and changes their base address, acting as
a cheap form of relocation.

Add a --include-patch-information flag to dex2oat and code to add
required patch information to oat files created with the quick compiler.

Bug: 15358152

Change-Id: Ie0c580db45bb14ec180deb84930def6c3628d97d
539690a351d8c325707368729aafa2b4fa134d4c 05-Jun-2014 Vladimir Marko <vmarko@google.com> Avoid a memory allocation in OatFile::GetOatDexFile().

Use StringPiece instead of std::string as the map key.

Change-Id: I05516d273de617a7d714e39ce6c4236cec6a09f7
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
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
7624d25dad2d1ba25969ae704fccf68649103ae5 02-May-2014 Vladimir Marko <vmarko@google.com> Move quick frame info to OatQuickMethodHeader.

Rename OatMethodHeader to OatQuickMethodHeader, move frame
info from OatMethodOffsets to OatQuickMethodHeader. Retrieve
the info from other places for non-quick methods (portable
compiled bytecode or jni stub, generic jni, runtime,
abstract and proxy).

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields for frame size and spills."
https://android-review.googlesource.com/94164

Bug: 11767815
Change-Id: I0e31a7875d76732e1ec479c86b9b5ca01203507f
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
8a630577ed2d9e9571c3434c505e5de223b23c07 09-Apr-2014 Vladimir Marko <vmarko@google.com> Move mapping table and vmap table offsets to OatMethodHeader.

This change has a libcore/ companion CL
"Remove ArtMethod's quick fields mapping table and vmap table."
https://android-review.googlesource.com/91254

Bug: 11767815
Change-Id: I46ce2067e1ecd915da3890606498e31ffc332813
d3c5bebcb52a67cb06e7ab303eaf45f230c08b60 11-Apr-2014 Vladimir Marko <vmarko@google.com> Avoid allocating OatFile::OatClass on the heap.

Avoid allocating a BitVector for OatFile::OatClass::bitmap_
with kOatClassSomeCompiled methods. That makes the OatClass
copy-constructible as it doesn't own any memory. We use that
in OatFile::OatDexFile::GetOatClass() to return the result
by value thus avoiding one or two heap allocations per call.

Change-Id: Ic7098109028a5b49e39ef626f877de86e732ed18
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
ba150c37d582eeeb8c11ba5245edc281cf31793c 28-Aug-2013 Brian Carlstrom <bdc@google.com> Omit OatMethodOffsets for classes without compiled code

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

Bug: 10614658
Change-Id: Ie0b5a34fd396b6299000c37909108c5e7e6ab80f
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
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
96faf5b363d922ae91cf25404dee0e87c740c7c5 10-Aug-2013 Ian Rogers <irogers@google.com> Uleb128 compression of vmap and mapping table.

Bug 9437697.

Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a
(cherry picked from commit 1809a72a66d245ae598582d658b93a24ac3bf01e)
1809a72a66d245ae598582d658b93a24ac3bf01e 10-Aug-2013 Ian Rogers <irogers@google.com> Uleb128 compression of vmap and mapping table.

Bug 9437697.

Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a
fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d 17-Jul-2013 Brian Carlstrom <bdc@google.com> Fix multiple inclusion guards to match new pathnames

Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
56d947fbc9bc2992e2f93112fafb73e50d2aaa7a 15-Jul-2013 Brian Carlstrom <bdc@google.com> Add verification of boot.oat generated on device

Change-Id: I069586205a9a92fc7375ccf5cdde136bbbcfc800
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