History log of /art/runtime/runtime.cc
Revision Date Author Comments
12f7423a2bb4bfab76700d84eb6d4338d211983a 14-Jan-2015 Mathieu Chartier <mathieuc@google.com> Print more info in MarkSweep::VerifyRoot

Refactored old root callback to use a new class called RootInfo.
RootInfo contains all the relevant info related to the root
associated with the callback. The MarkSweep::VerifyRoot function
now uses this info to print the StackVisitor's described location
if the GC root is of the type kRootJavaFrame.

Some other cleanup.

Example output:
E/art (12167): Tried to mark 0x123 not contained by any spaces
E/art (12167): Attempting see if it's a bad root
E/art (12167): Found invalid root: 0x123 with type RootJavaFrame
E/art (12167): Location=Visiting method
'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0)
vreg=0

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
56bf0c793d461cc2f9c37ab8fce79a268fd700e0 26-Nov-2014 Dmitriy Ivanov <dimitry@google.com> Disable stack mprotects when running on valgrind

Bug: 18155388
Change-Id: I17d7e3c707e83b864b0394ebbfb2438021faf76f
ab1953f35880f94752e1fcde3f6b3f0d3532125b 17-Nov-2014 Mathieu Chartier <mathieuc@google.com> Don't call AddImageStringsToTable or MoveImageClassesToClassTable if running imageless

If we fail to create the image we use imageless running, this was
breaking AddImageStringsToTable since we didn't check for this
case. Added a check which avoids calling AddImageStringsToTable and
MoveImageClassesToClassTable if we don't have an image.

Bug: 18412472
Change-Id: I1dd8f306d5e41356a6b62fbd95315f564ee0d36e
e05d1d5fd86867afc7513b1c546375dba11eee50 03-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add hash set

More memory efficient than libcxx since we do not box the values.

Change intern table to use new hash set. Clean up intern table by
removing const casts and deleting unnecessary code.

Changed the class linker to use a hash set, also added a pre-zygote
class table.

5 samples of:
adb shell stop && adb shell start && sleep 60 && adb shell dumpsys meminfo
Before:
165929 kB: Native
175859 kB: Native
168434 kB: Native
166559 kB: Native
169958 kB: Native

After:
160972 kB: Native
159439 kB: Native
157204 kB: Native
165093 kB: Native
163039 kB: Native

TODO: Add HashTable which is implemented by using a HashSet.
TODO: Use for DexFile::find_class_def_misses_.
TODO: Investigate using mem maps instead of native heap.

Bug: 17808975

Change-Id: I93e376cf6eb9628cf52f4aefdadb6157acfb799a
b6e292bf7eac9d73c6b79b1e9b7b87beb02436c9 31-Oct-2014 Mathieu Chartier <mathieuc@google.com> Add image strings to intern table

When we create the runtime, we now add the image strings to the
intern table if we are the zygote. This caused some memory bloat,
so I added an extra unordered set to the intern table.

There is now two unordered sets (hash talbe). One for pre-zygote
interns and one for post-zygote interns. This helps since the
pre-zygote hash table doesn't get dirtied. Even with adding
the image strings, we get total memory savings of around 5-7 MB
native PSS after device boot.

FB launch Before:
2.20% art::DexFile::FindStringId(char const*) const
TotalTime: 2069
TotalTime: 1985
TotalTime: 2088
TotalTime: 2003
TotalTime: 2034
TotalTime: 2049
After boot native PSS: 175585 kB: Native

After:
0.27% art::DexFile::FindStringId(char const*) const
TotalTime: 1682
TotalTime: 1756
TotalTime: 1825
TotalTime: 1751
TotalTime: 1666
TotalTime: 1813
After boot native PSS: 167089 kB: Native

Bug: 18054905
Bug: 16828525
Bug: 17808975

Change-Id: Ie367f3222f8c4db409ec49c3845276908b51e9c9
1fb463e42cf1d67595cff66d19c0f99e3046f4c4 24-Oct-2014 Mathieu Chartier <mathieuc@google.com> Optimize method linking

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

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

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

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

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

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

Bug: 18054905
Bug: 16828525

Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
2ff973cc395007ddbcf6b498c8de8880d77dd787 22-Oct-2014 Calin Juravle <calin@google.com> [native bridge] Make sure we always unload the native bridge

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

Bug: 18097480

(cherry picked from commit 07d83c7a25022064ac0a8dac4fe2a7a38681fa4b)

Change-Id: I3a5155a6760399ccfaf9130c72679615a3d4f2e7
3bd08d5de1120b6488c4cdcf8fa17855cf383a1c 20-Oct-2014 Vladimir Marko <vmarko@google.com> Shut down FaultManager after shutting down threads.

Bug: 17703163

(cherry picked from commit 2beeb82523bd3b8015851b69ccd088553ec0c226)

Change-Id: Ic4beae99734ec15b8ead362fbf76a69eceae5980
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
c4b2f1667fd55ca82a06fe5b09aa55320a350698 16-Sep-2014 Dave Allison <dallison@google.com> Don't call dlsym from signal context in signal chain

It is dangerous to call dlsym from within a signal context
since it takes a lock and can lead to a mutex reentry attempt if
timing is bad.

This change adds an initialization function to the signal chain
that calls dlsym for sigaction and sigprocmask from outside the
signal context (from Runtime::Init()). The results are cached
in a static variable and used from within the signal context if
necessary.

However, tests don't necessarily call Runtime::Init() so we also
need to deal with the case where the signal chain is not initialized
and perform a lazy initialization from inside sigaction or sigprocmask.
This is always outside a signal context since we have not initialized
the runtime.

Bug: 17498571, 17896006

(cherry picked from commit cefcea838729287a04174664a76514dd793dd77d)

Change-Id: I9bf8540a1250eadf977ff9af249dbe1c73b5ac63
a4fee49a5023a3cf8431597950ee87c711d0b81c 16-Sep-2014 Dave Allison <dallison@google.com> Don't call dlsym from signal context in signal chain

It is dangerous to call dlsym from within a signal context
since it takes a lock and can lead to a mutex reentry attempt if
timing is bad.

This change adds an initialization function to the signal chain
that calls dlsym for sigaction and sigprocmask from outside the
signal context (from Runtime::Init()). The results are cached
in a static variable and used from within the signal context if
necessary.

However, tests don't necessarily call Runtime::Init() so we also
need to deal with the case where the signal chain is not initialized
and perform a lazy initialization from inside sigaction or sigprocmask.
This is always outside a signal context since we have not initialized
the runtime.

Bug: 17498571, 17896006

(cherry picked from commit cefcea838729287a04174664a76514dd793dd77d)

Change-Id: I9bf8540a1250eadf977ff9af249dbe1c73b5ac63
b6404fe0bb782cbbccda88903901fe0096a741d5 08-Oct-2014 Brian Carlstrom <bdc@google.com> Disable kEnableJavaStackTraceHandler

Bug: 17890306
Change-Id: I76d1d1b709cfcb0cf8fe02f5d28fb746909d682f
95a935415d44903b28326424beb4db5c013ef089 29-Sep-2014 Brian Carlstrom <bdc@google.com> Add VMRuntime.isBootClassPathOnDisk

Bug: 17679443
Change-Id: I127ffdac3bfe731e9535dfe6a242eb950363d715
6d031046eeb5e9f62b657df0695b752e1d0aa583 10-Sep-2014 jgu21 <jinghui.gu@intel.com> ART: Update for split native bridge initialization

(cherry picked from commit a6da74e941d7cee498ac3880018a1d8dc953c6eb)
(cherry picked from commit 7a536531791293441253cffb6e370ba1150eee96)

Bug: 17671501
Change-Id: Id948e3ab22ac988d96f5d370bba8c3f86d08abff
a98ffd745bbecb2e84a492194950c0b94966546b 26-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix broken runtime SetStatsEnabled logic

Previously, Runtime::SetStatsEnabled wouldn't take stats_enabled_
into account when deciding whether or not to increment / decrement
teh stats enabled counter. This resulted in counter underflows and
other errors which caused some CTS tests to fail.

Also added some locking to prevent race conditions.

Bug: 17360878

Change-Id: I779237d55dda4f35054a4d27fb2c660a38750fc0
33c36d4f22ab6a5e61eb47b654deaf647c34e49c 19-Sep-2014 Andreas Gampe <agampe@google.com> ART: Only allow the zygote to create the global boot image

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

Bug: 17478752, 17510489, 17439961
Change-Id: Iba2b74be6d0752f4221f4ff5ee295b45a34cb2e1
63bc11efaac0c041e849ab401f9fc368631a00f5 18-Sep-2014 Ian Rogers <irogers@google.com> DO NOT MERGE. Only have a portable entrypoint in portable builds.

Bug: 16214885

Change-Id: Iff7b7415efdbdabd7e6020e221a540f6a774c852
1d6ee090fddd4bfd35c304d6ceb929d5c529dfcc 16-Sep-2014 Jeff Hao <jeffhao@google.com> Avoid suspending for alloc trace enabling when already suspended.

Bug: 17499772
Change-Id: Id98c10967b28e8859e5ac46f5878c304fb85c498
3256166df40981f1f1997a5f00303712277c963f 12-Sep-2014 Mathieu Chartier <mathieuc@google.com> Add native support for FinalizerList.makeCircularListIfUnenqueued

Called from FinalizerReference.enqueueSentinelReference to prevent
a race where the GC updates pendingNext of the sentinel reference
before enqueueSentinelReference.

Bug: 17462553

Change-Id: I7ad2fd250c2715d1aeb919bd548ef9aab24f30a2
6167864e28e4e12658ebdbaf1d5239acdaf4aaa4 13-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix stale root error in verifier

There was a stale root error caused by the static roots from
the reg types. These were visitied if there was an active verifier
in the method_verifiers_ but this is not always the case when a GC
is run. The fix is to always visit the static method verifier roots.

This only showed up as a bug without an image since these roots
were primitive classes and always in the image, and therefore
didn't ever need to be updated due to moving GC.

Bug: 17262039
Change-Id: I592f2770570de97b431671cfbd409f63697892f1
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
13e3c6dd64ef3ca350356128d3a3e2fdd57513ee 03-Sep-2014 Andreas Gampe <agampe@google.com> ART: Change ART for new native bridge sequence

Initialize or unload after a fork.

(cherry picked from commit 6be67eeedbe60afce42300ae3e7f0e7180a96efa)

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
79cfc0e93e210e548b45459478a154168d2d8cc2 05-Jun-2014 Ian Rogers <irogers@google.com> Pre-allocate the NoClassDefFoundError to be thrown for boot classes.

Bring over a Dalvik "optimization".
Bug: 12804658
Bug: 16853450
Change-Id: I6419de7bd2ba18d91479cb52489104954f5c4524

(cherry picked from commit 63557459a4098294a9ff44d035241de2966047c0)
70c71ab1c2e44a74fc4eb76d6a0530f773850196 30-Aug-2014 Mathieu Chartier <mathieuc@google.com> Change intern table to unordered set.

Intern table active used bytes goes from 430k to 317k on system
server. Similar %wise savings on other apps.

Bug: 16238192

Change-Id: I92de72de3eae0b76629e9da83db2c2d0fa613052
d910fcef539e12ab181e56ec80684f39c4e95733 30-Aug-2014 Mathieu Chartier <mathieuc@google.com> Change intern table to unordered set.

Intern table active used bytes goes from 430k to 317k on system
server. Similar %wise savings on other apps.

Bug: 16238192

Change-Id: I92de72de3eae0b76629e9da83db2c2d0fa613052
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
507e6180ad271eb719c67ce7394852c731d975a5 19-Aug-2014 Alex Light <allight@google.com> Support running without a boot image.

Bug: 17000769

(cherry picked from commit 64ad14dbe2225441fb7734bf6d89358d96692eea)

Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
4c5a469683e433f126c9863cd393747d2e7c4a29 22-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add fallback for non moving space being full.

When the non moving space becomes full, we disable moving GC and
make the main space the new non moving space.

Also added a runtime option for changing the non moving space size:
-XX:NonMovingSpaceCapacity.

Bug: 17189964
Change-Id: I04d00d0f457f6c1f5724bf32932b6b6ce4d341b1
ccdd4a5be1db2588767ed230b7064e5fe802ce8d 22-Aug-2014 Calin Juravle <calin@google.com> Always setup the native bridge library

... even if the string is empty. This will initialize the native bridge
library but mark it as unavailable.

- also, rename native_bridge_library_path to
native_bridge_library_filename to be closer to the actual meaning (it's
just the filename without any path).

Bug: 16404669.
Change-Id: I94628639691459d48d1fbf0841f36b68d51818e7
e8b9afcd0cd86b8808af29a97332038aab70c604 21-Aug-2014 Dave Allison <dallison@google.com> Fix fault handler to unregister on shutdown

This fixes a problem with the fault handler where it wasn't
unregistering itself during shutdown of the runtime.

Bug: 17133266
Change-Id: If4758b14ded0fba194897191b1a8d8d7b0b3e6e5
21ecab6effd08ed781d55fbb53b0e71c526c25fa 19-Aug-2014 Brian Carlstrom <bdc@google.com> AttachCurrentThread should only warn on missing thread name if CheckJNI is enabled.

Bug: 17108693

(cherry picked from commit 3ea69c0abce1b81b3c45033867d49b00e6d6b709)

Change-Id: Ide8158cc3e12e604f4fa344cd881fe6f68476ab7
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
93de4273d72a2558a7b3423547b5074cd76c5796 12-Aug-2014 Calin Juravle <calin@google.com> [ART] Move to system/core native bridge library

Some cleanups on the way:
- move NativeBridgeRuntimeCallbacks from a global to a field
- rename native_bridge_library_string to the more suggestive
navtive_bridge_library_path
- clean up imports

Bug: 16884833

(cherry picked from commit I73aab8e212860ba5aee9444d801806d3da326a41)

Change-Id: I67f037ea81d2a4ede4294afd8b84b7640e534a13
b0f05b9654eb005bc8c8e15f615a7f5a312f640c 17-Jul-2014 Dave Allison <dallison@google.com> Add implicit checks for x86_64 architecture.

This combines the x86 and x86_64 fault handlers into one. It also
merges in the change to the entrypoints for X86_64.

Replaces generic instruction length calculator with one that only
works with the specific instructions we use.

Bug: 16256184

Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
20ae1d77463d1c3f206eac8d541124b4555464de 17-Jul-2014 Ian Rogers <irogers@google.com> Clean up native bridge

(partially cherry picked from commit
68d8b42ddec39ec0174162d90d4abaa004d1983e)

Change-Id: I85813e97d73b1b331646dd0e880108dfbfe80f69
7204c04dd86ae8ce05690e38737b2abf017a0a69 11-Jun-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Implicit StackOverflow/NPE/Suspend checks.

This implements implicit stack overflow checks and null pointer exceptions
for AArch64. Suspend checks are implemented but not switched on yet.

Bug: 16256184
Change-Id: I2eb076f2c0c9d94793d5a898fea49cf409b4eb66
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
c7c6d18a90079b67a7592d3f2cb3d4c6f0081512 29-Jul-2014 Jeff Hao <jeffhao@google.com> Stop thread from reattaching during runtime shutdown while tracing.

Bug: 16024763

(cherry picked from commit c5d824a20c225763761a6dff43294b229ff35469)

Change-Id: Ideab9adedabf3c58f5162e43e79c72af0642bdfa
82558acbca3eae5b7e47748bcfb8070855266676 30-Jul-2014 Jeff Hao <jeffhao@google.com> Submitted wrong changelist!

Revert "Stop thread from reattaching during runtime shutdown while tracing."

This reverts commit c96657c4243e04888d5948fa023d78cc9213800b.

Change-Id: I859347f93704a94d23f72ef7d483298b08bbed0d
c96657c4243e04888d5948fa023d78cc9213800b 29-Jul-2014 Jeff Hao <jeffhao@google.com> Stop thread from reattaching during runtime shutdown while tracing.

Bug: 16024763

(cherry picked from commit c5d824a20c225763761a6dff43294b229ff35469)

Change-Id: Id5dcd4c8a131b93de00023c3ae9f518ea182614a
c5d824a20c225763761a6dff43294b229ff35469 29-Jul-2014 Jeff Hao <jeffhao@google.com> Stop thread from reattaching during runtime shutdown while tracing.

Bug: 16024763
Change-Id: Iad5ba180241ff74b15baf5c3a15ed2d2ed60fcf0
94f7b49578b6aaa80de8ffed230648d601393905 23-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add GcRoot to clean up and enforce read barriers.

Introduce a value-type wrapper around Object* for GC roots so that 1)
we won't have to directly add the read barrier code in many places and
2) we can avoid accidentally bypassing/missing read barriers on GC
roots (the GcRoot interface ensures that the read barrier is executed
on a read).

The jdwp test passed.

Bug: 12687968
Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
855564b83db7b106d2995d0e784f1f4b62e52371 25-Jul-2014 Andreas Gampe <agampe@google.com> ART: Native bridge command-line parameter

Add a command-line parameter for the native bridge library, slight
refactor/cleanup.

Add run-test 115 to test the native bridge interface. Currently the
tests are black-listed for the target, as the setup for the test
is too complicated in the current infrastructure.

Change-Id: I6ccf19485e8c30b96e9f2fd5425278cb1ebd403f
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
147eb41b53729ec8d5c188d1cac90964a51afb8a 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73

Conflicts:
compiler/dex/quick/arm64/target_arm64.cc
compiler/image_test.cc
runtime/fault_handler.cc
535a3fbc08e1577f43aec7402cab80c14ca64c41 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Interpreter can kick in even when implicit checks are enabled.

Add a GetStackEndForInterpreter for its stack overfow check.

Change-Id: I2d4fc229a8eb727fda509ff778e16d60d96ecc28
d85614222fa062ec809af9d65f04ab6b7dc1c248 11-Jul-2014 Fred Shih <ffred@google.com> Revert "Revert "Revert "Revert "Add intrinsic for Reference.get()""""

Fixed TargetReg issue causing build failure for x86.
This reverts commit 9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f.

(cherry picked from commit 4ee7a665e7f9cd2c5ace2d6304e33f64067b209f)

Change-Id: I555f4e06955711262e6b37ffbeabee9698ec695c
69dfe51b684dd9d510dbcb63295fe180f998efde 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73
4ee7a665e7f9cd2c5ace2d6304e33f64067b209f 11-Jul-2014 Fred Shih <ffred@google.com> Revert "Revert "Revert "Revert "Add intrinsic for Reference.get()""""

Fixed TargetReg issue causing build failure for x86.
This reverts commit 9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f.

Change-Id: I7e6a526954467aaf68deeed999880dfe9aa5f06e
e63db27db913f1a88e2095a1ee8239b2bb9124e8 16-Jul-2014 Ian Rogers <irogers@google.com> Break apart header files.

Create libart-gtest for common runtime and compiler gtest routines.
Rename CompilerCallbacksImpl that is quick compiler specific.
Rename trace clock source constants to not use the overloaded profiler term.

Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
ab088118d33caafb00815ab72ac0fd7374169f64 14-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the roots in Runtime.

Bug: 12687968
Change-Id: If26518a8251702cfe4d5cd7d1f50e80e342704cf
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
f37a88b8e6db6c587fa449a12e40cb46be1689fc 10-Jul-2014 Zuo Wang <zuo.wang@intel.com> ART: Compacting ROS/DlMalloc spaces with semispace copy GC

Current semispace copy GC is mainly associated with bump pointer
spaces. Though it squeezes fragmentation most aggressively, an extra
copy is required to re-establish the data in the ROS/DlMalloc space to allow
CMS GCs to happen afterwards. As semispace copy GC is still stop-the-world,
this not only introduces unnecessary overheads but also longer response time.
Response time indicates the time duration between the start of transition
request and the start of transition animation, which may impact the user
experience.

Using semispace copy GC to compact the data in a ROS space to another ROS(or
DlMalloc space to another DlMalloc) space solves this problem. Although it
squeezes less fragmentation, CMS GCs can run immediately after the compaction.

We apply this algorithm in two cases:
1) Right before throwing an OOM if -XX:EnableHSpaceCompactForOOM is passed in
as true.
2) When app is switched to background if the -XX:BackgroundGC option has value
HSpaceCompact.

For case 1), OOMs are significantly delayed in the harmony GC stress test,
with compaction ratio up to 0.87. For case 2), compaction ratio around 0.5 is
observed in both built-in SMS and browser. Similar results have been obtained
on other apps as well.

Change-Id: Iad9eabc6d046659fda3535ae20f21bc31f89ded3
Signed-off-by: Wang, Zuo <zuo.wang@intel.com>
Signed-off-by: Chang, Yang <yang.chang@intel.com>
Signed-off-by: Lei Li <lei.l.li@intel.com>
Signed-off-by: Lin Zang <lin.zang@intel.com>
a9b870b73a155ce70c867d5b3f9758fab0b45f07 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Add intrinsic for Reference.get()"

This reverts commit 460503b13bc894828a2d2d47d09e5534b3e91aa1.

Change-Id: Ie63f43049307e02e3b90f4e034abc9ea54ca4e24
7fb36ded9cd5b1d254b63b3091f35c1e6471b90e 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Add implicit null and stack checks for x86""

Fixes x86_64 cross compile issue. Removes command line options
and property to set implicit checks - this is hard coded now.

This reverts commit 3d14eb620716e92c21c4d2c2d11a95be53319791.

Change-Id: I5404473b5aaf1a9c68b7181f5952cb174d93a90d
d4415e8bd04c4a9367744ff0149597b4f37a0e0a 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Revert "Add intrinsic for Reference.get()""

This reverts commit a9b870b73a155ce70c867d5b3f9758fab0b45f07.

Change-Id: Ic2a9b47f2b911bef4b764d10bc33cf000e4b4211
9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f 11-Jul-2014 Sebastien Hertz <shertz@google.com> Revert "Revert "Revert "Add intrinsic for Reference.get()"""

This reverts commit d4415e8bd04c4a9367744ff0149597b4f37a0e0a.

Change-Id: I34553ccbdcfea35c7742d21be2a74dc7085ab2a0
0025a86411145eb7cd4971f9234fc21c7b4aced1 11-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Revert "Add implicit null and stack checks for x86"""

Broke the build.

This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e.

Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
460503b13bc894828a2d2d47d09e5534b3e91aa1 18-Jun-2014 Fred Shih <ffred@google.com> Add intrinsic for Reference.get()

Added an intrinsic function for Reference.get(). Return immediately
without going through JNI if the slow path is not currently in use.
Otherwise, branch off to the the existing JNI function.

Approximately 47x speedup for cases where slow path is not enabled.

Change-Id: I13ad65a356fe4e104d8d83980694dc2740d7d039
34e826ccc80dc1cf7c4c045de6b7f8360d504ccf 29-May-2014 Dave Allison <dallison@google.com> Add implicit null and stack checks for x86

This adds compiler and runtime changes for x86
implicit checks. 32 bit only.

Both host and target are supported.
By default, on the host, the implicit checks are null pointer and
stack overflow. Suspend is implemented but not switched on.

Change-Id: I88a609e98d6bf32f283eaa4e6ec8bbf8dc1df78a
3d14eb620716e92c21c4d2c2d11a95be53319791 10-Jul-2014 Dave Allison <dallison@google.com> Revert "Add implicit null and stack checks for x86"

It breaks cross compilation with x86_64.

This reverts commit 34e826ccc80dc1cf7c4c045de6b7f8360d504ccf.

Change-Id: I34ba07821fc0a022fda33a7ae21850957bbec5e7
bae182cbc6adc8796154162a87fc54ae804e0469 17-Dec-2013 Sebastien Hertz <shertz@google.com> Fix method tracing from command-line

Transitions current thread to the new kWaitingForMethodTracingStart thread
state when starting method tracing.

Ensures there is a current thread when method tracing is stopped due to runtime
shutdown. If the current thread has been detached, we now re-attach it.
Note: we only do this if method tracing has been activated from command-line.

Fixes instrumentation when forcing interpreter mode (-Xint) with method tracing
enabled.

Removes unused parameter from UnsafeLogFatalForThreadSuspendAllTimeout.

Bug: https://code.google.com/p/android/issues/detail?id=72094
Bug: 11683397
Change-Id: I70f000fb46ddd95d6ad51ea0a8eee77697a045e9
0ec17d2ddb69d3f5c46ccad62e82c0ffd6219428 07-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Remove Dbg::VisitRoots().

We replace the GC strong roots with JNI.

jdwp_test passes.

Bug: 12687968
Change-Id: I841f1aaa5dffa784ca25953a251600f70df273b2
4e14e721055eeeb42b06ad231bce930f3e1c1728 28-Jun-2014 Ian Rogers <irogers@google.com> Avoid segvs if LOG(FATAL) is called during runtime start-up.

Change-Id: I8b054d0ff2084411ab49ebba83799eb79da879f6
a93b0bb9abfbd19fc40ff8ced8818aec1a3464b9 10-Jun-2014 Wei Jin <wejin@google.com> Add an option to enable collecting dex pc in ART profiler

This CL allows the ART profiler to collect both method signature and
dex pc. The type of the profile data is controlled by the option
"-Xprofile-type:{method,dexpc}". To avoid conflicting with the
original profile data based on method signatures, the new profile
data are stored in files with extension ".pc".

Change-Id: I8afb2541d386bff77c5b07fc9367d817a79f58e1
4eb1331f912d6c3614bd65845fa046fc8d3300d8 13-Jun-2014 Dave Allison <dallison@google.com> Don't use signal handlers in interpreter only mode

Bug: 15543631

Change-Id: I8f251b5a66487dce3ac3127bdf3b5bc824d0e4bc
b5a9e3d1cc1fd66683e43e365afc8c900e2800c4 09-Jun-2014 Hiroshi Yamauchi <yamauchi@google.com> Remove Object* weak roots from the debugger.

The weak roots were converted to JNI weak refs.

Since the weak roots are now normal JNI weak refs, we eliminate the
need to insert read barriers for those weak roots in the debugger and
the need for the GC to have a separate step to update them as part of
the system weak sweeping.

Bug: 12687968
Change-Id: If16396d4713457b8af4f1ea6a0c6ec6799cb615e
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
576ca0cd692c0b6ae70e776de91015b8ff000a08 07-Jun-2014 Ian Rogers <irogers@google.com> Reduce header files including header files.

Main focus is getting heap.h out of runtime.h.

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

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

Bug: 12877748
Bug: 15275634
Change-Id: I37ff68e7694370950ce8db2360562e9058ecebb7
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
f00571c4e1ae202b3b4acb6b47cbe23a65178f7f 30-May-2014 Jeff Hao <jeffhao@google.com> Added workaround passing empty arg array for proxy invocation.

This recreates old Dalvik behavior for older target sdk versions,
but will still pass null for newer ones.

Bug: 13247236

(cherry picked from commit 01d5a146e20660bd06f026c16f19ec080f8fdd7b)

Change-Id: I911889cf559ad8d9f37ea9be3929387c86446851
01d5a146e20660bd06f026c16f19ec080f8fdd7b 30-May-2014 Jeff Hao <jeffhao@google.com> Added workaround passing empty arg array for proxy invocation.

This recreates old Dalvik behavior for older target sdk versions,
but will still pass null for newer ones.

Bug: 13247236

Change-Id: I663c44f729dd173b47da692a753b986daa0463e9
f4b80bcc7190fe75023b983d56a795b440a0c515 15-May-2014 Dave Allison <dallison@google.com> Make use of sigchainlib for signal chaining for implicit checks

This adds a preload library that overrides sigaction and sigprocmask
to implement signal chaining. Signal chaining allows us to chain
any signal so that the ART runtime receives it before any signal
handler registered in native code by an application. If the
ART signal handler doesn't want it, it will pass it on to the
user's handler.

ART uses signals for null pointer checks, stack overflow checks and
suspend points.

Also adds an OAT test to test this in isolation.

Change-Id: I9545f9f7343774c091410eb810504d9855fd399f
12e6d7446384a7a5fbec25fe116bbb271c62842e 22-May-2014 Tsu Chiang Chuang <tsu@google.com> Add option to specify compiler executable.

Change-Id: I973da5e74be5a62461caacbc708288fb95e1b99b
6a58691356979164249c63cb3f98f5dbd75cc4bb 22-May-2014 Wei Jin <wejin@google.com> Fix the problem of not shutting down the profiler in ART properly

This CL fixes the problem of not saving the last batch of profile data to the
external file when the runtime exits before the end of the current iteration of
profile sampling. This problem was fixed by shutting down the ART profiler
when the runtime exits and allowing the profiler to write the last batch of
data even it was signaled to shut down. This CL increases the precision of
profile data and fixes the bug that no data is saved if the duration of profile
sampling specified by VM arguments (by default 20 seconds) is longer than the
length of a single execution because the profiler was never signaled when the
runtime exits.

Change-Id: I7cc4805b7e2a22a990d04a5b9724ad1d931d7152
Signed-off-by: Wei Jin <wejin@google.com>
bd0fb61e24270b1f382ecbef4c1260c703550e84 20-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Simplify Class::IsArtFieldClass().

Fix the slight glitch that when ImageSpace::VerifyImageAllocations()
called in ImageSpace::Create(), the ArtField and ArtMethod class roots
weren't set, which were used by DCHECKs in Object::Size(), which
VerifyImageAllocations() calls, by delaying the point of the
VerifyImageAllocations() call to Runtime::Init() at which point the
class linker has set the class roots.

To completely disable read barriers from Object::SizeOf(), the
ReadBarrierOption template parameter should have been added to
Class::GetInstanceField(), which calls GetFieldObject(), when it's
called from Class::IsArtFieldClass(). This change fixes this by
removing the need for the call, instead of adding the
ReadBarrierOption parameter.

Bug: 12687968
Change-Id: Ibbecc08f4e3b898851805d690dff8ccac55e94f2
35aef2ce9d9cbfb37e9b2f6776afce3caed37063 19-May-2014 Yevgeny Rouban <yevgeny.y.rouban@intel.com> Fix race condition between GCDaemon and DeleteLocalReference

There is a race condition between the GCDaemon visiting
thread local roots starting from the thread's indirect ref table (IRT)
and another thread calling JNI::DeleteLocalReference, which is clearing
one of the indirect references.

To cope with the race condition the DeleteLocalReference used to transit
from suspended to running state by creating a ScopedObjectReference(env).
But this transition was removed with the following patch:
https://android.googlesource.com/platform/art/+/ef28b14268ed0f9db0c7bbd571aa514354a360bd%5E!/#F0

If so the GCDaemon must be careful to work with IRT entries.

This new patch:
1. calls the visitor only if the reference is not null. This if-null
behavior of ART GC is consistent with what Dalvik GC does.
2. But this might be not enough for some future sophisticated GC algorithms.
For example, if GC moves an object, then the IRT entry must be changed
with CAS only if it has not been cleared. So, for the safety reasons
the patch put backs the ScopedObjectReference soa(env) to
DeleteLocalReference.

Only one of those two changes would be enough.

mathieuc note: I decided to delete the root null check but kept the
ScopedObjectAccess in DeleteLocalRef and added missing annotations as
well as more ScopedObjectAccess in jni internals.

Bug: 14626564

Change-Id: I90d4b8494f61404579ecdd2918d1482093d99387
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
Signed-off-by: Yang Chang <yang.chang@intel.com>
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
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
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
b9beb2e2efb6a204a69ca660d478b45f851e8f09 10-May-2014 Ian Rogers <irogers@google.com> Place ISA into boot image name.

Depends upon:
https://android-review.googlesource.com/94078

Change-Id: I22c18b03b2c0db7a3f792920064e7710363b58b4
37eecbde9ab8432c2d047a1524d0ea14f88b94bb 11-May-2014 Ian Rogers <irogers@google.com> Dump the native stack of an unattached aborting thread.

Useful when diagnosing errors in threads that have yet to become attached.

Change-Id: Id50b96d12f8c2e8a29e0606d15009287a554aa64
ca1da7aac327bc336f66b05c183d32ff48b4508f 09-May-2014 Dave Allison <dallison@google.com> Revert "Switch on implicit null pointer and stack overflow checks."

This seems to break facebook

This reverts commit 052664322767de1799f060c306e729b0e73ce893.

Change-Id: I6c8dabdc2519c0925ffde41975878f821e3933de
ad9697a91d5acdc772ae6c0461540bfec358a070 09-May-2014 Dave Allison <dallison@google.com> Revert "Switch on implicit null pointer and stack overflow checks."

This seems to break facebook

This reverts commit 052664322767de1799f060c306e729b0e73ce893.

Change-Id: I6c8dabdc2519c0925ffde41975878f821e3933de
119c6bd97f7ac24b64eaf4e9333abb44acbf780f 09-May-2014 Mathieu Chartier <mathieuc@google.com> Fix stub_test to pass with SS collector.

Changed the test to access the allocation entrypoints from the thread.

Change the order roots are visited to prevent a rare error where the
java lang reflect art method would move before it was checked in
SanityCheckFrame.

Change-Id: Ifb96220f3fbb74ea5d720777f130450f04c0e044
4d466a8e4587422c989705dce3b2a19e7f0137f5 09-May-2014 Brian Carlstrom <bdc@google.com> Remove all LOG(DEBUG) which is not intended to be checked in

Bug: 14632493
Change-Id: Id9da8b87798af0a1b2bd2c178133e5f1ba47d43d
78f7b4c04ab6e8b5581921bc95b67a9beee1c246 06-May-2014 Mathieu Chartier <mathieuc@google.com> Add concurrent reference processing.

Concurrent reference processing currently works by going into native
code from java.lang.ref.Reference.get(). From there, we have a fast
path if the references aren't being processed which returns the
referent without needing to access any locks. In the slow path we
block until reference processing is complete. It may be possible to
improve the slow path if the referent is blackened.

TODO: Investigate doing the fast path in java code by using racy reads
of a static volatile boolean. This will work as long as there are no
suspend points inbetween the boolean read and referent read.

Bug: 14381653

Change-Id: I1546b55be4691fe4ff4aa6d857b234cce7187d87
052664322767de1799f060c306e729b0e73ce893 05-May-2014 Dave Allison <dallison@google.com> Switch on implicit null pointer and stack overflow checks.

This switches on the use of implicit checks for null pointers
and stack overflows. These use the SIGSEGV handler in the ART
runtime to detect these conditions and throw the appropriate
exceptions.

Change-Id: I4d27d4e976a58b18fb16a89572b1fb3798608449
89a201e599da95d88590c7b4d069b76735e20fa8 02-May-2014 Mathieu Chartier <mathieuc@google.com> Add GC cause to WaitForGcToComplete message.

Change-Id: I8fe107d90a84de065c407b8d29fd106267ac440d
8194963098247be6bca9cc4a54dbfa65c73e8ccc 02-May-2014 Vladimir Marko <vmarko@google.com> Replace CountOneBits and __builtin_popcount with POPCOUNT.

Clean up utils.h, make some functions constexpr.

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

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

(cherry picked from commit 2974bc3d8a5d161d449dd66826d668d87bdc3cbe)

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

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

Change-Id: I9bff2e2ca534e0b93842a50d5b272ddf6d5745f3
6f365cc033654a5a3b45eaa1379d4b5f156b0cee 23-Apr-2014 Mathieu Chartier <mathieuc@google.com> Enable concurrent sweeping for non-concurrent GC.

Refactored the GarbageCollector to let all of the phases be run by
the collector's RunPhases virtual method. This lets the GC decide
which phases should be concurrent and reduces how much baked in GC
logic resides in GarbageCollector.

Enabled concurrent sweeping in the semi space and non concurrent
mark sweep GCs. Changed the semi-space collector to have a swap semi
spaces boolean which can be changed with a setter.

Fixed tests to pass with GSS collector, there was an error related to
the large object space limit.

Before (EvaluateAndApplyChanges):
GSS paused GC time 7.81s/7.81s, score: 3920

After (EvaluateAndApplyChanges):
GSS paused GC time 6.94s/7.71s, score: 3900

Benchmark score doesn't go up since the GC happens in the allocating
thread. There is a slight reduction in pause times experienced by
other threads (0.8s total).

Added options for pre sweeping GC heap verification and pre sweeping
rosalloc verification.

Bug: 14226004
Bug: 14250892
Bug: 14386356

Change-Id: Ib557d0590c1ed82a639d0f0281ba67cf8cae938c
9bc54406ba3377980cfce44901dc2be246178ba9 18-Apr-2014 Ian Rogers <irogers@google.com> Interpreter-only mode should cause dex-to-dex compilation.

Also, fix quick iget/iput that had similar issues to:
https://android-review.googlesource.com/91423
Also, remove fall-back resolution code from quick invokes/igets/iputs as we
allow class loading for the exception throw and regular verification already
allows class loading.
Bug: 14133618

Change-Id: I51199e6e2392da0354f64b157e79af494c183778
2f8da3e9ff60e5cb2a3fdf57dbcb67f513b9c2c2 16-Apr-2014 Mathieu Chartier <mathieuc@google.com> Decrease target utilization for foreground apps.

GC time in FormulaEvaluationActions.EvaluateAndApplyChanges goes from
26.1s to 23.2s. Benchmark score goes down ~50 in
FormulaEvaluationActions.EvaluateAndApplyChanges, and up ~50 in
GenericCalcActions.MemAllocTest.

Bug: 8788501
Change-Id: I412af1205f8b67e70a12237c990231ea62167bc0
c7a966dbba6902618ff0959d604c05d7570df8c8 11-Apr-2014 Mathieu Chartier <mathieuc@google.com> Prevent deadlocks in Runtime::Abort.

If we have the threads suspended, attempting to use a
ScopedObjectAccess causes a deadlock. We now specifically avoid this
to prevent deadlocks.

Bug: 13747880
Change-Id: I45fd3fff917da98b22970e5351a9e25b143a4eed
1659006728b929aa820d09bdaba58b462cc8e7cc 07-Apr-2014 Calin Juravle <calin@google.com> Profile: made startImmediately settable

By default the profiler starts immediately upon app startup. To delay the
startup by some random offset use -Xprofile-start_lazy.

Bug: 12877748
Change-Id: Ifc1bb7f79f9f9aa53204b2fb1fbae3cd5c780cac
242947dbcdc4038ddd8ac522bb480f82e7d92ffa 03-Apr-2014 Andreas Gampe <agampe@google.com> Make frame size dependent on arch-specific constants.

Necessary for proper cross-compiling.

Change-Id: I852901ee6ca5121e480b83a8e318bdc9c7d615e8
4a200f56b7075309316b04d550c9cc50f8314edd 01-Apr-2014 Jeff Hao <jeffhao@google.com> Add support for -Xverify:none mode.

This mode skips all verification and compilation.
Public bug: https://code.google.com/p/android/issues/detail?id=67664

Change-Id: Idd00ab8e9e46d129c02988b063c41a507e07bf5b
8afeb85d3def12b559b7565fb6d3956f81b55132 02-Apr-2014 Ian Rogers <irogers@google.com> Pass instruction-set from runtime through to spawned dex2oat.

Change-Id: I1727af7beb9f710c29124d4d6bc9175e4856f3cc
3de95a7b0a2d30cde6dc92b72c35df3a61002124 02-Apr-2014 Narayan Kamath <narayan@google.com> Runtime::PreZygoteFork returns void, not boolean.

This method aborts on failure (as it should) and unconditionally
returns true, so making it return void simplifies callers.

Change-Id: Iae39bd327f20311579ece47efa8afd1be7defce9
ee1d79a603c77c0667b27c075a983579d5c51f7e 21-Feb-2014 Sebastien Hertz <shertz@google.com> Cleanup transaction support

Updates Thread::CreateInternalStackTrace to support both transactional and
non-transactional modes using template.

Generalizes non-transactional mode for invariant fields (which are set only
once).

Removes ArrayLog::VisitRoots as we never create Array logs of ObjectArray. As
ObjectArray elements are set using Object::SetFieldObject, they are already
recorded in the object logs: the object is the array itself and the offset
corresponds to the element index in this array. And also checks we never log
ObjectArray in array logs.

Fixes location of thrown exception when calling native method during class
initialization.

Change-Id: Idbc368d3b8292b85ff40bc8a7c559e085477bf89
da44d773dedf8aae6153e3423012f236cba3bfcd 02-Apr-2014 Mathieu Chartier <mathieuc@google.com> Fix running with DlMalloc instead of RosAlloc.

Bug: 13748830
Bug: 13744490

Change-Id: Ieec97cf58ebf9864a40ee85aae582cdcf3f27c0c
c751fdcc9491c1b60c3db517fbc41bb98e92441f 31-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add handler for printing java stack traces for compiled code SIGSEGV.

Added a new FaultHandler which attempts to print a java stack trace
when a SIGSEGV occurse in generated code. This should help debugging
compiler and GC related heap corruption.

Bug: 13725693
Bug: 12934910

Change-Id: Id54d83ea180c222eb86d449c61926e83f0b026ad
8b2c8b9642d5fe037f93ab0cb6a5065e2a192e40 31-Mar-2014 Narayan Kamath <narayan@google.com> Move most zygote related code to frameworks/base.

Avoids code duplication across art/dalvik. Also, most of
this code is not directly related to the runtime (mounting external
storage, multi user etc.) and therefore belongs in the frameworks.

Change-Id: Icf4723dd0ec4521ef6b1f785c99d50aebca7779a
dd7624d2b9e599d57762d12031b10b89defc9807 15-Mar-2014 Ian Rogers <irogers@google.com> Allow mixing of thread offsets between 32 and 64bit architectures.

Begin a more full implementation x86-64 REX prefixes.
Doesn't implement 64bit thread offset support for the JNI compiler.

Change-Id: If9af2f08a1833c21ddb4b4077f9b03add1a05147
3b05e9ba874449dbff65b01b8781001f7d93eea6 25-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add missing debugger root visiting.

Bug: 13634574
Change-Id: I2a76f6c43f1d0ad1922f06deb40a71ff651129fd
6ed19fd1b08abbc438781ae3e6fea111c1f92315 20-Mar-2014 Ian Rogers <irogers@google.com> 64bit: make runtime offsets more deterministic.

STL implementations vary causing offsets not to be consistent. Place member
variables we care about the offsets of at the start of Runtime.

Change-Id: I3ad7fe606cb99bcdd884a8fdbdd06bd7e047cd84
b95a5345ae4217b70ca36f0cced92f68dda7caf5 12-Mar-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Add arm64 runtime support.

Adds support for arm64 to ART. Assembler stubs are sufficient for
down calls into interpreter. JNI compiler and generics are not finished.

Basic Generic JNI functionality.

Change-Id: I4a07c79d1e037b9f5746673480e32cf456867b82
53b8b09fc80329539585dcf43657bc5f4ecefdff 14-Mar-2014 Ian Rogers <irogers@google.com> Refactor reflective method invocation.

Move invocation code out of JNI internal into reflection, including ArgArray
code. Make reflective invocation use the ArgArray to build arguments rather
than allocating a jvalue[] and unboxing arguments into that.
Move reflection part of jni_internal_test into reflection_test.
Make greater use of fast JNI.

Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
b373e091eac39b1a79c11f2dcbd610af01e9e8a9 21-Feb-2014 Dave Allison <dallison@google.com> Implicit null/suspend checks (oat version bump)

This adds the ability to use SEGV signals
to throw NullPointerException exceptions from Java code rather
than having the compiler generate explicit comparisons and
branches. It does this by using sigaction to trap SIGSEGV and when triggered
makes sure it's in compiled code and if so, sets the return
address to the entry point to throw the exception.

It also uses this signal mechanism to determine whether to check
for thread suspension. Instead of the compiler generating calls
to a function to check for threads being suspended, the compiler
will now load indirect via an address in the TLS area. To trigger
a suspend, the contents of this address are changed from something
valid to 0. A SIGSEGV will occur and the handler will check
for a valid instruction pattern before invoking the thread
suspension check code.

If a user program taps SIGSEGV it will prevent our signal handler
working. This will cause a failure in the runtime.

There are two signal handlers at present. You can control them
individually using the flags -implicit-checks: on the runtime
command line. This takes a string parameter, a comma
separated set of strings. Each can be one of:

none switch off
null null pointer checks
suspend suspend checks
all all checks

So to switch only suspend checks on, pass:
-implicit-checks:suspend

There is also -explicit-checks to provide the reverse once
we change the default.

For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar

The default is -implicit-checks:none

There is also a property 'dalvik.vm.implicit_checks' whose value is the same
string as the command option. The default is 'none'. For example to switch on
null checks using the option:

setprop dalvik.vm.implicit_checks null

It only works for ARM right now.

Bumps OAT version number due to change to Thread offsets.

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

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

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

This also modifies the profiler itself to:

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

Bug: 12877748
Change-Id: Iab2f3a327a2860db2a80d5724277d6c626227f2b

Conflicts:
compiler/dex/frontend.cc
compiler/dex/mir_analysis.cc
compiler/dex/verification_results.cc
compiler/driver/compiler_driver.cc
dex2oat/dex2oat.cc
runtime/class_linker.cc
runtime/runtime.cc
runtime/runtime.h
719d1a33f6569864f529e5a3fff59e7bca97aad0 06-Mar-2014 Ian Rogers <irogers@google.com> Enable annotalysis on clang ART builds.

Fix clang build errors aswell as restructure locking/mutex code for correct
thread safety analysis support.
Reorder make dependencies so that host builds build first as they should
provide better compilation errors than target.
Remove host's use of -fno-omit-frame-pointer as it has no value with correct
use of CFI, which we should have.

Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
2ec6520d57479d393bffa05defa1479b25ca8382 04-Mar-2014 Brian Carlstrom <bdc@google.com> Support compiler filters for boot classpath

image_writer.cc
Remove assumption that all methods in the boot classpath are compiled

oat_writer.cc
Don't skip writing ArtMethod::quick_code_offset_ for methods that need resolution, leave that to ImageWriter

dex2oat.cc
Allow dex2dex compilation of image dex files by making the in memory pages writable in all cases, not just app case.

oatdump.cc
dump new OatHeader fields
use ImageSpace.GetImageFilename, not command line image filename, since location may be in dalvik-cache
remove inaccurate check about non-null GC map

quick_trampoline_entrypoints.cc
add and improve some DCHECKS that were useful while debugging

class_linker.cc
image_space.cc
fix double facepalm

parsed_options.cc
fix zygote logging to not skip values to two part options like -classpath <foo>

runtime.cc
wireup parsed compiler options to runtime

Change-Id: Iad314df0b80623c0663d61713d5098297ab9ac87
893263b7d5bc2ca43a91ecb8071867f5134fc60a 04-Mar-2014 Mathieu Chartier <mathieuc@google.com> Avoid marking old class linker and intern table roots during pause.

The new root visiting logic has a concept of a root log which holds
new roots which were added since the start of the GC. This is an
optimization since it lets us only mark these newly added roots
during the pause (or pre-cleaning) since the other roots intern table
and class linker roots were marked concurrently at the start of the
GC.

Before (EvaluateAndApplyChanges):
MarkConcurrentRoots: Sum: 605.193ms
After:
MarkConcurrentRoots: Sum: 271.858ms

This should also reduce pathological GC pauses which used to be able
to happen when the intern table or class linker became "dirty"
during the concurrent GC.

Change-Id: I433fab021f2c339d50c35aaae7161a50a0901dec
9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40 28-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Remove oat file location in the image.

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

This also removes the need for host-prefix.

Change-Id: I16d1f7aeb1d58372d41921694664e9c321afc1ad
491ca9e75fad381468dd7f5fdbff56d1a9738dd7 03-Mar-2014 Brian Carlstrom <bdc@google.com> Add ART -help and -showversion

Bug: https://code.google.com/p/android/issues/detail?id=62149
Change-Id: I5c21c0433f5f341f94e7d977e8d2d69cc46d6fe3
15d3402bbf8265eb1165694da2e4117eb128f3bc 27-Feb-2014 Mathieu Chartier <mathieuc@google.com> Add custom SIGSEGV handler to help find heap corruption.

The new signal handler prints heap diagnostics when you get a SIGSEGV.
Added a fault message member in runtime which is modifiable by
Runtime::SetFaultMessage. When you get a SIGSEGV it will print out
whatever is stored in this string as well as the normal information.
This is useful for debugging heap corruption since it lets you see
which threads were in which methods when the last GC occured.

Added some smarter object dumping logic when the faulting address is
in the heap.

Bug: 12934910

Change-Id: Ia72be2c39f70ad711cbd746d66fad2b617d5d29f
6449c62e40ef3a9bb75f664f922555affb532ee4 11-Feb-2014 Brian Carlstrom <bdc@google.com> Create CompilerOptions

Package up most compiler related options in CompilerOptions. Details include:
- Includes compiler filter, method thresholds, SEA IR mode.
- Excludes those needed during Runtime::Init such as CompilerCallbacks and VerificationResults.
- Pass CompilerOptions to CompilerDriver.
- Remove CompilerOptions from Runtime.
- Add ability to pass options for app and image dex2oat to runtime via
-Xcompiler-option and -Ximage-compiler-option respectively.

Other
- Replace 2x CompilerCallbacks implementations with one.
- Factor out execv code for use by both image and oat generation.
- More OatFile error_msg reporting.
- DCHECK for SuspendAll found trying to run valgrind.

Change-Id: Iecb57da907be0c856d00c3cd634b5042a229e620
936b37f3a7f224d990a36b2ec66782a4462180d6 14-Feb-2014 Ian Rogers <irogers@google.com> Upcall support for x86-64.

Sufficient to pass jni_internal_test.

Change-Id: Ia0d9b8241ab8450e04765b9c32eb6dc8fc1a8733
815873ecc312b1d231acce71e1a16f42cdaf09f2 14-Feb-2014 Mathieu Chartier <mathieuc@google.com> Change root visitor to use Object**.

Simplifies code and improves the performance of root visiting since
we usually don't need to check to see if the object moved.

Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
d2fe10a3a34af171bf1631219cd2d6ff6b7778b5 15-Jan-2014 Sebastien Hertz <shertz@google.com> Remove blacklist

Removes the class initialization blacklist and use transaction to detect and
revert class initialization attempting to invoke native method. This only
concerns class initialization happening at compilation time when generating an
image (like boot.art for the system).

In transactional mode, we log every object's field assignment and array update.
Therefore we're able to abort a transaction to restore values of fields and
array as they were before the transaction starts. We also log changes to the
intern string table so we can restore its state prior to transaction start.

Since transactional mode only happens at compilation time, we don't need to log
all these changes at runtime. In order to reduce the overhead of testing if
transactional mode is on/off, we templatize interfaces of mirror::Object and
mirror::Array, respectively responsible for setting a field and setting an
array element.

For various reasons, we skip some specific fields from transaction:
- Object's class and array's length must remain unchanged so garbage collector
can compute object's size.
- Immutable fields only set during class loading: list of fields, method,
dex caches, vtables, ... as all classes have been loaded and verified before a
transaction occurs.
- Object's monitor for performance reason.

Before generating the image, we browse the heap to collect objects that need to
be written into it. Since the heap may still holds references to unreachable
objects due to aborted transactions, we trigger one collection at the end of
the class preinitialization phase.

Since the transaction is held by the runtime and all compilation threads share
the same runtime, we need to ensure only one compilation thread has exclusive
access to the runtime. To workaround this issue, we force class initialization
phase to run with only one thread. Note this is only done when generating image
so application compilation is not impacted. This issue will be addressed in a
separate CL.

Bug: 9676614
Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
97f4489166ae31c12d35ad3f550a5fc8d143b4fa 15-Feb-2014 Ian Rogers <irogers@google.com> Revert "Revert "Revert "Add a script for running art standalone."""

This reverts commit 4b23250f4cbf3047924c646c1a0c078394f8362d.

Change-Id: Ib749a8267abf35e51552b741ba749d6ed6975f95
4b23250f4cbf3047924c646c1a0c078394f8362d 13-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Add a script for running art standalone.""

This reverts commit 41dcb9f856a2051527cd595f8fe7d200066acba4.

Change-Id: Ide6fa696c6fb43fe17e0993e8c9d1b588c99b1f3
41dcb9f856a2051527cd595f8fe7d200066acba4 12-Feb-2014 Brian Carlstrom <bdc@google.com> Revert "Add a script for running art standalone."

This reverts commit 1f5a90f28443886ebefcfbd531b8e41ece298cca.
1f5a90f28443886ebefcfbd531b8e41ece298cca 07-Feb-2014 Nicolas Geoffray <ngeoffray@google.com> Add a script for running art standalone.

Change-Id: I0c48856d811c40662a6e4a4782478a0bc8e0f697
0177e53ea521ad58b70c305700dab32f1ac773b7 12-Feb-2014 Ian Rogers <irogers@google.com> Work in the direction of hard float quick ABIs.

Pass a shorty to ArtMethod::Invoke so that register setup can use it.
Document x86-64 ABI.
Add extra debug output for one JNI native method registration fails, namely a
dump of the Class and its dex file's location.
Add hack to get testing of OatMethod's without GC maps working in 64bit.

Change-Id: Ic06b68e18eac33637df2caf5e7e775ff95ae70f3
83c8ee000d525017ead8753fce6bc1020249b96a 28-Jan-2014 Mathieu Chartier <mathieuc@google.com> Add root types and thread id to root visiting.

Enables us to pass the root type and thread id to hprof.

Bug: 12680863
Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
412c7fced915fc8d4d5e4166e977d55c809168a6 07-Feb-2014 Mathieu Chartier <mathieuc@google.com> Make debugger / jdwp compaction safe.

Fixed GetInstances, GetReferringObjects, CountInstances to use
VisitObjects instead of the live bitmap.

We now treat the object registry as system weaks and update the
objects when/if they move. Also added the recent_allocation_records_
as roots.

Bug: 12936165

Change-Id: I615c289efbf2977ceab5c4ffa73d216d799e6e33
a4adbfd44032d70e166e6f18096bbbed05a990ba 05-Feb-2014 Hiroshi Yamauchi <yamauchi@google.com> RosAlloc verification.

If enabled, RosAlloc verification checks the allocator internal
metadata and invariants to detect bugs, heap corruptions, and race
conditions. Added runtime options for enabling and disabling
it. Enable it for the debug build.

Bug: 9986565
Bug: 12592026
Change-Id: I923742b87805ae839f1549d78d0d492733da6a58
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
055d46c479369ea825712834353660b45215c195 06-Feb-2014 Mathieu Chartier <mathieuc@google.com> Add missing SIRT to LoadNativeLibrary.

When we transition to kWaitingForJniOnLoad, we are suspended and
a GC can occur. This caused issues since classloaders are movable.

Change-Id: Iae59019c22ac64322a82300107d06a4323ee602b
6c2270be8d01a9cc3b691c49b43644545c2f4f33 29-Jan-2014 lzang1 <lin.zang@intel.com> Fix GC options to make the setting available

The concurrent gc thread number and parallel gc thread number is configurable by the options,
This patch fix the bug that making the options value valid.
This patch also fix that GC log threshold settings as MillionSecond.

Change-Id: I737838ef4af44396c23a538cd8a33581d9ae5e4d
Author: Lin Zang <lin.zang@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
be1ca55db3362f5b100c4c65da5342fd299520bb 15-Jan-2014 Hiroshi Yamauchi <yamauchi@google.com> Use direct class pointers at allocation sites in the compiled code.

- Rather than looking up a class from its type ID (and checking if
it's resolved/initialized, resolving/initializing if not), use
direct class pointers, if possible (boot-code-to-boot-class pointers
and app-code-to-boot-class pointers.)
- This results in a 1-2% speedup in Ritz MemAllocTest on Nexus 4.
- Embedding the object size (along with class pointers) caused a 1-2%
slowdown in MemAllocTest and isn't implemented in this change.
- TODO: do the same for array allocations.
- TODO: when/if an application gets its own image, implement
app-code-to-app-class pointers.
- Fix a -XX:gc bug.
cf. https://android-review.googlesource.com/79460/
- Add /tmp/android-data/dalvik-cache to the list of locations to
remove oat files in clean-oat-host.
cf. https://android-review.googlesource.com/79550
- Add back a dropped UNLIKELY in FindMethodFromCode().
cf. https://android-review.googlesource.com/74205

Bug: 9986565
Change-Id: I590b96bd21f7a7472f88e36752e675547559a5b1
938a03b3f196895e1fce2b862ae01039deca4c34 17-Jan-2014 Mathieu Chartier <mathieuc@google.com> Fix heap verification and add runtime options.

Post GC heap verification is now enabled by default for debug builds.
Added four Xgc runtime options: preverify, nopreverify, postverify,
nopostverify.

Fixed another bug where the non-moving space could theoretically end
up outside of the card table address range.

Bug: 10672951
Change-Id: I5ba3cd96dbfb900263dba795242df74c563deaa3
0f875ef27a4842d2e7c857b3c7eedbf8c8cf873f 15-Jan-2014 Mathieu Chartier <mathieuc@google.com> Revert accidental default collector type change.

Default collector type had been changed to generational semi-space
by default by accident.

Change-Id: I060b3f292261b8bb258ca2a350e26a328340c49c
6f4ffe41649f1e6381e8cda087ad3749206806e5 13-Jan-2014 Hiroshi Yamauchi <yamauchi@google.com> Improve the generational mode.

- Turn the compile-time flags for generational mode into a command
line flag.

- In the generational mode, always collect the whole heap, as opposed
to the bump pointer space only, if a collection is an explicit,
native allocation-triggered or last attempt one.

Change-Id: I7a14a707cc47e6e3aa4a3292db62533409f17563
e6da9af8dfe0a3e3fbc2be700554f6478380e7b9 16-Dec-2013 Mathieu Chartier <mathieuc@google.com> Background compaction support.

When the process state changes to a state which does not perceives
jank, we copy from the main free-list backed allocation space to
the bump pointer space and enable the semispace allocator.

When we transition back to foreground, we copy back to a free-list
backed space.

Create a seperate non-moving space which only holds non-movable
objects. This enables us to quickly wipe the current alloc space
(DlMalloc / RosAlloc) when we transition to background.

Added multiple alloc space support to the sticky mark sweep GC.

Added a -XX:BackgroundGC option which lets you specify
which GC to use for background apps. Passing in
-XX:BackgroundGC=SS makes the heap compact the heap for apps which
do not perceive jank.

Results:
Simple background foreground test:
0. Reboot phone, unlock.
1. Open browser, click on home.
2. Open calculator, click on home.
3. Open calendar, click on home.
4. Open camera, click on home.
5. Open clock, click on home.
6. adb shell dumpsys meminfo

PSS Normal ART:
Sample 1:
88468 kB: Dalvik
3188 kB: Dalvik Other
Sample 2:
81125 kB: Dalvik
3080 kB: Dalvik Other

PSS Dalvik:
Total PSS by category:
Sample 1:
81033 kB: Dalvik
27787 kB: Dalvik Other
Sample 2:
81901 kB: Dalvik
28869 kB: Dalvik Other

PSS ART + Background Compaction:
Sample 1:
71014 kB: Dalvik
1412 kB: Dalvik Other
Sample 2:
73859 kB: Dalvik
1400 kB: Dalvik Other

Dalvik other reduction can be explained by less deep allocation
stacks / less live bitmaps / less dirty cards.

TODO improvements: Recycle mem-maps which are unused in the current
state. Not hardcode 64 MB capacity of non movable space (avoid
returning linear alloc nightmares). Figure out ways to deal with low
virtual address memory problems.

Bug: 8981901

Change-Id: Ib235d03f45548ffc08a06b8ae57bf5bada49d6f3
0aded089f565008ba5908e395e5914ca4f91f2de 07-Nov-2013 Dave Allison <dallison@google.com> Add sampling profiler

This adds a sampling profiler thread that runs every so often, gathering
profiling data and writing the results to a file in /data/data (specific to
app running). The intention is to use these files as input to the compiler
so that it can determine the best methods to compile.

Bug: 11539952
Change-Id: I0bfbb4146fb7966673c792f017ffac8107b6272d
2b5eaa2b49f7489bafdadc4b4463ae27e4261817 13-Dec-2013 Vladimir Marko <vmarko@google.com> Move compiler code out of method verifier.

We want to detect small methods for inlining at the end of
the method verification. Instead of adding more compiler
code to the runtime, we create a callback from the runtime
into the compiler, so that we can keep the code there.
Additionally, we move the compiler-related code that was
already in the method verifier to the compiler since it
doesn't really belong to the runtime in the first place.

Change-Id: I708ca13227c809e07917ff3879a89722017e83a9
692fafd9778141fa6ef0048c9569abd7ee0253bf 30-Nov-2013 Mathieu Chartier <mathieuc@google.com> Thread local bump pointer allocator.

Added a thread local allocator to the heap, each thread has three
pointers which specify the thread local buffer: start, cur, and
end. When the remaining space in the thread local buffer isn't large
enough for the allocation, the allocator allocates a new thread
local buffer using the bump pointer allocator.

The bump pointer space had to be modified to accomodate thread
local buffers. These buffers are called "blocks", where a block
is a buffer which contains a set of adjacent objects. Blocks
aren't necessarily full and may have wasted memory towards the
end. Blocks have an 8 byte header which specifies their size and is
required for traversing bump pointer spaces.

Memory usage is in between full bump pointer and ROSAlloc since
madvised memory limits wasted ram to an average of 1/2 page per
block.

Added a runtime option -XX:UseTLAB which specifies whether or
not to use the thread local allocator. Its a NOP if the garbage
collector is not the semispace collector.

TODO: Smarter block accounting to prevent us reading objects until
we either hit the end of the block or GetClass() == null which
signifies that the block isn't 100% full. This would provide a
slight speedup to BumpPointerSpace::Walk.

Timings: -XX:HeapMinFree=4m -XX:HeapMaxFree=8m -Xmx48m
ritzperf memalloc:
Dalvik -Xgc:concurrent: 11678
Dalvik -Xgc:noconcurrent: 6697
-Xgc:MS: 5978
-Xgc:SS: 4271
-Xgc:CMS: 4150
-Xgc:SS -XX:UseTLAB: 3255

Bug: 9986565
Bug: 12042213

Change-Id: Ib7e1d4b199a8199f3b1de94b0a7b6e1730689cad
c528dba35b5faece51ca658fc008b688f8b690ad 26-Nov-2013 Mathieu Chartier <mathieuc@google.com> Enable moving classes.

Slight reduction in Zygote size, memory savings are in the noise.
Before: Zygote size: 8739224
After: Zygote size: 8733568

Fixed a bug where we didn't set the concurrent start bytes after
switching the allocator from bump pointer to ROSAlloc in the
zygote. This caused excessive memory usage.

Added the method verifiers as roots to fix an issue caused by
RegTypes holding a Class*.

Added logic to clear card table in the SemiSpace collector, this
reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace
collector.

Added a missing lock to the timing loggers which caused a rare
one time crash in std::set.

Bug: 11771255
Bug: 8499494
Bug: 10802951

Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
501668ae6b3c1546cd94cbce71bc2e9eb0d851b8 05-Dec-2013 Hiroshi Yamauchi <yamauchi@google.com> Fix a rosalloc check failure in a test.

Bug: 11884037
Change-Id: I44356bbb0b4406ac289d59f4fd29878452087c03
0de9f73afe3e835b63f2ee0c1416930656449f3f 23-Nov-2013 Mathieu Chartier <mathieuc@google.com> Add -xGc: MS, CMS, SS options to specify which GC to use.

Can be used for running tests or benchmarks with semispace,
marksweep or concurrent marksweep.

Change-Id: Ic9ab1220150f2c7c9c30df4ffee45b9d303094b3
2e899a92439dc6bdaaa67b8230933006284aa600 23-Nov-2013 Hiroshi Yamauchi <yamauchi@google.com> Fix a crash with -XX:DumpGCPerformanceOnShutdown.

DumpGcPerformanceInfo() could call RosAllocSpace::InspectAllRosAlloc()
which needs the thread list to be still alive. Fix by moving the
DumpGcPerformanceInfo() call from the Heap destructor up to the
beginning of the Runtime destructor so that the thread list is still
alive when it's called.

Bug: 11830901
Change-Id: Ib094d60916943c8cb1d4b769d805b4ca03269f90
ff3b24aa929a9db79daeef7c0b0522da099700a9 23-Nov-2013 Mathieu Chartier <mathieuc@google.com> Add developer option for dumping GC cumulative timings on shutdown.

The option is "-XX:DumpGCPerformanceOnShutdown".
Bug: 9986416

Change-Id: If6ebb26b3e611a9dead197740dbfc64e548dc388
cf58d4adf461eb9b8e84baa8019054c88cd8acc6 26-Sep-2013 Hiroshi Yamauchi <yamauchi@google.com> A custom 'runs-of-slots' memory allocator.

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

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

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

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

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

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

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

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

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
fa82427c68b09f4aedbee319dc71579afbfc66f5 06-Nov-2013 Ian Rogers <irogers@google.com> Fix oatdump and valgrind.

Bug: 11531382
Move allocation instrumentation out of runtime into instrumentation. Don't
attempt to suspend threads in unstarted runtimes.
Make indentation support sputc returning eof, on which it will sync and try
again. A further failure likely means the disk is full.
Move the dump-oat output directory to be art as now there's too much output to
fit all the dump-oat data in our standard /tmp.

Change-Id: I8ea848ace318552c180e2efa46570288ff1ca62c
88474b416eb257078e590bf9bc7957cee604a186 24-Oct-2013 Jeff Hao <jeffhao@google.com> Implement Interface Method Tables (IMT).

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

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

Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
ce88853ab316c70ef7b598978a3609611db60552 10-Oct-2013 Brian Carlstrom <bdc@google.com> Have JNI FindClass fall back to system ClassLoader
Bug: 10994325

Change-Id: Id0a46e78eecfe8a9eb91008765c4fff48697cc58
253ea073ec03a0be1e22df98957257594e316a39 02-Oct-2013 Hiroshi Yamauchi <yamauchi@google.com> Fix an Art debug build boot failure.

(The original change is 3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5.)

Bug: 11003273
Bug: 9986565
Change-Id: Iaaf6395f171eb6e6b8c99386c20c4970c53ee00d
d9c4fc94fa618617f94e1de9af5f034549100753 02-Oct-2013 Ian Rogers <irogers@google.com> Inflate contended lock word by suspending owner.

Bug 6961405.
Don't inflate monitors for Notify and NotifyAll.
Tidy lock word, handle recursive lock case alongside unlocked case and move
assembly out of line (except for ARM quick). Also handle null in out-of-line
assembly as the test is quick and the enter/exit code is already a safepoint.
To gain ownership of a monitor on behalf of another thread, monitor contenders
must not hold the monitor_lock_, so they wait on a condition variable.
Reduce size of per mutex contention log.
Be consistent in calling thin lock thread ids just thread ids.
Fix potential thread death races caused by the use of FindThreadByThreadId,
make it invariant that returned threads are either self or suspended now.

Code size reduction on ARM boot.oat 0.2%.
Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%,
nexus 4 speedup 2.09% on DeltaBlue.

Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5 13-Sep-2013 Hiroshi Yamauchi <yamauchi@google.com> Split the allocation path into 'instrumented' and 'uninstrumented'
ones.

The instrumented path is equivalent to the existing allocation path
that checks for three instrumentation mechanisms (the debugger
allocation tracking, the runtime allocation stats collection, and
valgrind) for every allocation. The uinstrumented path does not
perform these checks. We use the uninstrumented path by default and
enable the instrumented path only when any of the three mechanisms is
enabled. The uninstrumented version of Heap::AllocObject() is inlined.

This change improves the Ritz MemAllocTest by ~4% on Nexus 4 and ~3%
on Host/x86.

Bug: 9986565
Change-Id: I3e68dfff6789d77bbdcea98457b694e1b5fcef5f
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
c11d9b8870de5f860b13c84003ade7b3f3125a52 19-Sep-2013 Mathieu Chartier <mathieuc@google.com> Re-enable concurrent system weak sweeping.

Enabled by disallowing new system weaks during the pause and
re-allowing it after the system weaks have been swept. Reduces
GC pause by ~1ms.

Fixes pause regression caused by fix for
Bug: 10626133

Change-Id: If49d33e7ef19cb728ed3cef5187acfa53b9b05d8
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
52cd1e8f2f0622a174f883e24151ab873170787f 18-Sep-2013 Jeff Sharkey <jsharkey@android.com> Allow traversal into /storage paths.

Apps are no longer required to have sdcard_r or sdcard_rw to access
some parts of external storage. Relax the mount parameters to allow
everyone to traverse.

Bug: 10577808
Change-Id: Ife3c6fb18028f7093ff853459c1ca1e0ec7a6d01
6aa3df965395566ed6a4fec4af37c2b7577992e9 18-Sep-2013 Mathieu Chartier <mathieuc@google.com> Refactor system weak sweeping, add support for modification.

Required for moving collectors.

Change-Id: Ib97ba4a05af1139f8d388077a15e62bcb9534855
c4621985bdfc2b27494087e5dee65a6d0cc5a632 17-Sep-2013 Mathieu Chartier <mathieuc@google.com> Fix race in root marking.

There was a race which caused the class linker / intern table to not
become dirty after adding a root. We now guard the is dirty flag by
the corresponding locks to prevent this from occuring. This was
causing roots to be occasionally missed.

Also fixes the bug where we occasionally scan more cards than
needed.

Bug: 10626133

Change-Id: I0f6e72d92035ff463954d66988ef610ea0df61be
423d2a3dcbb260b020efb5da59f784c9f02accbf 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Add support for changing roots through the root visitor callback.

Needed for copying collectors.

Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
a436fde2762664a3ecdda5eefcadd20b2e104f59 28-Aug-2013 Ian Rogers <irogers@google.com> Handle OOMEs in class linker with grace.

Check for OOMEs and then fail due to them in class loading.
Make the compiler driver spot OOMEs during resolution and abort compilation to
avoid needless GC thrash then eventual death.
Allocate the pre-allocated OOME during Runtime::Init as Runtime::Start isn't
called in the context of the compiler/tools.

Change-Id: Id72199d0fe82001b5bf22758b3cdc9cc4b8efbb9
cf2fb8e6430059cc7fe0a6f931555bb717988393 23-Aug-2013 Jeff Hao <jeffhao@google.com> Add art support for sample profiling from traceview gui.

Change-Id: I6004bf143521b872084ca4aae873bea3524aa895
(cherry picked from commit 23009dca63c1699e28bfeaa8b45ca48fa0e86ace)
23009dca63c1699e28bfeaa8b45ca48fa0e86ace 23-Aug-2013 Jeff Hao <jeffhao@google.com> Add art support for sample profiling from traceview gui.

Change-Id: I6004bf143521b872084ca4aae873bea3524aa895
2775ee4f82dff260663ca16adddc0b15327aaa42 21-Aug-2013 Mathieu Chartier <mathieuc@google.com> Add more runtime options.

Changed HeapGCThreads to be split into two different options:
-XX:ParallelGCThreads: Which specifies how many threads the GC may
use when the mutators are suspended.

-XX:ConcGCThreads: Which specifies how many threads the GC may use
when the mutators are running.

Added runtime options to specify long pause / long GC thresholds:
-XX:LongPauseThreshold (default 5ms)
-XX:LongGCThreshold (default 100ms)
These thresholds were previously constants, but are now runtime
options. If we exceed either of the thresholds, we print the GC
message.

Added a new runtime option: -XX:IgnoreMaxFootprint which makes it
that the GC only does GC when the number of bytes allocated hits
the growth limit. This causes GC to occur much less frequently and
can be useful to measure how much of an impact GC has on performance.

Changed the GC behaviour to use only one thread when we do not care
about pauses to prevent jank that can be caused by 2 simultaneous GC
on different processes fighting for CPU time.

Added thread pool functionality for changing the maximum number of
active workers.

Fixed an accounting error where we didn't count large objects in the
total freed.

Bug: 9986416

Change-Id: I86afa358d93dcd3780e18ac5d85bdb1a130cb7e7
fe9ca4028f379688ecba6132ac3738171176b3e4 21-Aug-2013 buzbee <buzbee@google.com> Compiler filter update

Tweak of the compiler filter to give better results for applications
which are not dominated by tight arithmetic loops. Deleted
the "DeferCompilation" setting - it didn't differ enough from the
"Space" setting. Added "Everything" setting to support forced
compilation (for images and testing). Previously used "Speed"
for that purpose, but in the speed setting there are some things we
don't want to compile.

Change-Id: Ia53b14f2044fc9738c1a4c1318f8204f2c25abe3
abd7be989a7509d6dd7325d505fa9926ed502355 15-Aug-2013 Ian Rogers <irogers@google.com> Prevent segvs in JNI.

A segv in JNI code (without CheckJNI) is hard to debug as we fail to see
stacks, pending exceptions.. Make JNI code robust to null arguments, but don't
go to the lengths that CheckJNI does in also sanity checking arguments, the
priority here is just to stop the VM from crashing.

Bug 10305723

Also, allow an unknown throw location not to crash exception dumping.

Found/useful for debugging bug 10331039.

(cherry picked from commit bc939663ccfbe0c648dd6a3670041510aca82420)

Change-Id: Id0203db7d9e320d45ae5ba25d2b63939c79e5c16
bc939663ccfbe0c648dd6a3670041510aca82420 15-Aug-2013 Ian Rogers <irogers@google.com> Prevent segvs in JNI.

A segv in JNI code (without CheckJNI) is hard to debug as we fail to see
stacks, pending exceptions.. Make JNI code robust to null arguments, but don't
go to the lengths that CheckJNI does in also sanity checking arguments, the
priority here is just to stop the VM from crashing.

Bug 10305723

Also, allow an unknown throw location not to crash exception dumping.

Found/useful for debugging bug 10331039.

Change-Id: Ib1e5540df87e2d9ce7570802d624baae7797611f
8718359763aa3dcd0033a2d2e67e0cb145fb9c53 14-Aug-2013 Anwar Ghuloum <anwarg@google.com> Add -XX:+DisableExplicitGC option for Art

Phone boots. Also removed elfwriter spam from logcat.

Change-Id: I09b9d2fc40ebfeb6f1c2f12153b0ad4134bb5159
75a43f10f55e2aa550de51e969cc1e60d583b632 14-Aug-2013 Anwar Ghuloum <anwarg@google.com> Clean up logcat spam from compiler and verifier

Moved to VLOG(...), adding verifer tag for VLOG.

Change-Id: Ia9ac8aeaf5aa1f4881e384003e82a66e560c5692
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
ee17e0aa4d24deb11c1766bfcc6a864519df1c1e 31-Jul-2013 buzbee <buzbee@google.com> Compilation filter

This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.

It supports 5 modes of filtering:

o interpret-only (compile nothing)
o deferred-compilation (compile only those methods believe to be
compute-intensive)
o space (optimized for space)
o balanced (best return on space investment)
o speed (compile everything)

A future CL will allow the default filtering mode to be set
via system property. For now, you can pass it in via command
line as follows:

dalvikvm -compiler-filter:[interpret-only|defer-compilation|
space|balanced|speed]

or dex2oat --runtime-arg -compiler-filter:[one of the above modes]

Creating a file named art/SMALL_ART will force the filter
default to interpret-only. Later on we'll move this capability
to a persistent system property.

or modify kDefaultCompilerFilter in runtime.h

It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.

Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
(cherry picked from commit a024a0686c3b0fea13f362bff70d65981e5febc5)
a024a0686c3b0fea13f362bff70d65981e5febc5 31-Jul-2013 buzbee <buzbee@google.com> Compilation filter

This CL introduces a static compilation filter mechanism intended
to allow us to reduce compilation time and space requirements until
we have a profiling mechanism in place.

It supports 5 modes of filtering:

o interpret-only (compile nothing)
o deferred-compilation (compile only those methods believe to be
compute-intensive)
o space (optimized for space)
o balanced (best return on space investment)
o speed (compile everything)

A future CL will allow the default filtering mode to be set
via system property. For now, you can pass it in via command
line as follows:

dalvikvm -compiler-filter:[interpret-only|defer-compilation|
space|balanced|speed]

or dex2oat --runtime-arg -compiler-filter:[one of the above modes]

Creating a file named art/SMALL_ART will force the filter
default to interpret-only. Later on we'll move this capability
to a persistent system property.

or modify kDefaultCompilerFilter in runtime.h

It also changes the compiler driver to allow the compilers to
decline to compile a method by return NULL.

Change-Id: Ic73411818f8bb845a4a19a05b0395c50902c534f
e0a53e99e2a01f8668d6616c3cec7e2f5a711286 05-Aug-2013 Mathieu Chartier <mathieuc@google.com> Add low memory mode option to ART.

Useful so that we match the option I added here:
https://googleplex-android-review.googlesource.com/#/c/328940/

In ART low memory mode reduces the maximum number of histogram
buckets. We also trim no matter the utilization.

Change-Id: I655ba63312c0a6574569cdd5171ca81ea338c2aa
834b394ee759ed31c5371d8093d7cd8cd90014a8 31-Jul-2013 Brian Carlstrom <bdc@google.com> Merge remote-tracking branch 'goog/dalvik-dev' into merge-art-to-dalvik-dev

Change-Id: I323e9e8c29c3e39d50d9aba93121b26266c52a46
166db04e259ca51838c311891598664deeed85ad 26-Jul-2013 Ian Rogers <irogers@google.com> Move assembler out of runtime into compiler/utils.

Other directory layout bits of clean up. There is still work to separate quick
and portable in some files (e.g. argument visitor, proxy..).

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

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
4d4adb1dae07bb7421e863732ab789413a3b43f0 24-Jul-2013 Sebastien Hertz <shertz@google.com> Prevent verifier from creating unused compilation data.

The verifier used to create data which may be unused like GC map. This is the
case for non-compiled method (which are interpreted). This CL aims to optimize
this.

Here are the changes:
- Move compilation selection to MethodVerifier::IsCandidateForCompilation.
- Compiler and verifier use this method to know if a method must be compiled.
- Only create compilation data while compiling using Runtime::IsCompiler.
- Do not create internal structures concerning GC map, ... in Runtime::Init and
Runtime::Shutdown when we are not compiling.
- Checks we are compiling when accessing these structures.
- Add missing destruction of MethodVerifier::safecast_map_lock_ and
MethodVerifier::safecast_map_ in Runtime::Shutdown.
- Call Runtime::Shutdown just before Runtime instance is destroyed to avoid a
crash.
- Add missing "GUARDED_BY" macro for MethodVerifier::rejected_classes_ field.
- Add "has_check_casts" to avoid the safecast pass if there is no check-cast
instruction.
- Add "has_virtual_or_interface_invokes" to avoid the devirtualization pass if
there is no invoke-virtual/range nor invoke-interface/range instructions.

Bug: 9987437
Change-Id: I418ee99f63e4203409cf5b7d2c2295b22fcf24c1
63a54345598861030178e033ffbd72c0e231a4c9 23-Jul-2013 Mathieu Chartier <mathieuc@google.com> Add option for changing number of GC threads.

The number of threads was previously set to 1 by an accidential
checkin. This hurts on all devices which aren't dual core. We now
properly use sysconf to determine how many threads we should create.

Also added a -XX:HeapGCThreads heap option which lets us change
how many GC threads we create. The default value is equal to the
number of processors on the device minus one.

Change-Id: If65065ef09174a3813b8741efdd5ea7bbe82a4e2
b1eba213afaf7fa6445de863ddc9680ab99762ea 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/comma issues

Change-Id: I456fc8d80371d6dfc07e6d109b7f478c25602b65
2ce745c06271d5223d57dbf08117b20d5b60694a 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/braces issues

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