History log of /art/runtime/mem_map.cc
Revision Date Author Comments
250a96671720090a3756d597a4bda0a394777222 17-Jun-2016 Christopher Ferris <cferris@google.com> Add lock when iterating over BacktraceMap.

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

Bug: 29387050
Bug: 31067025

(cherry picked from commit 56f8b5631ab2874dc2ec385802e38555acac0d90)

Change-Id: I48ecd2705b4aa4eedfed1daae2eb3b9b8bf8dda9
7ec0904eac1d799d3443b4c5e83545b72eae9ad3 02-Apr-2016 Andreas Gampe <agampe@google.com> ART: Dump less maps

Security has been tightened, so there are situations where we can't
load our files, and produce "log spam."

Bug: 27925454

(cherry picked from commit dfd7b70bbab8157fb385e4a6d6e4b55ae2e4e892)

Change-Id: Ia8c76184ea5087d625cf52d4459f8a557eebfafe
dfd7b70bbab8157fb385e4a6d6e4b55ae2e4e892 02-Apr-2016 Andreas Gampe <agampe@google.com> ART: Dump less maps

Security has been tightened, so there are situations where we can't
load our files, and produce "log spam."

Bug: 27925454
Change-Id: Ia8c76184ea5087d625cf52d4459f8a557eebfafe
29ab360433e0360bcccafb791b1231fe63914974 09-Mar-2016 Hiroshi Yamauchi <yamauchi@google.com> Fix valgrind errors with MemMap::Sync().

This fixes valgrind-test-art-host-gtest-oat_test and one error in
valgrind-test-art-host-gtest-image_test32.

Valgrind doesn't like it if an address range that contains noaccess or
uninitialized memory is passed to msync(). Temporarily lift the noaccess
protection of the lower-end redzone because msync accepts a page-aligned
base address only and exclude the higher-end noaccess redzone from the
range.

Bug: 27552451
Bug: 27384445
Change-Id: I8ccbd04c62eb30f6c6d5c732f1eb254fa09a417a
486932a225b21ffce9ba8557990d5ad4d135963d 24-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add MapAnonymous handling for null error_str

We use MapAnonymous with null error_str for app image loading when
we want to fail quickly. Also avoid doing CheckNonOverlapping in
CheckMapRequest if error_msg is null. The result from
CheckNonOverlapping is unused and CheckNonOverlapping is slow since
it creates a backtrace map.

Bug: 22858531
Bug: 26746779

(cherry picked from commit 83723aedac536fd8a3cd6e1662dbd6260e576194)

Change-Id: I0ff03a778b36303aa1e256fe7238dece5b3bbfab
83723aedac536fd8a3cd6e1662dbd6260e576194 24-Feb-2016 Mathieu Chartier <mathieuc@google.com> Add MapAnonymous handling for null error_str

We use MapAnonymous with null error_str for app image loading when
we want to fail quickly. Also avoid doing CheckNonOverlapping in
CheckMapRequest if error_msg is null. The result from
CheckNonOverlapping is unused and CheckNonOverlapping is slow since
it creates a backtrace map.

Bug: 22858531
Bug: 26746779
Change-Id: I8605ec0b9d9ae554a4b74f2606fa7dd81ade9021
6edb9aecdbe8b31f7ae1d35f21d013631337a424 08-Feb-2016 Hiroshi Yamauchi <yamauchi@google.com> Check pages are readable after mprotect for SEGV_ACCERR diagnosis

We have a suspected mprotect issue where we see seg faults after pages
are mprotected with PROT_READ|PROT_WRITE with the SS collector on
host. This change attempts to see if earlier reads would cause faults
similarly.

Bug: 19894268

Change-Id: I041a663c6b55b747120915f73a0db5f566744ed8
9bdf108885a27ba05fae8501725649574d7c491b 21-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Revert "Write dex files to oat file early.""

This reverts commit 919f5536182890d2e03f59b961acf8f7c836ff61.

Fix linker error (Mac build):
Replace inline definition of art::ZipArchive::~ZipArchive()
with an out-of-line definition in zip_archive.cc to avoid
direct reference to CloseArchive() from libart-compiler due
to inlining. Note that libart is linked against -lziparchive
but libart-compiler is not.

Change-Id: I92620ea0200282ca7ba9b7f61a592cb6468d90d8
919f5536182890d2e03f59b961acf8f7c836ff61 20-Jan-2016 Vladimir Marko <vmarko@google.com> Revert "Write dex files to oat file early."

This reverts commit 625a64aad13905d8a2454bf3cc0e874487b110d5.

Breaks the Mac build:

Undefined symbols for architecture i386:
"_CloseArchive", referenced from:
... in oat_writer.o
ld: symbol(s) not found for architecture i386

Change-Id: I21608bc51437834e1e6abde9bcbe5e7d9998197e
625a64aad13905d8a2454bf3cc0e874487b110d5 26-Nov-2015 Vladimir Marko <vmarko@google.com> Write dex files to oat file early.

Write dex files to oat file before we actually open and
verify them. Instead, open and verify the copies from the
oat file and use these. This way, in the most common case
of zipped dex files, we have mmapped dex files instead of
inflated dex files. That reduces the number of dirty pages
used by dex2oat.

Reading /proc/self/statm after we write the oat file for
a compilation of a certain large app on Nexus 5 AOSP build
with -j1, three attempts before and after this CL gave
before: 346061 189462 6269 26 0 140723 0
346189 189450 6269 26 0 140851 0
346061 189463 6269 26 0 140723 0
after: 346186 185808 23040 27 0 140468 0
346186 185819 23040 27 0 140468 0
346186 185822 23040 27 0 140468 0
These values are in pages (4KiB), so while the "size"
(=VmSize) is essentially unchanged, the "resident" (=VmRSS)
is over 14MiB less and the "shared" (i.e. backed by a file)
is 65.5MiB more. That is, the amount of dirty non-pageable
memory used is reduced by about 80MiB.

The oat file format has changed slightly, the class offset
table has been moved from the OatDexFile to its own section.
This actually fixes the alignment of these offsets as they
could have been unaligned previously, yet accessed as normal
with significant performance impact if the kernel has to
emulate the unaligned access (say, mips).

Change-Id: I0f4799bb1f1ca28e3533156a3494f55345c3e10a
a25dce9b452ba17ef7cef768926c884177a3025e 12-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Support --perf with jitted code.

Change-Id: I76f29d815234e9506efc59d4865780e52b2381a1
ebe2dfcb1346d2010787ebbb15ae2965fcd2b223 24-Nov-2015 Mathieu Chartier <mathieuc@google.com> Support null error_msg for select MemMap functions

In the failure case, reading proc maps takes 30ms. This is too slow
for app images.

Bug: 22858531
Change-Id: Ib6998cf82116720b23faec89d011fb7197c3d1cb
21e332526c3211826ea6d3ac1761f044a60c56f4 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Delete flaky DCHECK

Fixes mips build

Change-Id: I738b41f09f3c926f21640e358cf0bd5557167b0e
11cea0c9ab48c37e78948d077c44a39a94551df8 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Fix mac build

Change-Id: I22bf169f15483e54b97d77ff0887cd1fde428af9
42bddcec51e71d206f6d3b30a881ee6c1d50a63c 10-Nov-2015 Mathieu Chartier <mathieuc@google.com> Add low_4gb support to MapFile and MapFileAtAddress

Motivation is to use this for loading app images in low 4GB at a
non fixed address.

Added test.

Bug: 22858531
Change-Id: I0f79a4a7bfbfbdfc112e41b25c8682b1fb932ab7
24a0fc8df930584446d6e3628df9ec6c36e53239 14-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add some missing comments

Change-Id: I5ff393dfe082559887e9beed1fdb359035c5d3aa
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
0389cd57de8faedb85b749656b8e1735a7bce002 17-Sep-2015 Josh Gao <jmgao@google.com> Use arc4random_buf instead of getauxval(AT_RANDOM).

Reclaim the AT_RANDOM bytes used by ART for bionic.

Bug: http://b/23942752
Change-Id: Iceddce7f08fa887a7bb6828d75ef21426c413863
c60e1b755c5632dfeb04c333489ede52ee5c945f 30-Jul-2015 Andreas Gampe <agampe@google.com> ART: Use __ANDROID__ instead of HAVE_ANDROID_OS

Use the proper define.

Change-Id: I71e291ac25f5d5f0187ac9b6ef2d6872f19e6085
14d90579f013b374638b599361970557ed4b3f09 16-Jul-2015 Roland Levillain <rpl@google.com> Use (D)CHECK_ALIGNED more.

Change-Id: I9d740f6a88d01e028d4ddc3e4e62b0a73ea050af
1e13374baf7dfaf442ffbf9809c37c131d681eaf 20-May-2015 Evgenii Stepanov <eugenis@google.com> Generalize Valgrind annotations in ART to support ASan.

Also add redzones around non-fixed mem_map(s).
Also extend -Wframe-larger-than limit to enable arm64 ASan build.

Change-Id: Ie572481a25fead59fc8978d2c317a33ac418516c
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
1baabf0726eb285284e0c908ccba9f209b399fae 16-Jun-2015 David Srbecky <dsrbecky@google.com> Revert "Revert "Use dlopen to load oat files.""

This reverts commit 7a46b7e235a7c35191cd9ddbab6ca4db0e535da5.

Change-Id: I33439d0e3d7a7e63591a8c7b356e716dcb62bca1
7a46b7e235a7c35191cd9ddbab6ca4db0e535da5 16-Jun-2015 David Srbecky <dsrbecky@google.com> Revert "Use dlopen to load oat files."

This reverts commit 49e1fabc85480f01077f3cc10e8ba6ada6e4befa.

Change-Id: If49e8b60c458a992519b7fdabe02e7d53830edab
01d4b5072c064d927260486c891a09fe689289c0 13-Jun-2015 Mathieu Chartier <mathieuc@google.com> Pass reuse flag to MemMap constructor

Bug: 21806978
Change-Id: Iec92220d8f42e1d702ee39b27a8de570ea1ab588
49e1fabc85480f01077f3cc10e8ba6ada6e4befa 11-Jun-2015 David Srbecky <dsrbecky@google.com> Use dlopen to load oat files.

This is required to support in-process unwinding in libunwind.
libunwind obtains the list of loaded libraries from the linker,
therefore we need to use dlopen, otherwise it will not find them.

Change-Id: I5fd89cce6b909385cb89b8a48c0d817677acf299
38c8221b8f8bd0411006c44d3126f78eb6a8e9ab 05-Jun-2015 Mathieu Chartier <mathieuc@google.com> More LOW_4G optimizations

Eagerly try to map at an address when it doesn't overlap with
the ART known maps.

Reduces time spent creating the heap on N9 from ~100ms to ~10ms.

(cherry picked from commit 3ae250c16bae3462e040b844dbc2e2fc732d67ba)

Bug: 20727525
Change-Id: Ie8982ca9d1f3158104b2b53b992c3a28841fc443
3ae250c16bae3462e040b844dbc2e2fc732d67ba 05-Jun-2015 Mathieu Chartier <mathieuc@google.com> More LOW_4G optimizations

Eagerly try to map at an address when it doesn't overlap with
the ART known maps.

Reduces time spent creating the heap on N9 from ~100ms to ~10ms.

Bug: 20727525
Change-Id: Ie8982ca9d1f3158104b2b53b992c3a28841fc443
7889a77e464b820745c9507ccd484f68e7b1c650 04-Jun-2015 Mathieu Chartier <mathieuc@google.com> Add optimization for LOW_4G allocator

The optimization uses the maps_ field to skip over regions which we
know wont be large enough for the request.

Reduces time to create heap from 500-700ms to 100ms on N9.

(cherry picked from commit 1c8bef4a71612f10b89b102434f70de5a127cc74)

Bug: 20727525

Change-Id: I4fa92d58c2e135ba31a03ababff46669089bb542
1c8bef4a71612f10b89b102434f70de5a127cc74 04-Jun-2015 Mathieu Chartier <mathieuc@google.com> Add optimization for LOW_4G allocator

The optimization uses the maps_ field to skip over regions which we
know wont be large enough for the request.

Reduces time to create heap from 500-700ms to 100ms on N9.

Bug: 20727525

Change-Id: I4fa92d58c2e135ba31a03ababff46669089bb542
1d8199d8215a6ee7b1904edc47372d83fcdee5a3 02-Jun-2015 Kenny Root <kroot@google.com> Tidy up spelling

Change-Id: I65fba9d8310ff3759322cec3345235e6472f4cfb
dd5a4d0a9cdf75e8fffc3cc3a08c808bbd997b22 08-May-2015 Vladimir Marko <vmarko@google.com> ART: Merge entries with same name and protect in MemMap dump.

This should make the MemMap dump less chatty and allow the
logger to keep more relevant output.

Bug: 20873174

(cherry picked from commit 17a924abde2b0f1f37f6008b451a0a75190c71ff)

Change-Id: I1748f57a1f149a5498b42ee246f13d2bf1e8c2f7
17a924abde2b0f1f37f6008b451a0a75190c71ff 08-May-2015 Vladimir Marko <vmarko@google.com> ART: Merge entries with same name and protect in MemMap dump.

This should make the MemMap dump less chatty and allow the
logger to keep more relevant output.

Bug: 20873174
Change-Id: I09058798faa8f79d154cee5008017b03700df8db
8ee43e3ce18e90bfbf8cbeb05ff78ad281015d1a 08-May-2015 Vladimir Marko <vmarko@google.com> ART: Fix debug output for bad reused MemMap.

Log the error_msg instead of a pointer to it.
Raise the log level to ERROR for the process maps.

(cherry picked from commit b5505823ad3d0bab8fc9c15c266a3d8cd96ee59e)

Change-Id: Ib0c258961e2384125907aca4bae2108f36067d5f
b5505823ad3d0bab8fc9c15c266a3d8cd96ee59e 08-May-2015 Vladimir Marko <vmarko@google.com> ART: Fix debug output for bad reused MemMap.

Log the error_msg instead of a pointer to it.
Raise the log level to ERROR for the process maps.

Change-Id: I95f82f013d1c6360f40e6315652d1a2dda0f39e2
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
c785344b87221f5e4e6473e5b762e4e61fe65dcf 27-Mar-2015 Mathieu Chartier <mathieuc@google.com> Move ArtField to native

Add linear alloc. Moved ArtField to be native object. Changed image
writer to put ArtFields after the mirror section.

Savings:
2MB on low ram devices
4MB on normal devices

Total PSS measurements before (normal N5, 95s after shell start):
Image size: 7729152 bytes
23112 kB: .NonMoving
23212 kB: .NonMoving
22868 kB: .NonMoving
23072 kB: .NonMoving
22836 kB: .NonMoving
19618 kB: .Zygote
19850 kB: .Zygote
19623 kB: .Zygote
19924 kB: .Zygote
19612 kB: .Zygote
Avg: 42745.4 kB

After:
Image size: 7462912 bytes
17440 kB: .NonMoving
16776 kB: .NonMoving
16804 kB: .NonMoving
17812 kB: .NonMoving
16820 kB: .NonMoving
18788 kB: .Zygote
18856 kB: .Zygote
19064 kB: .Zygote
18841 kB: .Zygote
18629 kB: .Zygote
3499 kB: .LinearAlloc
3408 kB: .LinearAlloc
3424 kB: .LinearAlloc
3600 kB: .LinearAlloc
3436 kB: .LinearAlloc
Avg: 39439.4 kB

No reflection performance changes.

Bug: 19264997
Bug: 17643507

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

Change-Id: I779b80b8139d9afdc28373f8c68edff5df7726ce
a6dfdae1cffc78f9791348b2e1dc8f4c6c3f7128 25-Feb-2015 Andreas Gampe <agampe@google.com> ART: Print maps directly to log

Do not read proc maps into a string before printing them later back
to the log. In low-memory situations this can cause a bad_alloc.

External bug: http://b.android.com/153990
Bug: 19494774

Change-Id: Ie63d8788afe8c9da65b30b2f89c50d3dbb820755
68d1bfc0bb5a7be79354f6551dae6cd600c20e76 08-Jan-2015 Mathieu Chartier <mathieuc@google.com> Add clamp growth limit

Clamp growth limit shrinks the space memmaps to the current growth
limit. This reduces virtual memory usage for apps with small heaps.

Bug: 18387825
Bug: 17131630

(cherry picked from commit 379d09fe3c3feb7c2a2fb5a3623689b5ace7e79b)

Change-Id: I4f8e507fde1c8e10373615254aa0f1bf1b48a7ea
379d09fe3c3feb7c2a2fb5a3623689b5ace7e79b 08-Jan-2015 Mathieu Chartier <mathieuc@google.com> Add clamp growth limit

Clamp growth limit shrinks the space memmaps to the current growth
limit. This reduces virtual memory usage for apps with small heaps.

Bug: 18387825
Bug: 17131630

Change-Id: I4a8fdc335d2c40492e991708adabcc46299efb7d
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
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
c7dd295a4e0cc1d15c0c96088e55a85389bade74 22-Oct-2014 Ian Rogers <irogers@google.com> Tidy up logging.

Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to
dex2oat rather than runtime argument "-verbose-methods:".
Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc
except for a forward declaration.
Remove ConstDumpable as Dump methods are all const (and make this so if not
currently true).
Make LogSeverity an enum and improve compile time assertions and type checking.
Remove log_severity.h that's only used in logging.h.
With system headers gone from logging.h, go add to .cc files missing system
header includes.
Also, make operator new in ValueObject private for compile time instantiation
checking.

Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
c54e12a413e16f90526318f1f466a900a717fbb0 15-Oct-2014 Mathieu Chartier <mathieuc@google.com> Change MemMap::maps_ to not be global variable

Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.

(cherry picked from commit 6e88ef6b604a7a945a466784580c42e6554c1289)

Bug: 17962201
Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
6e88ef6b604a7a945a466784580c42e6554c1289 15-Oct-2014 Mathieu Chartier <mathieuc@google.com> Change MemMap::maps_ to not be global variable

Runtime.exit() was causing globals to get destructed at the same time
that another thread was using it for allocating a new mem map.

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

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
c8ccf68b805c92674545f63e0341ba47e8d9701c 30-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix some -Wpedantic errors

Remove extra semicolons.

Dollar signs in C++ identifiers are an extension.

Named variadic macros are an extension.

Binary literals are a C++14 feature.

Enum re-declarations are not allowed.

Overflow.

Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
655b4457c46057f41a3eddfa2d20457c6e93f566 11-Sep-2014 Brian Carlstrom <bdc@google.com> Revert "Workaround Darwin ContainedWithinExistingMap issue"

This reverts commit 29acd2f2e2d5f953535be1f71bc89cbb3a00f52c.

This workaround apparently is not needed in the master branches.

Bug: 16861075
Change-Id: I9aa3e3f8830c81a54bc5ba7fef3b9f87b81cdc4e
29acd2f2e2d5f953535be1f71bc89cbb3a00f52c 09-Sep-2014 Brian Carlstrom <bdc@google.com> Workaround Darwin ContainedWithinExistingMap issue

Bug: 16861075
Change-Id: I577a0c7ede919e610c356e7c40dd60d87914dd3a
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
b89c3da592de1a2741a08cc3c8ed2908e8bdd15a 21-Aug-2014 Narayan Kamath <narayan@google.com> Make a couple of map checks debug only.

This cost us close to 80ms in app startup times.

The checks that a reused region was within an already
existent map has been demoted to a debug check.

A couple of other negative checks have been removed
outright because one of them was superflous and the other
wasn't guaranteed to be correct.

bug: 16828525

(cherry picked from commit bddaea2b88b0a19d9cc7a4dea772af8e829323b3)

Change-Id: Ia6f3e69692bb9cb5b4ff6f47946ea38a56d4cdb6
bddaea2b88b0a19d9cc7a4dea772af8e829323b3 21-Aug-2014 Narayan Kamath <narayan@google.com> Make a couple of map checks debug only.

This cost us close to 80ms in app startup times.

The checks that a reused region was within an already
existent map has been demoted to a debug check.

A couple of other negative checks have been removed
outright because one of them was superflous and the other
wasn't guaranteed to be correct.

bug: 16828525
Change-Id: I00f76de06df0ea4ced40fdcb7825248d4b662045
35388e93f7dc45257bbffc675710728aeb663394 06-Aug-2014 Christopher Ferris <cferris@google.com> Check for a NULL pointer, do not call Build.

When calling BacktraceMap::Create(), a NULL pointer is returned if Build
fails. Building twice can cause problems and might leak memory.

(cherry picked from commit 836572a07142627ff291d686a4e9e03a0988344b)

Change-Id: I59d29bb6e5324de6eb099916045c2ab1d9e56630
836572a07142627ff291d686a4e9e03a0988344b 06-Aug-2014 Christopher Ferris <cferris@google.com> Check for a NULL pointer, do not call Build.

When calling BacktraceMap::Create(), a NULL pointer is returned if Build
fails. Building twice can cause problems and might leak memory.

Change-Id: I38a4100e534ef15a19883703aa504e795a14b6de
ac304133ab4b988777bcc5ad12257cbb99c3871e 28-Apr-2014 Jim_Guo <jim_guo@htc.com> ART: Fix memory unmapped twice issue in ElfFile::Load(bool)

Root Cause:
The overlapped memory region will be unmapped by
(1) ~MemMap() of reservation MemMap (reserve) and
(2) ~MemMap() of "reuse" MemMap (segment).
Someone takes the memory region after (1) and it will be unmapped in (2).
So, SIGSEGV occurs when using the unmapped memory region.

Solution:
Fixes this issue by skip unmap "reuse" MemMap in destructor.
And always create reservation MemMap before "reuse" MemMap. (It also solved
the fixupELF case which does not reserve the whole needed memory region).

Bug: 16486685

(cherry picked from commit a62a588a9202f69e53fbeb3045ea8ea5ec2587f8)

Change-Id: Icb83c8e87fa168027d9d8adb34925000399d3d2a
422f4733ce76eda8f4ebb5a3dce5c0a5a2264886 05-Aug-2014 Christopher Ferris <cferris@google.com> Use the uncached form of BacktraceMap::Create.

The code assumes that calling BacktraceMap::Create creates a map based
on the current state of the maps. This is not true by default, so
call the Create function indicating we want an uncached BacktraceMap object.

(cherry picked from 27a10f618357cf85cc0677a04f0a5a3a8a437aed)

Change-Id: Ic7a2dedaea9950174b24ede4dcda30ffe036fe93
27a10f618357cf85cc0677a04f0a5a3a8a437aed 05-Aug-2014 Christopher Ferris <cferris@google.com> Use the uncached form of BacktraceMap::Create.

The code assumes that calling BacktraceMap::Create creates a map based
on the current state of the maps. This is not true by default, so
call the Create function indicating we want an uncached BacktraceMap object.

Change-Id: I2c35149ba43db29ef0a9411fa5d9267d7c4dcbb3
a62a588a9202f69e53fbeb3045ea8ea5ec2587f8 28-Apr-2014 Jim_Guo <jim_guo@htc.com> ART: Fix memory unmapped twice issue in ElfFile::Load(bool)

Root Cause:
The overlapped memory region will be unmapped by
(1) ~MemMap() of reservation MemMap (reserve) and
(2) ~MemMap() of "reuse" MemMap (segment).
Someone takes the memory region after (1) and it will be unmapped in (2).
So, SIGSEGV occurs when using the unmapped memory region.

Solution:
Fixes this issue by skip unmap "reuse" MemMap in destructor.
And always create reservation MemMap before "reuse" MemMap. (It also solved
the fixupELF case which does not reserve the whole needed memory region).

Bug: 16486685
Change-Id: I8f2538861d5c3fa7b9a04d2c3f516319cc060291
c3ccc1039e0bbc0744f958cb8719cf96bce5b853 25-Jun-2014 Ian Rogers <irogers@google.com> Fix the Mac build on x86-64.

Change-Id: I4ed3783a96d844de0b0a295df26d0a48c02a3726
d6b6865cf787be8e4548e018762e72c7d1a40e52 23-Jun-2014 Ian Rogers <irogers@google.com> Mac doesn't define MAP_ANONYMOUS

Fix mac build.

Change-Id: I607e8fff227259fbf27e468193a705c8c3fc1b59
997f0f9e69ce7aee73cebd64be8dc40af9164257 22-Jun-2014 Ian Rogers <irogers@google.com> Limit the size of files created by run-test to 2MB.

In MemMap::MapAnonymous on the host, avoid creating ashmem regions that are
backed by files, when the size of the file will be greater than the ulimit.

Change-Id: I7cbf2ac59bf5869ed85850bea8d71898f3b7e1c7
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
3eed93dd5be03e5539827bebf0f414251a12e15e 04-Jun-2014 Hiroshi Yamauchi <yamauchi@google.com> Verify there's no mem map gap for immune region not to break.

This adds code that verifies that there's no memory map gap between
the image space and the main space so that the immune region
functionality won't silently break. For example, if there's a gap and
a large object is allocated in that gap, the large object is
incorrectly part of the immune region and the marking breaks.

Bug: 14059466
Change-Id: Ie6ed82988d74b6d0562ebbbaac96ee43c15b14a6
e06874a69a7d00bd8af26e54fabf2d3c532e06f9 30-May-2014 Mathieu Chartier <mathieuc@google.com> Fix race condition in MemMap::MapAnonymous.

Previously we were using MAP_FIXED which introduced a serious race
condition if MAP_32BIT was set since it would possibly overwrite
an existing map at the address which we determined was free with
msync. There was a window of time after we had msynced a page where
another thread could map something at that page. The new method
avoids using MAP_FIXED and unmaps allocations which succeed but
aren't in the low 4GB when MAP_32BIT is set.

Bug: 15338094
Bug: 14974497

(cherry picked from commit c355a2a78d6ebdfdb645221275affb9136b4c667)

Change-Id: I292a74dbf2ef5ddfb8d0524ae8bc1efbcbd106c8
c355a2a78d6ebdfdb645221275affb9136b4c667 30-May-2014 Mathieu Chartier <mathieuc@google.com> Fix race condition in MemMap::MapAnonymous.

Previously we were using MAP_FIXED which introduced a serious race
condition if MAP_32BIT was set since it would possibly overwrite
an existing map at the address which we determined was free with
msync. There was a window of time after we had msynced a page where
another thread could map something at that page. The new method
avoids using MAP_FIXED and unmaps allocations which succeed but
aren't in the low 4GB when MAP_32BIT is set.

Bug: 15338094
Bug: 14974497
Change-Id: I57f00baf4143e9fa17fb1d4c2be04b30705a2bfd
d8f26dbebe72c1cbdfa85bdeeb003283c7435db3 20-May-2014 Andreas Gampe <agampe@google.com> ART: Randomize mem_map start address for linear scan search

When using linear scan for mem_map, randomize the start of the
search with getauxval(AT_RANDOM).

Change-Id: Id1e4c86b928147d74b9b0b73ff704de5d87b4500
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
6bd621aa31aa94ed42a2a35256d219630bf0b687 17-May-2014 Andreas Gampe <agampe@google.com> ART: Move start of linear mmap_scan out of reserved space

The first 64KB are protected by SELinux, and we will never be
able to acquire them.

Bug: 15024270
Change-Id: I186a0d5262d396a089d4028a8527a9c56f96dc49
507dfdd147c97bfbadebfd63584d094b6a4e7b47 16-May-2014 Ian Rogers <irogers@google.com> Compatibility layer to transition from UniquePtr to std::unique_ptr.

Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr,
for the host switch to std::unique_ptr. For now the type remains called
UniquePtr.
Make dalvik compile with clang on the host, move its build to C++11.

Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
84d49ccd79088eb9a9f423c0a96e3905468cfe7d 24-Apr-2014 Qiming Shi <qiming.shi@intel.com> ART: Resolve MAP_32BIT limitation in x86_64

Add checks that ensure when low4gb is set and an expected pointer
is given the requested memory fits into 4GB.

On x86_64, only use MAP_32BIT when there is no expected pointer.
This avoids a limitation in mmap (only 2GB visible).

Add tests to check behavior.

Original Author: Qiming Shi <qiming.shi@intel.com>
Change-Id: Ia2e3e0a46764ef70126b0c264f1fae681622d3cb
aa94cf3e77035bf204a21d0341d8f8513a19885c 24-Mar-2014 Brian Carlstrom <bdc@google.com> Avoid strerror until we are sure there is an error

Change-Id: I8f0c5a9cb1b07bfffd5ce9f9ca33f53c8834e9f5
9de65ff3a9c49b91d80be292020f012f3d0a24ef 22-Mar-2014 Andreas Gampe <agampe@google.com> Fixes to mem_map wraparound and ARM64 quick_invoke assembly

There are only 6 free GPRs for passing in a non-static invoke. This
corrupted one register for long-signature methods.

The wrap-around did not actually wrap around correctly.

Change-Id: I62658dadeb83bb22960b9455e211d26ffaa20f6f
7104cbf9c594563c6daae592b8f38f49a423d12e 21-Mar-2014 Andreas Gampe <agampe@google.com> Fix sign problem, implement low-mem mmap wraparound

A signed value comparison meant that on 64b systems comparisons
were false when pointers > 2GB were in use (as happens in long-running
tests). Fix this to be uint.

Implement a simple wrap-around in the MAP_32BIT emulation code.

Change-Id: I09870b4755f2dca676e42e701fbb6f6eb4bb95d0
71a3ebabb2a6b4921071d115aa176d8222aeb803 17-Mar-2014 Andreas Gampe <agampe@google.com> Quick typo fix in the 4GB lowmem code

Change-Id: I3371776b0468cd8690e3811c7a1e57f5444e9d8f
8dba5aaaffc0bc2b2580bf02f0d9095c00d26a17 12-Mar-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Add memory allocation in low 4GB

MAP_32BIT is implemented for only x86_64. Other 64bit platforms
don't have an equivalent.

This is a unsophisticated implemention of a scheme using msync and
MAP_FIXED to reproduce the functionality of MAP_32BIT.

Adds MAP_FIXED to RemapAtEnd, as the address used for the new mmap
doesn't get located correctly without it on aarch64.

Add MemMap::next_mem_pos_ to store last position. Add a safety assert.

Change-Id: I61871ff7fc327554c43e1d7f448c3d376490f1ea
4fb5df8453367aa3f160ac230c03a7a98a28e562 13-Mar-2014 Hiroshi Yamauchi <yamauchi@google.com> Make MemMap::MapAnonymous() fail if the requested address is not available.

Change MapAnonymous() so that a requested address vs. actual map
address mismatch will cause a failure. The existing MapAnonymous()
call sites do not check this. This should prevent potential rare case
bugs where mmap does not happen to map a region at an specified
address.

There's a potential bug that if MapAnonymous() does not guarantee the
requested address (and there's a gap between the image/oat files and
the zygote/malloc space), then GC could in theory allocate a large
object space in the gap. This would break the GC notion of the immune
space. This change will prevent this by causing all non-moving spaces
to be (really) adjacent, with no gaps in between, which CL 87711
missed.

Change-Id: Id4adb0e30adbad497334d7e00def4c0c66b15719
c7cb1901b776129044a4ad3886fd6450e83df681 05-Mar-2014 Mathieu Chartier <mathieuc@google.com> Print error message if ImageSpace::Init fails.

Also changed some of the args in mem_map.cc to print as hex.

Bug: 13323732

Change-Id: I02cd81300793515d143e94473f48fc701e401b38
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
b60847e72d040bf5e08b787d4b63708f7a506a31 06-Feb-2014 Brian Carlstrom <bdc@google.com> Merge "Fix apps with more than one dex file with the same name"
0d6adac2550113da33d42e88f0d87a57b25c5a60 06-Feb-2014 Brian Carlstrom <bdc@google.com> Fix apps with more than one dex file with the same name

Reverts most of 60836d5a9bcf8b30984aae4279a4f6233b0bf622 which I
believe was an incorrect attempt to address issue introduced in
8d31bbd3d6536de12bc20e3d29cfe03fe848f9da, which is also reverted here.

Also adds some debugging aids include operator<< for DexFile and
MemMap and checksum information to OatFile logging.

Bug: 12802375
Change-Id: Idd6f7dd487f6e01e9479cd15cd4b61580160e8a3
caf22aca3482e2fcc8bf443f911718a5021da1c9 28-Jan-2014 Christopher Ferris <cferris@google.com> Modify to use new BacktraceMap creation function.

Change-Id: I703ef4a26917678236b931d81b7e4c758754742b
3cab422021b121cad7a4592114f1b28f636b599d 24-Jan-2014 Ian Rogers <irogers@google.com> Move __STDC_FORMAT_MACROS to a cflag.

Current inttypes.h don't define stdint printf formatting characters for C++ but
in the future this will change. Rather than #define __STDC_FORMAT_MACROS at the
point of inclusion (conventional) pass it as a cflag so there is a single place
to remove the #define when conventions change.

Change-Id: Ice2fb07e19d8fc06ebc534c903a2d02497c31b3d
debeb3aaaa4257684029f15733dc30af5dcb8aab 24-Jan-2014 Ian Rogers <irogers@google.com> 64bit friendly printf modifiers in mem map errors.

Change-Id: I197c6cf08053b9c833e50156a92965b3b66698eb
943af7dab1454517c5bd11a31ab99f260afb22d1 16-Jan-2014 Christopher Ferris <cferris@google.com> Change to support new BacktraceMap.

Change-Id: I291313583dca2c8e1e946504c442f5810f0fb477
3b6f0fae76fddf81930a263a075dc87b6039b7fc 13-Nov-2013 Mathieu Chartier <mathieuc@google.com> Add more logging when mmap fails.

We now print the reason that the mmap failed.

Change-Id: Ie515e4bba117c9ea1f4297abb826d32172bea962
7b5f0cf08f74ff36760a813888779d28a175982d 01-Nov-2013 Christopher Ferris <cferris@google.com> Use libbacktrace instead of libcorkscrew.

Also, removed the ignore frames of 2, this was causing threads to chop
the lower two frames. The original code assumed that the calls to decode
the frame were in the unwind trace, but that's not the case.

Change-Id: Ifc0da0227f9114a5b462ef88e038439d58f951e9
fd7e7f1253927c8d7f17e7cbc259daaf51868bd3 22-Oct-2013 Hiroshi Yamauchi <yamauchi@google.com> Fix a double unmap issue in MemMap::UnMapAtEnd().

MemMap::UnMapAtEnd() unmaps the unused tail of the alloc space during
a zygote fork. But it can cause the same tail region of the memory to
be unmapped twice (once in UnMapAtEnd() and once more in ~MemMap()
during a shutdown.)

I encountered a crash because of this issue in SpaceTest.ZygoteTest
(which happens to happen only on a device in a branch with the
rosalloc change probably due to some randomness in mmap address
choice, etc.)

Here's what happens:

1) CreateZygoteSpace() will call UnMapAtEnd() and unmap the unused
tail of the alloc space.

2) In the same function, after UnMapAtEnd(), several libc new/malloc
allocations, including a new DlMallocSpace object, happen. This
happens to cause libc to map a new memory region that overlaps with
the memory region that has just been unmapped in 1) and use it to
allocate those allocations (that is, the new DlMallocSpace object is
allocated in that memory region.) This is a second DlMallocSpace that
becomes the new alloc space after zygote fork. The first DlMallocSpace
becomes the zygote space. Note that that libc maps that memory region
before the underlying memory of the second DlMallocSpace is mapped.

3) During a Runtime shutdown (which happens once for a normal VM
shutdown or at the end of each test run) all the spaces get destructed
including the the two DlMallocSpaces one by one. When the first
DlMallocSpace gets destructed (note the space list is sorted by
address,) its super destructor ~MemMap() unmaps the original memory
region that's already partially unmapped in 2). Now this memory region
includes the libc memory region that includes the second DlMallocSpace
object.

4) When the second DlMallocSpace object gets attempted to be
destructed, the memory in which the object resides is already unmapped
in 3) and causes a SIGSEGV.

This change replaces UnMapAtEnd() with a new function RemapAtEnd()
which combines the unmapping of the tail region and remapping of it to
achieve the following two things:

1) Fixes this double unmap issue by updating the base_size_ member
variable to exclude the already-unmapped tail region so that ~MemMap()
will not unmap the tail region again.

2) Improves on the non-atomicity issue in the unmap/map sequence in
CreateZygoteSpace(). That is, once the unused tail portion of the
memory region of the origina alloc space is unmapped, something like
libc could come along and take that memory region, before the memory
region is mapped again for the new alloc space. This, as a result,
would make a hole between the old alloc (new zygote) space and the new
alloc space and cause the two spaces to be
non-contiguous. RemapAtEnd() eliminates new/malloc allocations between
the unmap and the map calls. But note this still isn't perfect as
other threads could in theory take the memory region between the
munmap and the mmap calls.

Added tests.

Change-Id: I43bc3a33a2cbfc7a092890312e34aa5285384589
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
e0948e13d5a4552e6a2728087573c07961e4a4f9 29-Aug-2013 Brian Carlstrom <bdc@google.com> Make DexFiles opened from files readonly by default, but writable during dex2oat

Bug: 9618388
Change-Id: I83f2e16ee8446a79a94a84971146d807bb0c9ee0
9004cb6591781d1e6c5ec6d7bc6dc99d9ecee124 27-Jul-2013 Brian Carlstrom <bdc@google.com> Allow MemMap to support empty map requests

Discovered trying to use ZipEntry::ExtractToMemMap on an empty preloaded-classes.

Bug: 8659045
Change-Id: Icfbbe6b313e2d1ee708b44a8d8d354d6203fd669
7934ac288acfb2552bb0b06ec1f61e5820d924a4 26-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/comments issues

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
2d88862f0752a7a0e65145b088f49dabd49d4284 19-Jul-2013 Brian Carlstrom <bdc@google.com> Fixing cpplint readability/casting issues

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