History log of /art/runtime/monitor.cc
Revision Date Author Comments
23da026ec7a7fae22833ed2f61a80d9f9bf7e732 30-Jul-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Use try lock to fix class resolution race""

Fix possible deadlock in EnsureResolved caused by interaction with
GC. Since we were sleeping while holding the mutator lock, it could
block thread suspension. This would deadlock if the thread that
had locked h_class is already suspended since we would spin forever
and not make progress.

Bug: 27417671
Bug: 30500547

Test: test-art-host ART_TEST_GC_STRESS=true

This reverts commit 69bf969c055c31a75d17ea92aeee756042678114.

(cherry picked from commit 4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114)

Change-Id: If5766c2c3c8a130cbb83735cdb9970038570dafd
adc538a57ad1f771051cd52afc216c3e5f0270cd 29-Jul-2016 Mathieu Chartier <mathieuc@google.com> Revert "Use try lock to fix class resolution race"

This reverts commit a704eda0078989a73cac111ed309aca50d2e289b.

Bug: 27417671
Bug: 30500547

(cherry picked from commit 69bf969c055c31a75d17ea92aeee756042678114)

Change-Id: I4354d1c9f1c554f054e99efd7aa52d8a2c5d402c
1386f8619bb9cd338e51a9b6b5121bc8443bda76 13-Jul-2016 Mathieu Chartier <mathieuc@google.com> Use try lock to fix class resolution race

There was some possible deadlocks related to EnsureResolved caused by
acquiring an object lock.

Scenario:
Thread 1 acquires lock on obj1
Thread 1 begins to resolve / initialize class1
Thread 1 blocks since it sees that class1 is already being resolved and
gets preempted before it can acquire the object lock on class1
Thread 2 finishes resolving and initializing class1 and locks class1
Thread 2 blocks attempting to lock obj1
Thread 1 blocks attempting to lock class1
Deadlock

Fixed the deadlock by changing EnsureResolved to use a try lock for the
unresolved case.

Added a test.

Test: Device boot, test-art-host, monitor_test

Bug: 27417671

(cherry picked from commit a704eda0078989a73cac111ed309aca50d2e289b)

Change-Id: I1150b19bdc1a5cc87ae95eda4f2b6b4bca215a60
825ab1c3f44fd84e5967f023c2dd8d36c6906f08 17-May-2016 Andreas Gampe <agampe@google.com> ART: Fix systrace monitor logging

Thinlock unlocking was incorrectly unconditionally ending a block.

Bug: 28423466
Change-Id: Ifaebd9e959041e157e292d4cba05675a37e9c700
8f26411287cddd983df6f1d00dbc3841767c123d 29-Apr-2016 Mathieu Chartier <mathieuc@google.com> Add contender method for lock contention

Now prints the method that is attempting to acquire the lock.

Bug: 28223501
Change-Id: I47c4261d14d8767a873594594b7675a176b71d70
fc6898769ae1ef91ec3e41c0a273401213cb82cd 26-Apr-2016 Andreas Gampe <agampe@google.com> ART: Log all monitor operations to systrace

Add a VLOG option ("-verbose:systrace-locks") to log all monitor
operations to systrace. This requires non-fastpath thread
entrypoints, and ATRACE tags for locking and unlocking.

Do a bit of cleanup to the entrypoint initialization to share
common setup.

Bug: 28423466
Change-Id: Ie67e4aa946ec15f8fcf8cb7134c5d3cff0119ab3
dee19e3caaeb5666055842d656dc0516b901f30c 19-Apr-2016 Mathieu Chartier <mathieuc@google.com> Do less work holding thread list lock

Avoid doing stuff that requires access java heap like PrettyMethod.
Fixes lock violation.

Bug: 28268478
Change-Id: Ie090879690df7a6db15a9c8b7e82f3809450d653
81c170fede9af9174aba71428334ac8f366a4b4f 18-Apr-2016 Mathieu Chartier <mathieuc@google.com> Prevent holding stale Thread pointers

It is only really safe to hold non-self Thread* if you hold the
thread list lock. Changed a few places to use thread ids instead
of Thread.

Bug: 28223501

Change-Id: Ie58bd755bf1dcf3c1f37da79ba0b2507f77574dd
dc3c630ffdb3487bc46d878bf89c886f8ee69ef3 16-Apr-2016 Mathieu Chartier <mathieuc@google.com> Add more info to monitor contention logging

Print owner thread name and tid. Print blocking file name and line
number.

Bug: 28223501
Change-Id: I6ee50ba8521c37977accad039fcf039c78b246e2
b2771b41a956b50266d4d83fbb067f99faf7b7dc 07-Apr-2016 Calin Juravle <calin@google.com> Add option to tune sample collection based on thread sensitivity

Bug: 28065407
Bug: 27865109

Change-Id: Icdb89f8f8874a41c07e73185523d18e8956620d3
3a84e31b247f0c7b6c31946f15def732d556282c 10-Mar-2016 Mathieu Chartier <mathieuc@google.com> Allocate interrupted exception before re-acquiring lock

Allocating the monitor exception after acquiring the lock can cause
a deadlock in the following scenario:

Reference queue daemon interrupted from wait() on
ReferenceQueue.class. Tries to allocate exception and starts a GC
that blocks on WaitForGcToComplete.

Some other thread is already doing a GC, and tries to enqueue the
cleared refereneces. This deadlocks trying to lock Reference.class
in ReferenceQueue.add.

Bug: 27508829

(cherry picked from commit daed5d81e2fdb9d1e03ee6c34567347b92dcfb22)

Change-Id: Ibdc2769077976545385d8c6ecc5bf26316eb70a1
daed5d81e2fdb9d1e03ee6c34567347b92dcfb22 10-Mar-2016 Mathieu Chartier <mathieuc@google.com> Allocate interrupted exception before re-acquiring lock

Allocating the monitor exception after acquiring the lock can cause
a deadlock in the following scenario:

Reference queue daemon interrupted from wait() on
ReferenceQueue.class. Tries to allocate exception and starts a GC
that blocks on WaitForGcToComplete.

Some other thread is already doing a GC, and tries to enqueue the
cleared refereneces. This deadlocks trying to lock Reference.class
in ReferenceQueue.add.

Bug: 27508829
Change-Id: Icbc18b6b8d1e906c3f7413810d6cefdda06eb921
32ce2adefb8a3d0eda59a29f5e87c1eb43eef796 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

(cherry picked from commit dabdc0fe183d4684f3cf4d70cb09d318cff81b42)

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
dabdc0fe183d4684f3cf4d70cb09d318cff81b42 04-Mar-2016 Mathieu Chartier <mathieuc@google.com> Add more systracing everywhere

Added to:
JIT
DexFile functions
Oat file manager

Added helper ScopedTrace to prevent errors and reduce excess code.

Bug: 27502458

Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
328c5dc0d178632125f5a05002051a6adc04766a 12-Nov-2015 Hans Boehm <hboehm@google.com> Get class loader to remember interrupts

Bug: 25606036

Monitor::Wait should not reset the interrupt flag unless it actually
throws the exception.

Change-Id: Id6a35c888160043831f30055f9bd39e7f0440439
0f7c93322e50ff53eeba6b9ae13cf73eb0617587 05-Nov-2015 Sebastien Hertz <shertz@google.com> Minor cleanup of Monitor::VisitLocks

Uses the Instruction class to not bother with the decoding logic.

Change-Id: Id1501b57129084014f05e41513319639a630361d
2d096c94fbd3fd2470b8ac1a0da6f577b3f69f42 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Fix moving GC bugs in MonitorEnter and MonitorExit

Fixes test 088 with gcstress mode.

Change-Id: Iaeb91f62f22233e403e97e954bfdc8dc367e63c8
eaa4609574267771f2080cbaa3dbe26da709b6f6 08-Oct-2015 Brian Carlstrom <bdc@google.com> Fix monitor contention logging to support negative line numbers

Bug: 24743369
Change-Id: I8dd4f59e0bd27aa4daa1d79a412fc7821c070c67
f1d666e1b48f8070ef1177fce156c08827f08eb8 04-Sep-2015 Mathieu Chartier <mathieuc@google.com> Add ScopedThreadSuspension

Fixes the TransitionFromRunnableToSuspended and
TransitionFromSuspendedToRunnable pattern that was prone to errors.

Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
fdbd13c7af91a042eda753e436eeebf0e1937250 03-Sep-2015 Hiroshi Yamauchi <yamauchi@google.com> Some fixes for the CC collector.

- Remove a DCHECK in DisableMarkingCheckpoint, which caused
occasional (false) failures.
- Check the thread-local GetWeakRefAccessEnabled in boxed lambdas weak
access.
- Add missing BroadcastForNewAllocationRecords and
BroadcastForNewWeakBoxedLambdas. The lack of the former caused
occasional deadlocks in the ddmc test.
- Remove the 'ensure system weaks disallowed' calls, which weren't
useful and dead.

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

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

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

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
97509954404d031594b2ecbda607314d169d512e 13-Jul-2015 Mathieu Chartier <mathieuc@google.com> Clean up GC callbacks to be virtual methods

Change-Id: Ia08034a4e5931c4fcb329c3bd3c4b1f301135735
0b71357fb52be9bb06d35396a3042b4381b01041 17-Jun-2015 Hiroshi Yamauchi <yamauchi@google.com> Thread-local mark stacks for the CC collector.

Thread-local mark stacks are assigned to mutators where they push
references in read barriers to reduce the (CAS) synchronization cost
in a global mark stack/queue.

We step through three mark stack modes (thread-local, shared,
GC-exclusive) and use per-thread flags to disable/enable system weak
accesses (only for the CC collector) instead of the existing global
one to safely perform the marking phase. The reasons are 1)
thread-local mark stacks for mutators need to be revoked using a
checkpoint to avoid races (incorrectly leaving a reference on mark
stacks) when terminating marking, and 2) we can’t use a checkpoint
while system weak accesses are disabled (or a deadlock would
happen). More details are described in the code comments.

Performance improvements in Ritzperf EAAC: a ~2.8% improvement
(13290->12918) in run time and a ~23% improvement (51.6s->39.8s) in
the total GC time on N5.

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

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

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

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

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

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

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

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

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

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

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

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

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

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

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

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

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

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

This fixes mips64 boot.

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
41b175aba41c9365a1c53b8a1afbd17129c87c14 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

Bug: 13925192

(cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0)

Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
80afd02024d20e60b197d3adfbb43cc303cf29e0 19-May-2015 Vladimir Marko <vmarko@google.com> ART: Clean up arm64 kNumberOfXRegisters usage.

Avoid undefined behavior for arm64 stemming from 1u << 32 in
loops with upper bound kNumberOfXRegisters.

Create iterators for enumerating bits in an integer either
from high to low or from low to high and use them for
<arch>Context::FillCalleeSaves() on all architectures.

Refactor runtime/utils.{h,cc} by moving all bit-fiddling
functions to runtime/base/bit_utils.{h,cc} (together with
the new bit iterators) and all time-related functions to
runtime/base/time_utils.{h,cc}. Improve test coverage and
fix some corner cases for the bit-fiddling functions.

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

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

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
15b9d5274399736ac09705f0507df24fac4f00c1 12-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> API change in StackVisitor::GetVReg*.

- Remove GetVReg() and SetVReg() that were expecting to always succeed.
- Change Quick-only methods to take a FromQuickCode suffix.
- Change deopt to use dead values when GetVReg does not succeed:
the optimizing compiler will not have a location for uninitialized
Dex registers and potentially dead registers.

Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
0aa50ce2fb75bfc2e815a0c33adf9b049561923b 10-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Remove ThrowLocation.

Note that this is a cleanup change, and has no functionality change.
The ThrowLocation had no use anymore.

Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
14691c5e786e8c2c5734f687e4c96217340771be 05-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Compute the right catch location for the debugger.

Also remove tls ThrowLocation, it is not needed anymore.

Change-Id: I78fddf09ce968ca475e39c17fa76d699c589c8d9
e15ea086439b41a805d164d2beb07b4ba96aaa97 10-Feb-2015 Hiroshi Yamauchi <yamauchi@google.com> Reserve bits in the lock word for read barriers.

This prepares for the CC collector to use the standard object header
model by storing the read barrier state in the lock word.

Bug: 19355854
Bug: 12687968
Change-Id: Ia7585662dd2cebf0479a3e74f734afe5059fb70f
2cd334ae2d4287216523882f0d298cf3901b7ab1 09-Jan-2015 Hiroshi Yamauchi <yamauchi@google.com> More of the concurrent copying collector.

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
4936159997132d7706d9700c646f35ef0283df4b 23-Jan-2015 Mathieu Chartier <mathieuc@google.com> Fix compaction unsafe DescribeWait

Fixes a crash that was seen once in automated tests, PrettyTypeOf
was accessing a stale object which had moved during IdentityHashCode
due to thin lock inflation causing suspension.

Change-Id: I105aa9a09d4e8c9091b9a60e508ef71e613f1eed
e6a8eec3a5db28de7d5db6d78e38033b80740e49 06-Jan-2015 Mathieu Chartier <mathieuc@google.com> Fix frequent gcstress ThreadStress crash

Calling IdentityHashCode before PrettyTypeOf was causing occasional
stale root errors since IdentityHashCode can cause thread suspension.

Cleaned up VisitLocks.

Bug: 18766916
Change-Id: I7679539877e48a8c9aadb8a34718404ebce98d25
f0dc8b5519102b3d3e738aed846975ae4239421e 17-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add systrace events to monitors and thread suspension

Added systrace events to SuspendThreadByPeer, SuspendThreadByThreadId
and monitor contention.

Bug: 18379850
Bug: 17470248
Change-Id: I29eaf97c67361a6c6b437940b8729600d78696df
4ad5cd3e7d519484559ef778d96fb3f0be8919fa 12-Nov-2014 Ian Rogers <irogers@google.com> Modify the behavior of thread suspend shootouts.

The thread doing the suspension doesn't attempt to suspend the other thread
unless it knows another thread isn't trying to suspend it. Use the suspend
count, and its lock, for this purpose.
Re-enable ThreadStress test.
Bug: 15446488

Change-Id: Idd34410c7b89d8abd6973e5699a15ca699472c78
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

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

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
2c4257be8191c5eefde744e8965fcefc80a0a97d 24-Oct-2014 Ian Rogers <irogers@google.com> Tidy logging code not using UNIMPLEMENTED.

Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
b9001abff3a45f1ae90536da7dd1ec28a6ae0174 03-Oct-2014 Mathieu Chartier <mathieuc@google.com> Add extra logging for lock contention

When we get contention which is longer than kLongWaitMs (= 100ms) we
log to logcat.

Example output:
W/art ( 9960): Long monitor contention event with owner method=void com.android.server.am.BroadcastQueue.processNextBroadcast(boolean) from BroadcastQueue.java:542 waiters=1 for 243ms

Bug: 17787391
Change-Id: Id1f92d9c41ec909d221871ecc2ff6181dcec2ed4
c7376cabb889eb49cbd2dd9a77d10ee63a53d5b5 08-Sep-2014 Sebastien Hertz <shertz@google.com> Fix monitor visit for class initializer

We do not hold class object's lock when invoking class initializer. Therefore
it is wrong to visit it when looking for monitors owned by a thread.

Bug: 17377924

(cherry picked from commit 6d06f1b34322d91226c9dcd61e53c2b6731f8bb6)

Change-Id: I9a18c421297608dc3109624111f9fea021a16d24
6d06f1b34322d91226c9dcd61e53c2b6731f8bb6 08-Sep-2014 Sebastien Hertz <shertz@google.com> Fix monitor visit for class initializer

We do not hold class object's lock when invoking class initializer. Therefore
it is wrong to visit it when looking for monitors owned by a thread.

Bug: 17377924

Change-Id: I7fddcdb9a554301e040c571971eec9be6cba5eda
65282b253b55bbdb7f0e246d8c78ea34f84d0ff5 22-Aug-2014 Xin Guan <a18772@motorola.com> Using the correct time for wait_start_ms when lock contention logging is enabled

Bug: 17208457
Change-Id: I35555e0acf3b37bb3776a62c64d59ae93403b237
(cherry picked from commit b894a19dfd668b6779de939cf5265b7e409d8809)
b894a19dfd668b6779de939cf5265b7e409d8809 22-Aug-2014 Xin Guan <a18772@motorola.com> Using the correct time for wait_start_ms when lock contention logging is enabled

Bug: 17208457
Change-Id: I35555e0acf3b37bb3776a62c64d59ae93403b237
956a5228276693a7317ae6b41bfe7a7f0f3cbe6b 16-Aug-2014 Andreas Gampe <agampe@google.com> ART: Do not recursively abort when visiting locks in a bad state

This avoids a nested abort in VisitLocks.

Bug: 17080621, 16382675

(cherry picked from commit 760172c3ccd6e75f6f1a89d8006934e8ffb1303e)

Change-Id: Id604976ac9dcac0e319fb25cab4d2cbc98d7ee24
760172c3ccd6e75f6f1a89d8006934e8ffb1303e 16-Aug-2014 Andreas Gampe <agampe@google.com> ART: Do not recursively abort when visiting locks in a bad state

This avoids a nested abort in VisitLocks.

Bug: 17080621, 16382675
Change-Id: Id604976ac9dcac0e319fb25cab4d2cbc98d7ee24
0ef3bd2a2334c0825130501bbabf6cbc8e870582 15-Aug-2014 Ian Rogers <irogers@google.com> Tidy up monitor comments.

Change-Id: Ib9d993f964ba6e2bec1979b486c26d3920a4a40c
6f22fc166ed6c11cad229bff442c064e704de101 15-Aug-2014 Ian Rogers <irogers@google.com> Make Monitor::Wait more robust to spurious Inflate failures.

Bug: 17062710
Change-Id: Ife5f6b335caacc70cab543cd568676d277d3beb6
43c69cc4cea794cd4d89d9d0680b1e25c6d02acc 15-Aug-2014 Ian Rogers <irogers@google.com> Make Monitor::Wait more robust to spurious Inflate failures.

Bug: 17062710
Change-Id: Ife5f6b335caacc70cab543cd568676d277d3beb6
(cherry picked from commit 6f22fc166ed6c11cad229bff442c064e704de101)
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
698d79d1e3f348102deaa03b5e0fc23641107239 25-Jul-2014 Andreas Gampe <agampe@google.com> ART: Clean up API after change 102631

This adds an abort_on_error parameter to GetCurrentMethod, which is
by default true. This restores all previous behavior, except for
monitor installation, where it follows 101639.

Bug: 16556938

(cherry picked from commit 6ec8ebd178ed39aa09e4c7fad194900114c4121a)

Change-Id: I2dee19d30674f2ffda33b3dc963e12470f39edb9
6ec8ebd178ed39aa09e4c7fad194900114c4121a 25-Jul-2014 Andreas Gampe <agampe@google.com> ART: Clean up API after change 102631

This adds an abort_on_error parameter to GetCurrentMethod, which is
by default true. This restores all previous behavior, except for
monitor installation, where it follows 101639.

Bug: 16556938
Change-Id: I9a12b9a21ccb9f558c86236bb58d15ff2fafaec0
38c488bcd41ba632a646d7a1d790ec71a2fcf6fa 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Recycle mem-maps for collector transitions.

We now create spaces when we need them for collector transitions or
homogeneous compaction by recycling mem maps. Change the bump
pointer space size to be as large as the heap capacity instead of
1/2 heap capacity like it used to be. For GSS, bump pointer spaces
are set to 32MB currently.

Changed GSS to have main space == non moving space since we don't
need to copy from the main space.

Fixes GC stress tests 074, 096.
Fixed test 080 oom throw with -Xmx2m for GC stress test, this was
broken since it was allocating a 4 MB array before starting the
OOM process.

Bug: 14059466
Bug: 16406852

(cherry picked from commit b363f666883860d40823d5528df3c98c897f74f4)

Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
b363f666883860d40823d5528df3c98c897f74f4 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Recycle mem-maps for collector transitions.

We now create spaces when we need them for collector transitions or
homogeneous compaction by recycling mem maps. Change the bump
pointer space size to be as large as the heap capacity instead of
1/2 heap capacity like it used to be. For GSS, bump pointer spaces
are set to 32MB currently.

Changed GSS to have main space == non moving space since we don't
need to copy from the main space.

Fixes GC stress tests 074, 096.
Fixed test 080 oom throw with -Xmx2m for GC stress test, this was
broken since it was allocating a 4 MB array before starting the
OOM process.

Bug: 14059466
Bug: 16406852
Change-Id: I62877cfa24ec944a6f34ffac30334f454a8002fd
f3d874c60ee3ada19ce26a5c4e532312b6f3a9e9 18-Jul-2014 Ian Rogers <irogers@google.com> Avoid race in single thread suspension.

Don't allow more than one concurrent single thread suspension to avoid
potential cycles and deadlocks where threads try to suspend each other.
Bug: 16364458, 16354227

Change-Id: I907f1d5591a6aa5c241d37d6b4a34f968f98df77
6093a5c277e54bcd949dd6fac7b3856e5f371d06 18-Jul-2014 Ian Rogers <irogers@google.com> Avoid race in single thread suspension.

Don't allow more than one concurrent single thread suspension to avoid
potential cycles and deadlocks where threads try to suspend each other.
Bug: 16364458, 16354227

(cherry picked from commit f3d874c60ee3ada19ce26a5c4e532312b6f3a9e9)

Change-Id: I907f1d5591a6aa5c241d37d6b4a34f968f98df77
b960cd7342cd68a614bb0c54d0d676cc2b8caf29 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Use sched_yield in Monitor::MonitorEnter.

Previously we used NanoSleep(1000), but this was unreliable. It could
result in waiting for >= 40ms instead of 1us. Since this was in a loop
it was especially bad if the GC was trying to suspend all the
threads when we were sleeping. This resulted in thread suspension
occasionally taking longer than a second.
Results on the provided picasso-sample app on Nexus 5:
Longest GC pause before: ~1.5s.
Longest GC pause after: <5ms.

Also added a warning if thread suspension takes longer than a
threshold (currently 5ms).

Bug: 16307460
External bug: https://code.google.com/p/android-developer-preview/issues/detail?id=367

(cherry picked from commit 251755cd511463260e60be98bf138b6aa1c14bf3)

Change-Id: I491c0799cc23ee6e68abc1bf77d1f0f4263e8ef5
251755cd511463260e60be98bf138b6aa1c14bf3 16-Jul-2014 Mathieu Chartier <mathieuc@google.com> Use sched_yield in Monitor::MonitorEnter.

Previously we used NanoSleep(1000), but this was unreliable. It could
result in waiting for >= 40ms instead of 1us. Since this was in a loop
it was especially bad if the GC was trying to suspend all the
threads when we were sleeping. This resulted in thread suspension
occasionally taking longer than a second.
Results on the provided picasso-sample app on Nexus 5:
Longest GC pause before: ~1.5s.
Longest GC pause after: <5ms.

Also added a warning if thread suspension takes longer than a
threshold (currently 5ms).

Bug: 16307460
External bug: https://code.google.com/p/android-developer-preview/issues/detail?id=367

Change-Id: I3c2a9636357e255f38634615101eff8ca84e632f
22d5e735f403c57525fe868304c7123f0ce66399 16-Jul-2014 Ian Rogers <irogers@google.com> Remove object_utils.h.

Break into object_lock, field_helper and method_helper.
Clean up header files following this.
Also tidy some of the Handle code in response to compiler errors when resolving
the changes in this CL.

Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
228602f562f1d130d06e60a98752d99c2d467d6a 10-Jul-2014 Ian Rogers <irogers@google.com> Make CAS operations in Object use art::Atomic.

Make naming consistent with art::Atomic.

Change-Id: If3abdb019ef8b53bd809e3fef3fd5248aeb27e9a
74240819ae09e29b2753ef38f4eb4be1c2762e2e 17-Apr-2014 Andreas Gampe <agampe@google.com> Use memory chunks for monitors on LP64

Monitor IDs in lock words are only 30b. On a 32b system that works
fine, as memory is usually aligned enough that shifting works out.
On 64b systems, the virtual memory space is too large for that.
This adds memory chunks into which we allocate the monitors so that
we have base_addr + offset and can use the offset as the monitor ID.
To allow for relatively compact but growable storage, we use a list
of chunks.

Added a global lock for the monitor pool.

Change-Id: I0e290c4914a2556e0b2eef9902422d7c4dcf536d
1af6a1fa35ff7dc0a5c653f19dbc8a91c914aa42 20-Jun-2014 Elena Sayapina <elena.v.sayapina@intel.com> ART: Update Monitor::Wait so it releases monitor_lock_ before throwing an exception

Thread should release monitor_lock_ Mutex (which guards shared structures behind Java monitor)
in Monitor::Wait before throwing any exception. Otherwise the thread may be suspended by GC
during that time still holding the lock. This may cause deadlock during GC in case
some other thread needs to acquire the monitor_lock_. The other thread can't be suspended
by GC then waiting for exclusive lock and "thread suspend timeout" occurs.

Change-Id: Id02f45052e1cfc01e676a43434125817564d7874
Signed-off-by: Elena Sayapina <elena.v.sayapina@intel.com>
48ab687d1f864fec93c2682de6fdc44ab784e2f8 24-Jun-2014 Mathieu Chartier <mathieuc@google.com> Add logging to monitor deflation.

Change-Id: I0251ff19e0a3c3b9edc7c7e296f15eb3229f8f7c
bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe 22-May-2014 Mathieu Chartier <mathieuc@google.com> Change MethodHelper to use a Handle.

Added ConstHandle to help prevent errors where you modify the value
stored in the handle of the caller. Also fixed compaction bugs
related to not knowing MethodHelper::GetReturnType can resolve types.
This bug was present in interpreter RETURN_OBJECT.

Bug: 13077697

Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
3035961cb41865b80b927546be0c708b6389cec6 22-May-2014 Hans Boehm <hboehm@google.com> Clean up and augment Atomic class. Replace QuasiAtomic MemBars.

Add a number of missing C++11 operations to Atomic class.
Invoke the 64 bit routines in QuasiAtomic when necessary.
Replace QuasiAtomic membars with fences that correspond to C++11 fences.

QuasiAtomic was moved to the top of the file. Only fence implementations
actually changed.

This replaces some buggy uses of MembarStoreStore, as reported
in b/14685856 .

Avoid some redundant fences for long volatile operations.

Incompletely converts low-level memory access operations to Atomic.

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
0cd81352a7c06e381951cea1b104fd73516f4341 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Fix an outstanding compaction bug in interpreter.""

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
46960fe5dcc1be07b39a55114338423a73554449 23-May-2014 Ian Rogers <irogers@google.com> Make the specification of when we need precise constants more precise.

Means that oatdump output showing values for deoptimization actually reflects
what we see at runtime.
Also, doesn't do precise in the case of determining methods and fields for the
quickened case, which may be an occasional performance win.

Change-Id: I62c7fb244f7996ba9d52e7a7ce75c046b663fa17
3bdb873122964da7937eb070cbcf2ef638a8e459 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Fix an outstanding compaction bug in interpreter."

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

Change-Id: I48036306130d5ccfec683d0dc3e9a642a02ee9c1
a6e7f0872c42009ecbee82d7fbe452deef9ae65b 22-May-2014 Mathieu Chartier <mathieuc@google.com> Move SetMonitorEnterObject outside of blocked thread state change.

Race condition:
Thread is suspended in monitor kBlocked, GC decides to run the
checkpoint on it. The GC sees that the object is non null, and goes
to mark it, but then the thread does SetMonitorObject(nullptr).
Which causes a null object to be marked.

Change-Id: Ie8a5074112947ec07d01ccb813ca2c1bb9ac7066
e09ae0920be57760fb390b6944bce420fa0b5582 15-May-2014 Mathieu Chartier <mathieuc@google.com> Fix an outstanding compaction bug in interpreter.

Fixed a bug in DoFieldPut where the FieldHelper GetType could cause
thread suspension which would result in a stale obj.

Added more handles in the class linker to facilitate moving fiels
and methods in the future.

Removed un-necessarly passing handle references since these are value
types and don't need to be passed by reference.

Added a special NullHandle type which allows null handles without a
handle scope.

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
4cba0d979a11f955e6ec3c0f1bf61478af7aa810 22-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Add a read barrier for weak roots in monitors.

A weak root requires a read barrier for the to-space invariant to hold
because the object pointed to by a weak root can't be marked/forwarded
like the one pointed to by a strong root (GC does not know if it's
alive or not at that point) and because, without a read barrier, a
mutator could access it and obtain a from-space reference, which would
violate the to-space invariant.

TODO: do similar for the other types of weak roots.

Bug: 12687968
Change-Id: I563a0fa4f875e0c21ac96f57696959454e13b15a
3e5cf305db800b2989ad57b7cde8fb3cc9fa1b9e 21-May-2014 Ian Rogers <irogers@google.com> Begin migration of art::Atomic to std::atomic.

Change-Id: I4858d9cbed95e5ca560956b9dabd976cebe68333
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
86ab7912423f63541073af5c487b509e9b2b5420 16-May-2014 Haifeng Li <omycle@gmail.com> ART: Fix Segment Fault with null owner while monitor logging is enabled

When the monitor inflates from thin to fat with the existing hashcode,
the owner is nullptr, which will cause segment fault with
owner->GetThreadId().

Change-Id: I90081d581a0ffd3d38763cc175fd2d7f66076747
a1ee14fc66a3c99bb7d5744ace881ec93c46f59d 15-May-2014 Mathieu Chartier <mathieuc@google.com> Fix race in inflating thin locks.

Before we were inflating the lock word in the blocked state, this
meant that the garbage collector could be running at this point
resulting in the lock word changing from underneath us.

Bug: 14881707
Change-Id: If8897b2572a1b29a3cf44e5eb2e11c186236f519
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
4d7f61d44a732cfbc8573e5d93364983fd746888 17-Apr-2014 Mathieu Chartier <mathieuc@google.com> Use non volatile lock words in semispace collector.

GSS FormulaEvaluationActions.EvaluateAndApplyChanges:
Before GC time: 9.1s
After GC time: 7.98s

Fixed timing logger errors.

Change-Id: I4193c6ccbbbe7a7220dfaabbf3472a5dcebae616
440e4ceb310349ee8eb569495bc04d3d7fbe71cb 01-Apr-2014 Mathieu Chartier <mathieuc@google.com> Add monitor deflation.

We now deflate the monitors when we perform a heap trim. This causes
a pause but it shouldn't matter since we should be in a state where
we don't care about pauses. Memory savings are hard to measure.

Fixed integer overflow bug in GetEstimatedLastIterationThroughput.

Bug: 13733906
Change-Id: I4e0e68add02e7f43370b3a5ea763d6fe8a5b212c
d803bc7ce255be6c16eaf6a8a58a742515e9da9f 02-Apr-2014 Ian Rogers <irogers@google.com> Fix ThreadStress, unify ANR lock descriptions.

Bug: 13323656
Change-Id: I902825a847af9aa570ed79701409298e3532bebf
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
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
e7e8a5fea2d852cccc840fa046151a16627f26cd 15-Feb-2014 Mathieu Chartier <mathieuc@google.com> Remove using mirror::* in jni internal.

Cleans up the code since it helps make it easier to spot moving GC
related bugs.

Also fixed moving GC bugs in MonitorEnter, and FindFieldID.

Change-Id: I794e4fbcc2010875fc6b299c6d4c9fb0f071b71a
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
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
b122a4bbed34ab22b4c1541ee25e5cf22f12a926 20-Nov-2013 Ian Rogers <irogers@google.com> Tidy up memory barriers.

Change-Id: I937ea93e6df1835ecfe2d4bb7d84c24fe7fc097b
5f51d4b80058236759fea1d932470a57f348c199 03-Dec-2013 Mathieu Chartier <mathieuc@google.com> Fix races in thread list Unregister.

First race:
We were releasing the thin_lock_id in Unregister before the thread
was not suspended. This could cause problems in
SuspendThreadByThreadId since there was a small window of time where
two threads could share the same thread id. This race caused an
occasional check failure in SuspendThreadByThreadId.

Second race:
We were setting the thin_lock_thread_id_ to 0 in Unregister before
waiting to not be suspended. This caused another race in
SuspendThreadByThreadId where we modified the thread suspend count,
busy waited, but didn't find the thread the next iteration. This
meant that we were returning null even though we had modified the
suspend count. This caused the suspend count to not get decremented
since the caller didn't know that the suspend count had been
increased. Removing the self->thin_lock_thread_id_ = 0 in
ThreadList::UnRegister fixes this race.

Added a bit of additional checks and logging to prevent these issues
from resurfacing, other misc cleanup.

Added thread names to threads in ThreadStress.

Bug: 11319866

Change-Id: I48e3a0700193b72079e450be1e924a2f88cf52e2
46bc778f1feed02b20d25e3d03470c93ca2c0506 13-Nov-2013 Mathieu Chartier <mathieuc@google.com> Fix portable + mips build.

Change-Id: Ia200e582b04c84973281e12331777351feb8a401
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
4e6a31eb97f22f4480827474b30b9e64f396eace 31-Oct-2013 Mathieu Chartier <mathieuc@google.com> Lazily compute object identity hash codes.

Before, we computed identity hashcodes whenever we inflated a monitor.
This caused issues since it meant that we would have all of these
hash codes in the image, causing locks to excessively inflate during
application run time.

This change makes it so that we lazily compute hash codes. When a
thin lock gets inflated, we assign a hash code of 0 assigned to it.
This value signifies no hash code. When we try to get the identity
hash code of an object with an inflated monitor, it gets computed if
it is 0.

Change-Id: Iae6acd1960515a36e74644e5b1323ff336731806
9728f91a63016136261231ff5213bde703bd27b6 30-Oct-2013 Mathieu Chartier <mathieuc@google.com> Add missing null check in monitor install.

Fixes broken OTA.

Change-Id: I3a89e4755dc6b23d214ec542df3d167e788b904d
ad2541a59c00c2c69e8973088891a2b5257c9780 25-Oct-2013 Mathieu Chartier <mathieuc@google.com> Fix object identity hash.

The object identity hash is now stored in the monitor word after
being computed. Hashes are computed by a pseudo random number
generator.

When we write the image, we eagerly compute object hashes to
prevent pages getting dirtied.

Bug: 8981901

Change-Id: Ic8edacbacb0afc7055fd740a52444929f88ed564
13c479e7e9b62115fe0409e5273c1e976a1c09f9 11-Oct-2013 Ian Rogers <irogers@google.com> Notify doesn't inflate, rename helper.

Change-Id: I85c93b522478b3116a66630856a2370ec0fda490
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
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
6aa3df965395566ed6a4fec4af37c2b7577992e9 18-Sep-2013 Mathieu Chartier <mathieuc@google.com> Refactor system weak sweeping, add support for modification.

Required for moving collectors.

Change-Id: Ib97ba4a05af1139f8d388077a15e62bcb9534855
049e7a35366937b1b7b28afcaccc88c0c69ea3ec 11-Sep-2013 Ian Rogers <irogers@google.com> Tweak an unusual monitor log message.

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

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

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

Needed to update cpplint to handle const auto.

Fixed a few cpplint errors that were being missed before.

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

Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
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
7934ac288acfb2552bb0b06ec1f61e5820d924a4 26-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/comments issues

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