History log of /art/runtime/thread_list.cc
Revision Date Author Comments
4531aae45b32e33481352613d6017916147f1b6d 02-Nov-2017 Christopher Ferris <cferris@google.com> Re-enable dumping unattached threads.

Bug: 31666428

Test: Ran unit tests, kill -3 on bluetooth process.
Change-Id: I8db4923278a9302ab83ff53e61549b63bac67ec8
9b827ab7e63cf8b24987e75186434348d0dbf4e8 08-Dec-2017 Andreas Gampe <agampe@google.com> ART: Clean up ATRACE use

Remove old ATRACE_BEGIN & _END pairs, where possible. Remove
ATRACE_CALL and replace it with ScopedTrace.

Remove utils/Trace.h include.

Test: m
Change-Id: I3a5123202f4e373074bfe0f7359ee6c60a70352a
39b378ca3b4b6dc6da1651b84ee4289cd9bff0f8 08-Dec-2017 Andreas Gampe <agampe@google.com> ART: Factor out gAborting

Cut dependencies on base/logging.h by moving gAborting to its
own header. Leave the static storage in logging.cc.

Test: m
Change-Id: Ib2ca880e15f9cb50cb9aab803784826bb46efb5e
767d0397b07e3f1e75c4fd754632e73369b9399e 09-Nov-2017 Mathieu Chartier <mathieuc@google.com> Increment gAborting for UnsafeLogFatalForThreadSuspendAllTimeout

Increment gAborting before doing the thread list dump since we don't
want any failures from AssertThreadSuspensionIsAllowable in cases
where thread suspension is not allowed.

Bug: 69044468
Test: m

Change-Id: I87d09f07fa8379fb121ced5c2086d1de78c6eec6
446c6b240dadab9893e4dc0a4b81ba284da3bafa 09-Nov-2017 David Sehr <sehr@google.com> Comment lack of return check on usleep

As the usleep calls used in thread_list are during shutdown and other
non-correctness related locations, add a comment to that effect.

Bug: 29527582
Test: make -j 50 test-art-host
Change-Id: I9c72564a13e28db6681b21d676a62f63ba052937
b1b0ed2b2889d42dcf800a3bdfe734759909482d 25-Oct-2017 Christopher Ferris <cferris@google.com> Use the backtrace interface to skip java maps.

This has no effect until the new unwinder is used. When the new
unwinder is enabled this will have nearly the same behavior as the
old unwinder. The difference is that the old unwinder ignored the
minidebug information (compressed section data) completely. The new
unwinder will not ignore minidebug information in system libraries,
it will only ignore them in .oat or .odex maps.

There will be a small difference between the new and old unwinder. The
new unwinder when dumping in an ANR trace file looks like this:

native: #00 pc 0000000000069abc /system/lib64/libc.so (__epoll_pwait+8)
native: #01 pc 000000000001feb4 /system/lib64/libc.so (epoll_pwait+52)
native: #02 pc 0000000000015cec /system/lib64/libutils.so (android::Looper::pollInner(int)+144)
native: #03 pc 0000000000015bcc /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+108)
native: #04 pc 0000000000110d98 /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
at android.os.MessageQueue.nativePollOnce(Native method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6569)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)

The old unwinder looks like this:

native: #00 pc 0000000000069abc /system/lib64/libc.so (__epoll_pwait+8)
native: #01 pc 000000000001feb4 /system/lib64/libc.so (epoll_pwait+52)
native: #02 pc 0000000000015cec /system/lib64/libutils.so (android::Looper::p
ollInner(int)+144)
native: #03 pc 0000000000015bcc /system/lib64/libutils.so (android::Looper::p
ollOnce(int, int*, int*, void**)+108)
native: #04 pc 0000000000110d98 /system/lib64/libandroid_runtime.so (???)
native: #05 pc 00000000001d1e1c /system/framework/arm64/boot-framework.oat (J
ava_android_os_MessageQueue_nativePollOnce__JI+140)
at android.os.MessageQueue.nativePollOnce(Native method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6569)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.jav
a:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)

Test: kill -3 of android process.
Change-Id: If9d282d1a7a303c4f2af296bd98b1994b9bc2660
373a9b5c718a45ac484afcf4fe6ce84f4bb562b3 18-Oct-2017 Andreas Gampe <agampe@google.com> ART: Depend on libnativehelper headers only

Depend on header-only versions where possible. Move projects
excluding libart to libnativehelper_header_only.

Bug: 65522645
Test: mmma art
Change-Id: I53dd3b2a97e94ee685f72de007ed3858f7f5c6b6
8cf9cb386cd9286d67e879f1ee501ec00d72a4e1 19-Jul-2017 Andreas Gampe <agampe@google.com> ART: Include cleanup

Let clang-format reorder the header includes.

Derived with:

* .clang-format:
BasedOnStyle: Google
IncludeIsMainRegex: '(_test|-inl)?$'

* Steps:
find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup'
git-clang-format -style=file HEAD^
manual inspection
git commit -a --amend

Test: mmma art
Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
e431e2758d62cf56f7f347f5a8c9d79e41b6dcd7 19-Jul-2017 Steven Moreland <smoreland@google.com> art: use proper nativehelper headers

libnativeheader exports headers under nativeheader. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using art find headers
Bug: 63762847
Change-Id: I5c820d677e94e07b2859e78610bc997fe51b41dc
88fd720b6799184c8ad61e766a6d37af33ed30ef 30-Jun-2017 Alex Light <allight@google.com> Add Jvmti Suspend/ResumeThread functions

Enable the can_suspend jvmti capability and implement all required
functionality associated with it.

Test: ./test.py --host -j40
Bug: 34415266
Bug: 62821960
Bug: 63579748

Change-Id: I83b92de7f81622e1658114b034918e8295805b6e
46f9340f2a055a8fdfebbfbb739c697c20d83e7c 29-Jun-2017 Alex Light <allight@google.com> Add SuspendReason enum and change Suspension functions.

More self-documenting and more type safe.

Bug: 62821960
Test: ./test.py
Change-Id: Ic7a1ae6a25e687d65f5aa10c1aad54a7b80dd086
5544e721c3e2a3e344c26b9e1c9ad9472fb8cd58 06-Jun-2017 Andreas Gampe <agampe@google.com> ART: Replace some '\n' with std::endl

Induce flushing the ostreams at strategic points to improve
log visibility.

Bug: 62337922
Test: m test-art-host
Change-Id: Ic4b4c698b568575b55160fff0ad5c31fa6b4018a
ae4c845b2aadc1e5bc098d54f1ba4914096b9c83 02-Jun-2017 Mathieu Chartier <mathieuc@google.com> Revert "Change thread suspend timeout to be fatal for non-debug"

For overloaded systems, 10s might not be enough. Infinite seconds
will be though.

Bug: 37221387

Test: test-art-host

This reverts commit d69f82e155118654d989f0b436c019fb6d517341.

(cherry picked from commit 111b0e05d130d345857ad875be484e3839ce25d4)

Change-Id: Id17d94c71360f5de3bb67eb22d05e148dd5238d3
111b0e05d130d345857ad875be484e3839ce25d4 02-Jun-2017 Mathieu Chartier <mathieuc@google.com> Revert "Change thread suspend timeout to be fatal for non-debug"

For overloaded systems, 10s might not be enough. Infinite seconds
will be though.

Bug: 37221387

Test: test-art-host

This reverts commit d69f82e155118654d989f0b436c019fb6d517341.

Change-Id: I8ac0e13e6bdae1845803682215e1794d892de8e5
513061a792b22c417c938d31c19581390709561c 01-Jun-2017 Andreas Gampe <agampe@google.com> ART: Clean up thread.h and thread_list.h

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

Test: m test-art-host
Change-Id: I01286c43d8c7710948c161b1348faabb05922e59
d49012909625c3bf87bf51138fe79315ce1b1bdc 31-May-2017 Andreas Gampe <agampe@google.com> ART: Clean up heap headers

Use more forward declarations for accounting structures and spaces.
Factor out structs to reduce header surface. Remove heap include where
unnecessary. Fix up transitive users. Move some debug-only code out
of line.

Test: m test-art-host
Change-Id: I16db4aaa803f39e155ce6e1b0778b7e393dcbb17
6e6444508de1afaeaf612970fad608b58b89b009 10-May-2017 Andreas Gampe <agampe@google.com> ART: Make GC Pause Listener more precise

Refactor code to call the listener in FlipThreadRoots, after all
threads have been suspended.

Bug: 37283268
Test: m test-art-host
Change-Id: I313db07e014e65a997d0b58c8a70e4505425def0
3768adec2f819cb506577618fdde158ba659ddd4 02-May-2017 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add concurrent card graying for immune spaces""

Added an additional checkpoint before the concurrent graying to set
the mark entrypoints to non-null.

Bug: 37876887

Test: test-art-host

This reverts commit c83dd7bfde2171c879efb92a31a363505385ffb9.

Change-Id: I961c4631c9595c52cd7765f61b22b8291fef2088
c4bed16daa6689eaa2148261b19662291417ced6 01-May-2017 Andreas Gampe <agampe@google.com> ART: Change shutdown order

Add explicit Shutdown method to ThreadList, doing the work that
was previously in the destructor. Call sid method before unloading
plugins and stopping the debugger.

Modulo daemon threads, this ensures that thread events will have
quiesced when plugins stop.

Bug: 37763974
Test: m test-art-host
Change-Id: I11d22f2c89a68e9f6720d61967b8e5aea41188dc
1c8f4ff04062407db3d2dd834dd6bc24f6662c4d 14-Apr-2017 Sebastien Hertz <shertz@google.com> Always check result of Thread::ModifySuspendCount

Ensures that we never ignore the result of ModifySuspendCount so that
we can react if the suspend count is not updated as expected.

This CL does the following:
* Adds __attribute__((warn_unused_result)) on the method to raise an
error at compilation time if the result is ignored.
* Wraps calls with DCHECK where the result used to be ignored.

Bug: 27385848
Test: make -j test-art-host
Test: art/tools/run-jdwp-tests.sh --mode=host --variant=X64
Change-Id: I2d0e1ab7158c70ec8076c8bae6e4b814aee75af6
d69f82e155118654d989f0b436c019fb6d517341 21-Mar-2017 Mathieu Chartier <mathieuc@google.com> Change thread suspend timeout to be fatal for non-debug

Right now it just loops forever and doesn't give any stack traces
regarding probable deadlocks.

Bug: 36408743

Test: test-art-host

Change-Id: Ib8919f4be540291d8226dd0e7eb88c7faf7cdde9
a222404a5832ab16786931576d52825d08eed3ca 09-Feb-2017 Hiroshi Yamauchi <yamauchi@google.com> Fix the empty checkpoint timeout.

The problem happens when a thread is indirectly blocked on a mutex
that another thread holds and is blocked on a weak ref access.

Add a way to do a dummy wakeup on a thread that's blocked on a mutex
so that the thread will respond to the empty checkpoint request. Do
this for the mutexes that are expected to be held when a weak ref is
accessed. Add a check that detects an unexpected case.

Bug: 33006388
Bug: 12687968
Test: test-art-host.
Change-Id: Iefec69b9a21aa25a928cb31fcf4fb872f867a8c2
e9429c8c5f8c5541dcbe97e03c55cba175bce182 28-Jan-2017 Mathieu Chartier <mathieuc@google.com> Add to time to suspend in FlipThreadRoots to histogram

Add the time to suspend to the suspend_all_historam_ to determine if
GC pauses are caused by GC or bad mutator activity.

Also exclude ThreadFlipBegin time being counted as paused since it
happens before threads are suspended.

Test: test-art-host

Change-Id: Ia55db0ebbdc7ba6f23d7212c0e42c7806b297c2b
3fceaf500d570722122f2d092f302d27769e3a51 22-Jan-2017 Mathieu Chartier <mathieuc@google.com> Use higher default thread suspend timeout for run tests

Increase the default for tests from 10s-50s to 500s. This is done
by adding a run-test option "--suspend-timeout" that defaults to
500000.

Example when passing a low value of 100:
test/run-test --host --suspend-timeout 100 --dev 004-ThreadStress

Results in:
dalvikvm32 F 01-22 13:33:31 12067 12118 thread_list.cc:669] Timed
out waiting for threads to suspend, waited for 100.114ms

This should fix some of the recent test flakiness.

Test: test-art-host

Change-Id: I303c4f198e560e9f38ec375e9d7a80a5e61f776e
32c8337f9fcb8e7026b7ee67dc4ff3e1ca74830e 11-Jan-2017 Mathieu Chartier <mathieuc@google.com> Increase thread suspension timeout for debug builds

The current timeout may be causing some test failures. Also print how
long we waited.

Test: test-art-host -j32

Change-Id: Ib8a9c68ab4571efc8456c098b03bf35f648bfaf1
35af2ad461e9745252bdc2c1c5a0cad1386626d4 23-Dec-2016 rock.yeh <app1_test@weckout.com> Use relative futex timeout in SuspendAllInternal.

This erroneously used an absolute timeout for FUTEX_WAIT, potentially
causing it to block for MUCH longer than 10 seconds.
http://man7.org/linux/man-pages/man2/futex.2.html
Note: for FUTEX_WAIT, timeout is interpreted as a relative value.

Error case:
kernel time: 15842.476344
nsec: 31694950164731
12-22 20:25:48.020043 0 0 F [15842.476344][HeapTaskDaemon:3008]
futex_wait 00000070fcdf8980 1 1 31694950164731

Normal case:
kernel time: 15842.476344
nsec: 15842476344

Block backtrace:
"HeapTaskDaemon" sysTid=3008
#00 pc 000000000001bcac /system/lib64/libc.so (syscall+28)
#01 pc 0000000000461db0 /system/lib64/libart.so
(_ZN3art10ThreadList18SuspendAllInternalEPNS_6ThreadES2_S2_b+720)
#02 pc 000000000046249c /system/lib64/libart.so
(_ZN3art10ThreadList10SuspendAllEPKcb+532)
#03 pc 00000000001e8fc8 /system/lib64/libart.so
(_ZN3art2gc9collector9MarkSweep9RunPhasesEv+232)
#04 pc 00000000001e1694 /system/lib64/libart.so
(_ZN3art2gc9collector16GarbageCollector3RunENS0_7GcCauseEb+332)
#05 pc 0000000000211500 /system/lib64/libart.so
(_ZN3art2gc4Heap22CollectGarbageInternalENS0_9collector6GcTypeENS0_7Gc
CauseEb+3048)
#06 pc 0000000000218acc /system/lib64/libart.so
(_ZN3art2gc4Heap12ConcurrentGCEPNS_6ThreadEb+124)
#07 pc 000000000021fbf4 /system/lib64/libart.so
(_ZN3art2gc4Heap16ConcurrentGCTask3RunEPNS_6ThreadE+36)

This is a fix patch log and each timeout log interval of 10 seconds:
12-27 03:27:46.153744 1631 1713 E art : Unexpected time out during
suspend all.
12-27 03:27:56.154401 1631 1713 E art : Unexpected time out during
suspend all.
12-27 03:28:06.154956 1631 1713 E art : Unexpected time out during
suspend all.
46ee31b67d7ee1bd085fbc240502053caa3cf8fa 14-Dec-2016 Andreas Gampe <agampe@google.com> ART: Move to libbase StringPrintf

Remove ART's StringPrintf implementation. Fix up clients. Add
missing includes where necessary.

Test: m test-art-host
Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
585da955bc8e5040705dcfd941b2131025ebcef8 02-Dec-2016 Andreas Gampe <agampe@google.com> ART: Add precise root visiting

Add VisitRootFlags::kVisitRootFlagPrecise to signal a
request for precise RootInfo objects.

Move VisitRootFlags to gc_root.h. Refactor VisitRoot
functions to pass flags. Add code in Thread visiting
to decode vregs in compiled code.

Bug: 31385354
Test: m test-art-host
Change-Id: I8e7280f0ab682871f729f2a1c6b18670cf2dbf82
a82769c1168d38fb4d36eaecfc186aecb17d4b16 03-Dec-2016 Hiroshi Yamauchi <yamauchi@google.com> Dump more debug info for b/33006388.

Bug: 33006388
Bug: 12687968
Test: test-art-host with CC.
Change-Id: Id9d67bc603c6ff7bc8e346e181e3e09ffbda43b3
fe814e89965ddf9a8b603863bd28259f8dd7be35 09-Nov-2016 Mathieu Chartier <mathieuc@google.com> Use entrypoint switching to reduce code size of GcRoot read barrier

Set the read barrier mark register entrypoints to null when the GC
is not marking. The compiler uses this to avoid needing to load the
is_gc_marking boolean.

Code size results on ritzperf CC:
arm32: 13439400 -> 13242792 (-1.5%)
arm64: 16380544 -> 16208512 (-1.05%)

Implemented for arm32 and arm64. TODO: Consider implementing on x86.

Bug: 32638713
Bug: 29516974

Test: test-art-host + run ritzperf
Change-Id: I527ca5dc4cd43950ba43b872d0ac81e1eb5791eb
3049324f4ef71b5d7a3de49bd77c75f07dbf8f3a 03-Nov-2016 Hiroshi Yamauchi <yamauchi@google.com> Make empty checkpoint work while weak ref access is disabled.

Fix a potential race on PushOntoMarkStack for CC by running an empty
checkpoint (while weak ref access is disabled).

Bug: 32508093
Bug: 12687968
Test: test-art-host with CC/CMS, libartd boot with N9, Ritz EAAC.
Change-Id: I3749bb525e7734804307ee16262355f3fc730312
3f386d55f7e37eaefa828a55c8aa8c4f8788e6cf 05-Oct-2016 Mathieu Chartier <mathieuc@google.com> Allow early abort logging

Print unattached threads with native stack traces for early abort.

Bug: 31855501

Test: test-art-host -j32
Test: thread_list_->Dump in Runtime::Start.
Change-Id: I5364625e798356c4fa1f88a8c646e374e59d93b0
02e7f1a46d8dbb277d045182cd1fa4b058d55162 04-Oct-2016 Hiroshi Yamauchi <yamauchi@google.com> Fix a deadlock between thread flip and suspend request.

See 31683379#9 for the deadlock scenario.

Make ModifySuspendCount(+1) retry if the thread flip function is set.

Bug: 31683379
Bug: 12687968
Test: test-art, N9 libartd boot, Ritz EAAC with CC.
Test: 129-GetThreadId with gcstress and CC.
Change-Id: Id5cdfcd90a08a2ff497f9f0e2842fa4c613549bc
0795f23920ee9aabf28e45c63cd592dcccf00216 28-Sep-2016 Mathieu Chartier <mathieuc@google.com> Clean up ScopedThreadStateChange to use ObjPtr

Also fixed inclusion of -inl.h files in .h files by adding
scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h

Changed AddLocalReference / Decode to use ObjPtr.

Changed libartbenchmark to be debug to avoid linkage errors.

Bug: 31113334

Test: test-art-host

Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
15af34cc172d9ae652da35a864190585cb6717a6 27-Sep-2016 Hiroshi Yamauchi <yamauchi@google.com> Fix a CC deadlock in 129-ThreadGetId.

GC should consider a thread as "waiting for GC thread flip" or
"transitioning to runnable" only if its suspend count is 1.

See 31683379#7 for the deadlock scenario.

Bug: 31683379
Bug: 12687968
Test: test-art with CC and gcstress, N9 libartd boot, Ritz EAAC.
Change-Id: Icd2548bd6d9a4f8d7b54ed20150a4801af9e26a3
d6e54bbc09595465309aa7909b7a3965defe4419 26-Sep-2016 Andreas Gampe <agampe@google.com> ART: Fix nits

Follow-up to commit 3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0.

Bug: 31338270
Test: m test-art-host
Change-Id: Ia50f450bef144167b946224c26242c529302996e
3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0 13-Sep-2016 Andreas Gampe <agampe@google.com> ART: Use libbase logging

Move most of our logging infrastructure over to system/core/base.
Retain VLOG.

Using unified Android infrastructure has two main advantages. First,
it reduces the complexity/maintenance burden in ART. Second, it
allows to detach logging for the cases where we do not want or need
a runtime, e.g., dexdump, the disassembler, etc. As a part of the
latter, libbase is also supported for all hosts (including Windows).

From a developer viewpoint, there are minor behavior changes for the
LOG statements (see above), but otherwise usage is the same. Explicit
severity enum items are in the android::base namespace now.

Bug: 31338270
Test: m test-art-host
Change-Id: I5abcb2f45f5b03d49951874c48544f72a283a91b
febd0cf9b5070ecc54ba433b951b65e14a54ccde 15-Sep-2016 Hiroshi Yamauchi <yamauchi@google.com> Fix a deadlock in the CC collector.

Fix a deadlock between CC GC disabling system weaks and thread attach.

See 31500969#2 for more details.

Bug: 31500969
Bug: 12687968
Test: test-art-host with CC. N9 libartd boot. Ritz EAAC.
Change-Id: Ic9a8bfb1c636643a03f4580b811fe890273576b6
ee23582af60b36f982de2ad16f485a61f35ae817 20-Aug-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "Revert "Improve the thread flip.""

This reverts commit db3204f87c3f7c4de89762ce9e8502a9dc25c2d8.

Improve the thread flip.

- In addition to the threads that are suspended in FullSuspendCheck(),
prioritize the resume of threads that are blocking for the thread
flip at the JNI critical section entry and threads are about to
transition to runnable (eg. blocking at the SOA entry from JNI).
- Shorten the length of the thread flip critical
section (ThreadFlipBegin/End).
- Add some systrace scopes.
- Add a read barrier for the locked objects during the thread dump in
case the thread is in the middle of flipping.

Bug: 30980189
Bug: 29517059
Bug: 12687968
Test: test-art-host, Ritz EAAC, N9 libartd boot
Change-Id: I3a903c47c0fcc746664ec376cc31dee8af3c3ecb
db3204f87c3f7c4de89762ce9e8502a9dc25c2d8 19-Aug-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "Improve the thread flip."

This reverts commit e61e6fdd404b8f04bd33fc3ea49e38e92e31ad69.

ThreadStress failing.

Bug: 29517059
Bug: 12687968
Change-Id: I0ee8ef04f77c5f9378e4bd21c5dedb4e435a2dc6
e61e6fdd404b8f04bd33fc3ea49e38e92e31ad69 03-Aug-2016 Hiroshi Yamauchi <yamauchi@google.com> Improve the thread flip.

- In addition to the threads that are suspended in FullSuspendCheck(),
prioritize the resume of threads that are blocking for the thread
flip at the JNI critical section entry and threads are about to
transition to runnable (eg. blocking at the SOA entry from JNI).
- Shorten the length of the thread flip critical
section (ThreadFlipBegin/End).
- Add some systrace scopes.

Bug: 29517059
Bug: 12687968
Test: test-art-host, Ritz EAAC, N9 libartd boot.
Change-Id: Idecec9936ae432c23d5f83321ba13339852018df
5dd44d0da7999ab62f09a1bf03345280811736d4 03-Aug-2016 Andreas Gampe <agampe@google.com> ART: Factor out native stack dumping

Move DumpNativeStack and DumpKernelStack into a new file to keep
concerns separated. Clean up the file.

In preparation for modifications to how we use addr2line.

Bug: 30351473
Test: m test-art-host
Test: manual host testing with a test that times out
Change-Id: I02d5645952fe94fd8e73bcf0522721547f6cef66
d778cd68c5d093c2fb95f91608deb36fea8e8bad 05-Jul-2016 Vladimir Marko <vmarko@google.com> Expect spurious wake-up from futex(2)/FUTEX_WAIT call.

Test: Run standard ART test suite.
Bug: 27913630
Change-Id: I742544f7a0a7f896e47293d209a874782577e971
aa45daaddee752fcc7f1e5b0e207748bc6bed0a4 20-Jun-2016 Nicolas Geoffray <ngeoffray@google.com> Release the thread_list lock while waiting for daemons.

Daemons might be in a state where they are actually waiting for
it (for example Thread.isInterrupted). If the shutdown thread
doesn't release the lock, such daemon cannot make progress.

bug:27353286
Change-Id: Ib7f4c7d1b56d73a829d01d5bfc0ab663fbb80b46
d0b1dac94230c5e91639011e28160f34cc39c53e 11-Jun-2016 Mathieu Chartier <mathieuc@google.com> Use ScopedObjectAccess in ThreadList::Dump

Prevent deadlocks if two different threads are calling Dump at the
same time:

Thread 1: Requests thread 2 to suspend
Thread 2: Requests thread 1 to suspend
Both threads are suspended and blocked on ScopedObjectAccess in
thread dumping.

Added to suspend all stress, reduced thread count to 4 temporarily
since this is the maximum number of simultaneous checkpoints.

Bug: 28988206
Bug: 26118154

(cherry picked from commit e99f53203904c23a26e53ca1bf6a4e45814146fe)

Change-Id: I9e4b8391ebad0bca0e42a03819c58c99ddba6b35
f8a86b9ecefecae8bc0e456d540dae115249fdb6 15-Jun-2016 Mathieu Chartier <mathieuc@google.com> Visit invalid roots of only suspended threads

Since this always happens with suspended threads or self, you can
just visit these threads and do not require a suspend all. This
will not miss any roots if the caller was marking a thread root.

Fixes issues like transitioning to suspended and back blocking on a
thread suspension request from another thread. This could cause
deadlocks previously.

Bug: 29062271

Change-Id: I2fef149387aacf0cdc9a773d4f172c42fa53e4dc
a3e8fc3aabc122dc4a324f15925741dccda2641c 14-Jun-2016 Andreas Gampe <agampe@google.com> ART: Turn off unattached thread dumping

May be responsible for lack of ANR dumps in some situations.

Bug: 29248079
Change-Id: Ib742c063b1d77216eddfbf4392d17d024e028bf8
e99f53203904c23a26e53ca1bf6a4e45814146fe 11-Jun-2016 Mathieu Chartier <mathieuc@google.com> Use ScopedObjectAccess in ThreadList::Dump

Prevent deadlocks if two different threads are calling Dump at the
same time:

Thread 1: Requests thread 2 to suspend
Thread 2: Requests thread 1 to suspend
Both threads are suspended and blocked on ScopedObjectAccess in
thread dumping.

Added to suspend all stress, reduced thread count to 4 temporarily
since this is the maximum number of simultaneous checkpoints.

Bug: 28988206

Change-Id: I9e4b8391ebad0bca0e42a03819c58c99ddba6b35
bb661c0f0cb72d4bbfc2e251f6ded6949a713292 04-Apr-2016 Bilyan Borisov <bilyan.borisov@linaro.org> Refactor use of __ANDROID__ macro

We use the __ANDROID__ macro, which is provided by the toolchain, in
numerous places. This patch refactors the usage of this by defining a
new macro, ART_TARGET_ANDROID, that is being passed during build to
ART_TARGET_CFLAGS in Android.common_build.mk on the same line as
ART_TARGET. The codebase currently assumes that the existence of the
__ANDROID__ macro implies that we are compiling art for an android
target device. This is because, currently, target builds are compiled
with target toolchains that provide the macro, while host toolchains
do not. With this change this assumption is still preserved. However,
in a future patch we will add the ability to compile art for a linux
target, and in that case the ART_TARGET_ANDROID macro won't be passed
anymore.

Change-Id: I1f3a811aa735c87087d812da27fc6b08f01bad51
61b3cd45c5e3a5c24f7ccce94843a718375f9b7a 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

(cherry picked from commit 81c170fede9af9174aba71428334ac8f366a4b4f)

Change-Id: I15e50b699303a5c3739e4d19c153dd306e2ee504
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
d3c59658faf9aaeb49cf63d928cead324f14bd8a 17-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Check GetDumpNativeStackOnSigQuit() for daemons.

The flag is passed by run-test to avoid libunwind crash flakiness,
so we should check it when dumping threads.

Change-Id: I3a3fcfd80ab254a315d58d629c81161fea9900dc
b9d4f999773754ab4e84496edf60af60b05119de 01-Mar-2016 Andreas Gampe <agampe@google.com> ART: Allow unwinding unattached threads

Partial revert of commit ed8b723c5f3989d2593ec21c65c96d6d8bf25579.

Make it (constexpr) configurable whether we allow unwinding native
stacks of unattached threads.

Bug: 27449879

(cherry picked from commit 8d1594da6e97cd11580baf30ee4b75d4e7e2616a)

Change-Id: Iad3f3dde63155993bb4efb7bbbbde3e36f1379cc
8d1594da6e97cd11580baf30ee4b75d4e7e2616a 01-Mar-2016 Andreas Gampe <agampe@google.com> ART: Allow unwinding unattached threads

Partial revert of commit ed8b723c5f3989d2593ec21c65c96d6d8bf25579.

Make it (constexpr) configurable whether we allow unwinding native
stacks of unattached threads.

Bug: 27449879

Change-Id: I307a80c9a0166f33fa8a41e492d7eb0d77d0e44f
47c1959f0c78eaf6ab17e1b80fa3ce9643e55849 07-Mar-2016 Mathieu Chartier <mathieuc@google.com> Increase kDumpWaitTimeout 10x for target builds

New timeout is 100s, the old one was occasionally hit by overloaded
device. This caused a confusing crash in the barrier destructor
since not all the threads had went through the barrier yet.

Bug: 27334917

(cherry picked from commit 74bdab0b14c592053ff71654ab51a0f116114a42)

Change-Id: I24cf6eb6858ad93a47446aa6bbc18942a71b191e
74bdab0b14c592053ff71654ab51a0f116114a42 07-Mar-2016 Mathieu Chartier <mathieuc@google.com> Increase kDumpWaitTimeout 10x for target builds

New timeout is 100s, the old one was occasionally hit by overloaded
device. This caused a confusing crash in the barrier destructor
since not all the threads had went through the barrier yet.

Bug: 27334917
Change-Id: I5bcdaa39cfc104f3555f62b6117b417c8bf36e7a
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
0c659394d1ee74d28157c42656b31ea48cb54f8b 02-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Allow unwinding unattached threads"

This reverts commit f7286721a51c772b2abb42fef5bc0d2548df2372.

Change-Id: I6c96ece063041e94d40a96bdd054f89cd7875ade
f7286721a51c772b2abb42fef5bc0d2548df2372 01-Mar-2016 Andreas Gampe <agampe@google.com> ART: Allow unwinding unattached threads

Partial revert of commit ed8b723c5f3989d2593ec21c65c96d6d8bf25579.

Make it (constexpr) configurable whether we allow unwinding native
stacks of unattached threads.

Change-Id: Ibb1fd0956fb796583f78ec9c3a74521f6fbe96d9
a73280df8cac1279b6dea0424722f42ef0048613 15-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Add an option to disable native stack dumping on SIGQUIT.

Some of our (stress) run-tests do ANR dumping, which end up
stressing libunwind, that has known problems. To avoid getting
flakes due to libunwind, disable native stack dumping on SIGQUIT
for our run-tests.

bug:27185632
bug:24664297
Change-Id: I69085e48db903d6240448d71666ae2dcd091922e
fbc31087932a65e036a153afab3049dc5298656a 24-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Load app images""

This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.

Bug: 22858531

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

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

Bug: 22858531

This reverts commit f7fd970244f143b1abb956e29794c446e4d57f46.

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

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

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

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

Bug: 22858531

Change-Id: I9cbc645645e62ea2ed1ad8e139e91af7d88514c1
59a8c0bb74c353f879760bd6522b49cf7298666e 20-Jan-2016 tony.ys_liu <tony.ys_liu@htc.com> Use current pid not tid to create a backtrace map.

The BacktraceMap::Create() function assumes that the passed in
parameter is the current pid not tid. If a tid is passed in, then
the logic that creates the local map in libunwind is not used
and can bypass all of the special handling of local maps. The result
can be crashes if this map data gets out of sync with the real maps
found in the process.

Bug: 26676205
Bug: https://code.google.com/p/android/issues/detail?id=199219
Change-Id: Ibab9f7a7b99648a2cdaa185958bf6ffc368079ce
62597d1dc4e62d36addcc2f1c452cbd6f565a420 11-Jan-2016 Mathieu Chartier <mathieuc@google.com> Add sleep in SuspendAllDaemonThreadsForShutdown

Only sleep if there are still daemon threads. Since we have already
shutdown the runtime daemons, this is a rare case. The goal of the
sleep is to leave daemon threads time to become blocked in a place
where they ideally will not touch runtime state.

Bug: 26483935
Bug: 18577101

Change-Id: Iad12209e771720523620e0a3829a75ec4647f58b
ba098bafdc4bd6dc6fc85f2996fa9f2d9be051bf 07-Jan-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Reduce sleep duration in SuspendAllDaemonThreads""

Fixed the error where I reduced the time until the warning by 10x.

Bug: 26351700

This reverts commit bc34a7ed232cb3d384c250578e2b4ede45f2b167.

Change-Id: I6b30a0711fe077421665b78c39ded88899407700
4d87df607a0b86cdf4b2c04f61d72a60d8975ce0 08-Jan-2016 Mathieu Chartier <mathieuc@google.com> Improve handling of daemon threads after runtime shutdown

The main issue comes from the fact that user daemon threads are
allowed to continue running after the runtime has shutdown. They may
still have a JNI env pointer. To prevent crashing if they call into
the env, we replace the function pointers with functions that sleep
forever.

The other issue is that user daemon threads that are blocked in an
ART condition variable may get woken up by another user daemon inside
of Monitor::Notify or by a spurious wakeup (i.e. SIGQUIT). To deal
with this issue, we check the JNI env for shutdown runtime when we
are woken up from a condition variable wait. This check fixes test
132 with --host --gdb --interpreter. Previously this test crashed
since dlclose was somehow causing a spurious futex wakeup.

TODO: Investigate adding a unit test.

Bug: 18577101
Change-Id: I479b38968ee9fbc4ee4b252ee2528787279972cc
bc34a7ed232cb3d384c250578e2b4ede45f2b167 07-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "Reduce sleep duration in SuspendAllDaemonThreads"

run-test 132 randomly chokes due to this change.

Bug: 26351700

This reverts commit adef5bde6c3392dca3dafa0f8d2c9428b59af3ef.

Change-Id: I18e007264e1e8b9027d7d241cb9f0053ad8d112a
adef5bde6c3392dca3dafa0f8d2c9428b59af3ef 07-Jan-2016 Mathieu Chartier <mathieuc@google.com> Reduce sleep duration in SuspendAllDaemonThreads

Previously we unconditionally slept for 200ms which caused runtime
shutdown to take 200ms longer than required.

Reduces runtime shutdown time for "am" from ~200ms to ~10ms.

Bug: 26351700
Change-Id: I7fd0059cb3b04dba0acc4a1754e76c89ec867f85
fb6db4c841e928feb35a985923fe2d41848f8f31 07-Jan-2016 Mathieu Chartier <mathieuc@google.com> Add systrace output to runtime shutdown

Help debug why am command shutdown is slow.

Findings:
~200ms spent in deleting thread list on N5.

Bug: 26351700
Change-Id: Icb59390a5267ae8bade4ced12252743c48206bb1
9450c6c25833e8353e436bbd0491ed96cd80f34f 07-Nov-2015 Mathieu Chartier <mathieuc@google.com> Remove thread suspension assertion for SuspendAllForDebugger

Fixes race condition that occasionally caused an assertion failure
for debugger tests, description in comments.

Change-Id: I18e003e01c1711dfdb0dd68ccb3d2b7dc626991f
62623401fe994ff2f2719faf3cdb3c23b92ccd96 28-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Fix deadlock with the JIT code cache.

Also remove hack done for ThreadStress.

Change-Id: Ie25c3bca08d9f2b8919706fa3fc26c5ab213f4a3
b56200b014d6bcfb962dc7afdd8b5f7168043ae7 29-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add comment for RunCheckpoint and clean up ThreadList a bit

Change-Id: Id512bfd15fee9a7359c77f094e16d64634943619
10d2508b105427ef1bcaf0c222873bae7acc66d3 29-Oct-2015 Mathieu Chartier <mathieuc@google.com> Change Checkpoint API to return total number of checkpoints

Fixes a race condition with SetStateUnsafe that caused some
warnings in the Barrier::~Barrier.

The race was:
RunCheckpoint sees suspended thread, runs the checkpoint. Inside the
checkpoint, the thread state had changed to runnable by
SetStateUnsafe. This occasionally caused more Barrier::Pass than
expected.

The fix is to return the total number of checkpoints instead of just
the runnable ones.

Bug: 24191051
Change-Id: If15a933ed4c8efa66a5f27cd5feaa2e5957ae804
6cff48f05894a60aa4742472983a75504536ca15 27-Jan-2014 Christopher Ferris <cferris@google.com> ART: Speed up thread stack tracing for ANRs

Share a BacktraceMap for all threads being dumped, which speeds up
ANR dumping. Results from Nexus 9 (average of five):

Before: 0.587s
After: 0.206s

Change-Id: Ia70e0dbd39049318c02de561e7b95258d4849467
4f55e22630d99ca0edd9e951e5ee96b57bb9b980 04-Sep-2015 Mathieu Chartier <mathieuc@google.com> Add and use ScopedSuspendAll

Usage replaces most SuspendAll and ResumeAll calls.

Change-Id: I355683a5365876242cea85a656dcb58455f7a294
00370827646cc21cb370c3e7e93f9c0cff4c30c2 18-Aug-2015 Hiroshi Yamauchi <yamauchi@google.com> Use thread-local is_gc_marking flags for the CC collector.

The currently global is_marking flag is used to check if the read
barrier slow path needs to be taken for GC roots access. Changing it
to a thread-local flag simplifies the fast path check and makes it
easier to do it in assembly code. It also solves the issue that we
need to avoid accessing the global flag during startup before the heap
or the collector object isn't allocated and initialized.

Bug: 12687968
Change-Id: Ibf0dca12f400bf3490188b12dfe96c7de30583e0
511683764f2580d877725e20514ca4976c91bbfb 13-Aug-2015 Mathieu Chartier <mathieuc@google.com> Wait for GC to finish in ThreadList::~ThreadList

Added a DisableGC to the heap instead of using the runtime shutdown
boolean. The runtime shutting down boolean is set to true before the
non daemon threads have exited. These threads may still be doing
allocations and we don't want to throw OOME if unnecessary.

Bug: 18577101
Change-Id: Iceb7048e6bd799aa2716099459c54f8dc0fb8feb
4382f1ef6ab2d6992d330cc8b43057d9139a1243 05-Aug-2015 Andreas Gampe <agampe@google.com> Revert "Revert "ART: Use bionic TLS slot for thread-self""

This reverts commit 50832b6804d15ea5ddfe99a2753a09111b5bfe37.

Fix clearing the TLS on detach.

Change-Id: I75ed5ccccb4f31800e5f893055e96067a9695258
b19ccb1d88f0bff7371c9b72f265148677c18e95 15-Jul-2015 Mathieu Chartier <mathieuc@google.com> Use SuspendAllInternal for FlipThreadRoots

Fix FlipThreadRoots to wait until all the threads are suspended by
using SuspendAllInternal. Since running threads no longer hold the
mutator lock as shared held, doing an exclusive lock will not block
if the threads are not suspended. Also implemented MarkHeapReference
which is used to preserve soft references.

Fixes CC tests.

Change-Id: I4b059238f4249cf297e21ae918becd029fe26527
19af117525f37607fc866e3375ef1450e3f5ae35 14-Jul-2015 Mathieu Chartier <mathieuc@google.com> Fix mac build

Untested.

Change-Id: I1b7803f2fdcd7f509614aa9d3dce414e50a6119d
eac4424b3420c280f97ff2f815b5dedd8dac9801 29-Jun-2015 Yu Li <yu.l.li@intel.com> ART: JNI thread state transition optimization

This patch improves the JNI performance by removing the explicit acquiring and
releasing the mutator lock when a thread state transits between suspended and
runnable states.

The functions responsible for changing the state were found to be the costliest
part of the JNI. Originally, a thread needs to acquire a shared mutator lock by
a CAS instruction when entering the runnable state and also needs to release
the lock by a CAS when entering the native state from runnable. This patch
removes these CAS operations when a thread state transits between suspended and
runnable. A thread in the runnable state is considered to have shared ownership
of the mutator lock and therefore transitions in and out of the runnable state
have associated implication on the mutator lock ownership. Meanwhile, a barrier
is added to control suspending all threads from running.

JNI transition overhead was reduced by 25% on IA platform and by 17% on ARM
platform by this patch, while it has little impact on GC pause time (measured
with "suspend all histogram").

Change-Id: Icee95d8ffff1bbfc95309a41cc48836536fec689
Signed-off-by: Yu, Li <yu.l.li@intel.com>
Signed-off-by: Haitao, Feng <haitao.feng@intel.com>
Signed-off-by: Lei, Li <lei.l.li@intel.com>
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
3cf225386e8129dcbe32b289279ecb87ec255318 10-Jul-2015 Mathieu Chartier <mathieuc@google.com> Clean up some includes

Change-Id: Ia03a3b54b235df38d5cfe096fef1aebe2b80eb29
6ba35b50347aa7418c66c7b046cd164987e95df3 01-Jun-2015 Sebastien Hertz <shertz@google.com> JDWP: asynchronous invoke command handling

The JDWP thread used to wait for the result of a method invocation
running in an event thread. But doing that prevents the JDWP thread
from processing incoming commands from the debugger if the event
thread gets suspended by a debug event occurring in another thread.
In Android Studio (or another IDE), this leads to the debugger being
blocked (with the famous message "Waiting until last debugger command
completes" of Android Studio / IntelliJ) because it is actually
waiting for the reply of its latest command while the JDWP thread
cannot process it.

This CL changes the way invoke commands (ClassType.InvokeCommand,
ClassType.NewInstance and ObjectReference.InvokeCommand) are handled
in the ART runtime.
The JDWP thread no longer waits for the event thread to complete the
method invocation. It now simply waits for the next JDWP command to
process. This means it does not send any reply for invoke commands,
except if the information given by the debugger is wrong. In this
case, it still sends a reply with the appropriate error code.
The event thread is now responsible for sending the reply (containing
the result and the exception object of the invoked method) before
going back to the suspended state.

In other words, we add special handling for invoke commands so they
are handled asynchronously while other commands remained handled
synchronously. In the future, we may want to handle all commands
asynchronously (using a queue of reply/event for instance) to remove
the special handling code this CL is adding.

Now the JDWP thread can process commands while a thread is invoking
a method, it is possible for the debugger to detach (by sending a
VirtualMachine.Dispose command) before the invocation completes. In
that situation, we must not suspend threads again (including the
event thread that executed the method) because they would all remain
suspended forever.

Also minor cleanup of the use of JDWP constants and update comments.

Bug: 21515842
Bug: 18899981

(cherry picked from commit cbc5064ff05179b97b416f00ca579c55e38cd7d9)

Change-Id: I8d31006043468913ee8453212e6d16e11fcfe4ea
cbc5064ff05179b97b416f00ca579c55e38cd7d9 01-Jun-2015 Sebastien Hertz <shertz@google.com> JDWP: asynchronous invoke command handling

The JDWP thread used to wait for the result of a method invocation
running in an event thread. But doing that prevents the JDWP thread
from processing incoming commands from the debugger if the event
thread gets suspended by a debug event occurring in another thread.
In Android Studio (or another IDE), this leads to the debugger being
blocked (with the famous message "Waiting until last debugger command
completes" of Android Studio / IntelliJ) because it is actually
waiting for the reply of its latest command while the JDWP thread
cannot process it.

This CL changes the way invoke commands (ClassType.InvokeCommand,
ClassType.NewInstance and ObjectReference.InvokeCommand) are handled
in the ART runtime.
The JDWP thread no longer waits for the event thread to complete the
method invocation. It now simply waits for the next JDWP command to
process. This means it does not send any reply for invoke commands,
except if the information given by the debugger is wrong. In this
case, it still sends a reply with the appropriate error code.
The event thread is now responsible for sending the reply (containing
the result and the exception object of the invoked method) before
going back to the suspended state.

In other words, we add special handling for invoke commands so they
are handled asynchronously while other commands remained handled
synchronously. In the future, we may want to handle all commands
asynchronously (using a queue of reply/event for instance) to remove
the special handling code this CL is adding.

Now the JDWP thread can process commands while a thread is invoking
a method, it is possible for the debugger to detach (by sending a
VirtualMachine.Dispose command) before the invocation completes. In
that situation, we must not suspend threads again (including the
event thread that executed the method) because they would all remain
suspended forever.

Also minor cleanup of the use of JDWP constants and update comments.

Bug: 21515842
Bug: 18899981
Change-Id: I15e00fb068340f3d69dc9225d8d2065246e68c58
bf44d42d978861f33fd5978f49392db3321ae414 02-Jun-2015 Mathieu Chartier <mathieuc@google.com> Add a way to SuspendAll for a long duration

Hprof uses this mode to not cause thread suspend timeouts if GC tries
while the hprof dump is running.

(cherry picked from commit 77be6635f9b07a8a794924c5fb9b071949776a6d)

Bug: 21063989
Change-Id: Ic6304620afd1489719a7e0e4299f829c90fe27cc
77be6635f9b07a8a794924c5fb9b071949776a6d 02-Jun-2015 Mathieu Chartier <mathieuc@google.com> Add a way to SuspendAll for a long duration

Hprof uses this mode to not cause thread suspend timeouts if GC tries
while the hprof dump is running.

Bug: 21063989
Change-Id: Ic6304620afd1489719a7e0e4299f829c90fe27cc
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
bb87e0f1a52de656bc77cb01cb887e51a0e5198b 03-Apr-2015 Mathieu Chartier <mathieuc@google.com> Refactor and improve GC root handling

Changed GcRoot to use compressed references. Changed root visiting to
use virtual functions instead of function pointers. Changed root visting
interface to be an array of roots instead of a single root at a time.
Added buffered root marking helper to avoid dispatch overhead.

Root marking seems a bit faster on EvaluateAndApplyChanges due to batch
marking. Pause times unaffected.

Mips64 is untested but might work, maybe.

Before:
MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us

After:
MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us

Bug: 19264997

Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
bf9fc581e8870faddbd320a935f9a627da724c48 14-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add more info to who called SuspendAll

Helps diagnose related jank.

Change-Id: I38191cdda723c6f0355d0197c494a3dff2b6653c
1558b577907b613864e98f05862543557263e864 25-Feb-2015 Sebastien Hertz <shertz@google.com> JDWP: allocate DebugInvokeReq only when requested

Only allocates thread-local DebugInvokeReq when the debugger requests
a thread to invoke a method. The JDWP thread allocates that structure
then attaches it to the target thread. When the thread is resumed, it
executes the method. Once the invocation completes, the thread
detaches the DebugInvokeReq, signals the JDWP thread then suspends.
Finally, the JDWP thread wakes up, prepares the reply with the invoke
result (or exception) and deallocates the DebugInvokeReq.

Also ensures GC safety for object returned by the invoke. We add the
object to the JDWP object registry right after the invoke. We now
reference that object with a JDWP ObjectID instead of an Object* in
the DebugInvokeReq struct. This prevent from accessing a stale
reference if the GC runs and moves the Object*.

This CL includes the following changes:
- Move former DebugInvokeReq::ready flag to
Thread::tls_32bit_sized_values::ready_for_debug_invoke. It's needed
to know whether a thread has been suspended by an event, thus ready
to invoke a method from the debugger.
- Remove DebugInvokeReq::invoke_needed: we now test if we attached a
DebugInvokeReq* to the thread.
- Rename misleading FinishMethod function to RequestMethod.

Bug: 19142632
Bug: 18166750
Change-Id: I351fb4eb94bfe69fcafb544d21d55ff35a033000
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
91e56692c6bd9fa1d41951ee7dc311f19461f4be 03-Mar-2015 Mathieu Chartier <mathieuc@google.com> Wait for threads to finish unregistering

There was a race where Thread::join would return before the thread was
unregistered. This caused a problem with Daemons.stop since the thread
list could get deleted before the daemon thread was removed from list_.
This caused occasional "Request to unregister unattached thread"
errors and warnings.

The fix is to wait until threads finish registering before destroying
the thread list. The only threads which can be unregistering at this
point are the daemons we stopped earlier during the runtime shutdown
process. The issue is that thread join finishes before we remove the
thread from the thread list.

Also some cleanup.

Bug: 18713034
Change-Id: I8921122fe8462643a6b814b5f00632481e3831fb
9db831acffa509b2e46c1d63fe25650d3bedd415 25-Feb-2015 Mathieu Chartier <mathieuc@google.com> Print thread name for attempting to unregister unattached thread

Bug: 18713034
Change-Id: Ic0654c6569277e5bbd6d2582140595faaa36cded
794ad76e8d5b5b9132819d5b08a0570e27615644 23-Feb-2015 Andreas Gampe <agampe@google.com> ART: Introduce NO_RETURN, Mark DoLongJump noreturn

Add NO_RETURN macro that adds C++11 noreturn attribute. Mark
DoLongJump methods as noreturn.

Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
c4448f4866b10f021c38947aac656746e62e5fa3 04-Feb-2015 Mathieu Chartier <mathieuc@google.com> Fix incorrect static const

Bug: 19265183

(cherry picked from commit 3a958aac75ec491a71fba4a9ec345cdd1817708c)

Change-Id: Iabb1abd81b022469b3b8aabd2d2a1c29f3b10ea0
3a958aac75ec491a71fba4a9ec345cdd1817708c 04-Feb-2015 Mathieu Chartier <mathieuc@google.com> Fix incorrect static const

Bug: 19265183
Change-Id: I573df60fe90952246d2126ced010f2bdac006bca
991438608d5223128a199282b85418f08c471b35 03-Feb-2015 Mathieu Chartier <mathieuc@google.com> Fix occasional long ThreadSuspendSleep

Since usleep can wait much longer than the specified us, we use
sched_yield instead for more predictable behavior.

Bug: 18379850
Change-Id: I729212251db1e86e470240b7a042bbf2d4e981cd
dd9943d4466b052ef6c5ee5b32187adb48cbce74 02-Feb-2015 Lei Li <lei.l.li@intel.com> ART: checkpoint mechanism optimization

GC thread and trim thread are both using checkpoint mechanism. GC thread
will request java threads to mark their thread roots by themselves. Trim
thread will request java threads to trim their jni local reference
tables by themselves.

The checkpint mechanism semantics is that the runnable java threads will
run checkpoint function itself at safepoint, and finally the java
threads and gc thread or trim thread is synchronized via barrier. If the
java threads are not runnable, gc thread or trim thread will suspend
them and then run their checkpoint functions one by one on behalf of
them. If all the java threads are not runnable, then gc thread or trim
thread will do all the work itself. In this case, there is no need
synchronization. This will save unnecessary synchronization and thread
state transitions.

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

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
e34fa1df67fbe0173b4ea9abddcc3ae3d0537037 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

(cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a)

Bug: 18588862
Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
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
1e4b0ca3bde8ea792aad83aefc891628ff6ec806 14-Jan-2015 Andreas Gampe <agampe@google.com> ART: Change ternary location for timeout

Make the decision for timeout length in the constant, not at the
use site.

Bug: 18964791
Change-Id: I73e6ef5e1c23fd515eaa61ba68236698d3e5c81a
66516ac4547fe40f26e4e117b3ee595904607b95 09-Jan-2015 Sebastien Hertz <shertz@google.com> JDWP: allow VirtualMachine.Resume on partial suspension

Allows to resume multiple threads with a single VirtualMachine.Resume
command. When some threads are suspended for an event by the debugger
with a suspend count of 1 (other threads are running), a debugger can
resume them all this way.

Bug: 18924933

(cherry picked from commit f9d233dae8ca66ed5a2a474155d6bee0d74c355b)

Change-Id: I948c3b50d43693e86ae31e0928a33a467328583f
4a3d19bfc16e3f5bfb796fb7ed24404fa77007a4 10-Jan-2015 Andreas Gampe <agampe@google.com> ART: Increase dump checkpoint timeout on the host

Increase the dump checkpoint timeout on the host, as addr2line is
used and may put more strain onto the system.

Bug: 18964791
Change-Id: I9c1e9c1289fddfce25854e4425194882628bcf21
f9d233dae8ca66ed5a2a474155d6bee0d74c355b 09-Jan-2015 Sebastien Hertz <shertz@google.com> JDWP: allow VirtualMachine.Resume on partial suspension

Allows to resume multiple threads with a single VirtualMachine.Resume
command. When some threads are suspended for an event by the debugger
with a suspend count of 1 (other threads are running), a debugger can
resume them all this way.

Bug: 18924933
Change-Id: I81543df8228d56a4cf201e59885015880650f202
23f6e69e374ce4a7fd0d45f633a3c9efcc8e8a07 19-Dec-2014 Mathieu Chartier <mathieuc@google.com> Only dump suspend all histogram if we have samples

Helps fix gcstress ThreadStress.

Bug: 18576985
Change-Id: Ibebc0fed8a21e7b149f4b6e5154fb86deddcc68f
70a596d61f8cf5b6447326c46c3386e0fbd5bfb5 17-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add thread suspend histogram

Helps measure time to suspend.
Example output (maps after a few seconds):
suspend all histogram: Sum: 2.806ms 99% C.I. 2us-1090.560us Avg: 43.843us Max: 1126us

Change-Id: I7bd9dd3b401fb3e3059e8718556d60910e541611
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
82a800d1408937951155f546a3671b83b7379ab5 16-Dec-2014 Mathieu Chartier <mathieuc@google.com> Decrement suspend count if thread is shutting down

Prevents deadlock caused by incrementing suspend count in
SuspendThreadByPeer, then getting a cleared nativePeer field. This
resulted in us not decrementing the suspend count which caused a
deadlock in WaitForOtherNonDaemonThreadsToExit.

Bug: 18739541
Change-Id: I4a63f1823993a0f99f32025cd479072be49ba8d5
db978719dbcb73fc6acfd193561445c4462786b8 09-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Tidy gAborting."

Creates infinite loop: b/18674776.

This reverts commit 015b137efb434528173779bc3ec8d72494456254.

Change-Id: I67fe310d2e95ee2ec37bec842be06fb1123b6f4e
015b137efb434528173779bc3ec8d72494456254 05-Dec-2014 Ian Rogers <irogers@google.com> Tidy gAborting.

Reduce scope to Runtime::Abort and short-cut recursive case earlier. gAborting
remains global to avoid two fatal errors in thread and the verifier.

Change-Id: Ibc893f891ffee9a763c65cde9507d99083d47b3f
7443c9abb22b10fc45895b2171fc0f67866863b7 26-Nov-2014 Andreas Gampe <agampe@google.com> ART: Avoid a recursive abort

When waiting for checkpoints on abort, don't abort on timeout.

Change-Id: Ic87c25d466021d391563f870642251b69dd62af5
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
8409ec440079020bbe4ad066cf18a5fadfba67d2 05-Nov-2014 Ian Rogers <irogers@google.com> Make thread dumping more tolerant of broken invariants during abort.

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

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

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
4eec026ec4d86869baa27ad0afd9564cca8856c9 14-Oct-2014 Sebastien Hertz <shertz@google.com> Fix JDWP Virtualmachine.Resume command

We used to call ThreadList::UndoDebuggerSuspensions but this is not
correct. Indeed Virtualmachine.Resume command should be performed
as many times as all threads have been suspended (either by the
Virtualmachine.Suspend command or the application of suspend policy
ALL for event).

This CL fixes this issue by adding ThreadList::ResumeAllForDebugger.
It decrements suspend count and debug suspend count by 1 (globally
and for each thread).

It also handles the case where Virtualmachine.Resume is called while
threads have not been suspended (global debug suspend count is 0). In
this case we just print a warning and do nothing.

Bug: 17974047

(cherry picked from commit 253fa555d9424a56c52879449eabe73d5c96cf61)

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

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

Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
253fa555d9424a56c52879449eabe73d5c96cf61 14-Oct-2014 Sebastien Hertz <shertz@google.com> Fix JDWP Virtualmachine.Resume command

We used to call ThreadList::UndoDebuggerSuspensions but this is not
correct. Indeed Virtualmachine.Resume command should be performed
as many times as all threads have been suspended (either by the
Virtualmachine.Suspend command or the application of suspend policy
ALL for event).

This CL fixes this issue by adding ThreadList::ResumeAllForDebugger.
It decrements suspend count and debug suspend count by 1 (globally
and for each thread).

It also handles the case where Virtualmachine.Resume is called while
threads have not been suspended (global debug suspend count is 0). In
this case we just print a warning and do nothing.

Bug: 17974047
Change-Id: I25af22b1936760292d2a8c286e0867f2ae864108
e094b87c6f6ea9ebf83aa56a3114ac59556aaf9f 14-Oct-2014 Jeff Hao <jeffhao@google.com> Store exiting thread ids and names while tracing to output later.

Bug: 17909204

(cherry picked from commit fdcbc5c4c7c67bba06e038ac96a2e8bc49b91f84)

Change-Id: Iea087560ba8b983412a6dde2ec166c9e7214f3a1
fdcbc5c4c7c67bba06e038ac96a2e8bc49b91f84 14-Oct-2014 Jeff Hao <jeffhao@google.com> Store exiting thread ids and names while tracing to output later.

Bug: 17909204
Change-Id: I4ce027af7c51fb310d6cdbdf067ae340e4c932ff
fec72f4a625122ab9972708b1f44f24b53a8b734 09-Oct-2014 Mathieu Chartier <mathieuc@google.com> Fix race in thread list destructor

The ThreadList::Contains wasn't being guarded by the thread list
lock, which could cause a corrupted thread list if another thread
unregistered itself while std::find was searching the thread list.

Bug: 17896374

(cherry picked from commit b90132cb5132eaeb4dbfca1e63d79b4005dacec5)

Change-Id: I8f6f979f365ca00ac0655e04eb26020d2ad7d6ee
b90132cb5132eaeb4dbfca1e63d79b4005dacec5 09-Oct-2014 Mathieu Chartier <mathieuc@google.com> Fix race in thread list destructor

The ThreadList::Contains wasn't being guarded by the thread list
lock, which could cause a corrupted thread list if another thread
unregistered itself while std::find was searching the thread list.

Bug: 17896374
Change-Id: I629b1eac3473e3cf7355ebde9080dfd7c58af73a
5869a2c27ee0dbd7b420614c76ff14a706f0c5fb 08-Oct-2014 Mathieu Chartier <mathieuc@google.com> Dump mutator lock for thread suspend timeout

Should help us see if thread suspend timeouts are due to someone
holding on the mutator lock for too long or if it is a missed
futex wake.

(cherry picked from commit f924d2381a5ea53967ba1e279766d601b9be05ea)

Bug: 17837911
Change-Id: I3417156a78f574076d5da17c86836c5a7c76084a
f924d2381a5ea53967ba1e279766d601b9be05ea 08-Oct-2014 Mathieu Chartier <mathieuc@google.com> Dump mutator lock for thread suspend timeout

Should help us see if thread suspend timeouts are due to someone
holding on the mutator lock for too long or if it is a missed
futex wake.

Bug: 17837911
Change-Id: I3417156a78f574076d5da17c86836c5a7c76084a
dcfd6cad9670ca3ae460a4af0bbe7d88cae21a3c 18-Sep-2014 Sebastien Hertz <shertz@google.com> Move spammy logs to JDWP verbose mode

We are spammed by warning messages when debugging, especially each time we
suspend/resume all threads (to update instrumentation or collect monitor info).
It's common to get into the cases where these warnings are logged so they
shouldn't be warning but debug messages.

This CL moves these LOG(WARNING) to VLOG(jdwp) to not disturb developers when
debugging their app (especially when looking for specific messages in logcat).
We keep them in JDWP verbose mode because they help knowing when we initiate
these sequences of "suspend/resume all threads".

Also adds debug suspend count in the log message for more context.

Bug: 17524544
Bug: 17170697

(cherry picked from commit f272af4b9dcd39cdd50fa6655601a26e837eaea9)

Change-Id: I61df70ace1475bf10d83202b6bb774f7036354cb
f272af4b9dcd39cdd50fa6655601a26e837eaea9 18-Sep-2014 Sebastien Hertz <shertz@google.com> Move spammy logs to JDWP verbose mode

We are spammed by warning messages when debugging, especially each time we
suspend/resume all threads (to update instrumentation or collect monitor info).
It's common to get into the cases where these warnings are logged so they
shouldn't be warning but debug messages.

This CL moves these LOG(WARNING) to VLOG(jdwp) to not disturb developers when
debugging their app (especially when looking for specific messages in logcat).
We keep them in JDWP verbose mode because they help knowing when we initiate
these sequences of "suspend/resume all threads".

Also adds debug suspend count in the log message for more context.

Bug: 17524544
Bug: 17170697
Change-Id: Ic87985ac6913151d15fd89849e41bde61092c3dd
a2af5c7e3262bb7165e9320426bd6925f1a3c90d 16-Sep-2014 Ian Rogers <irogers@google.com> Only log an error if an unattached thread is unregistered.

Turn a fatal check into a diagnostic error. It looks like this issue arises
when a runtime shutsdown without properly being started.
Bug: 17011539

Change-Id: I2983c8332e83769e9480e8f30a46ca3b80a2e90e
(cherry picked from commit e2bcf579b0bc2f53db68c38755d69543198c7b00)
e2bcf579b0bc2f53db68c38755d69543198c7b00 16-Sep-2014 Ian Rogers <irogers@google.com> Only log an error if an unattached thread is unregistered.

Turn a fatal check into a diagnostic error. It looks like this issue arises
when a runtime shutsdown without properly being started.
Bug: 17011539

Change-Id: I2983c8332e83769e9480e8f30a46ca3b80a2e90e
2156ff1ff09166ad8270f27d758e913f120c3640 14-Sep-2014 Ian Rogers <irogers@google.com> Add time out to dump check point.

Change-Id: I2263c092c9957585ae90cf846e77dc8861f8a14b
7b078e8c04f3e1451dbdd18543c8b9692b5b067e 10-Sep-2014 Ian Rogers <irogers@google.com> Compile time performance improvements focusing on interpret-only.

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

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

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

Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
ed2be1725fb79075892b1a9103487c9d9a95b350 19-Aug-2014 Sebastien Hertz <shertz@google.com> Reduce lock contention when debugging

Uses a ReaderWriterMutex for the breakpoint lock to reduce contention during
debugging session.

Also adds missing thread safety annotations on fields and methods related to
instrumentation and debugging.

Bug: 16814665
Bug: 11667502

(cherry picked from commit 59d9d668d4f4286813afe2b4e7c6db839222ce96)

Change-Id: I5f1156da8c6cc8316d6db16e6cfb2470fe289ad3
ba32de47e32f436d7c11cb4a2e78bdd4ad4dc5d2 28-Aug-2014 Brian Carlstrom <bdc@google.com> Fix issue with Thread.setName hanging after Thread.start

When suspending a thread by peer the invariant that only attached threads are
suspended must be maintained. Add a ThreadList::Contains check which requires
making this method non-static.
Add some extra thread logging.

Bug: 17302037

(cherry picked from commit 37c16453a92bbf1a47f042000318a1b60381017d)

Change-Id: I51832785d4b4b431e035318e75635f442e89a1fb
37c16453a92bbf1a47f042000318a1b60381017d 28-Aug-2014 Brian Carlstrom <bdc@google.com> Fix issue with Thread.setName hanging after Thread.start

When suspending a thread by peer the invariant that only attached threads are
suspended must be maintained. Add a ThreadList::Contains check which requires
making this method non-static.
Add some extra thread logging.

Bug: 17302037
Change-Id: I89af9840e398c2ceadeb736c431dfe3be8f3ba06
59d9d668d4f4286813afe2b4e7c6db839222ce96 19-Aug-2014 Sebastien Hertz <shertz@google.com> Reduce lock contention when debugging

Uses a ReaderWriterMutex for the breakpoint lock to reduce contention during
debugging session.

Also adds missing thread safety annotations on fields and methods related to
instrumentation and debugging.

Bug: 16814665
Bug: 11667502
Change-Id: I056cdafa91109e0c83806c8d8df75c37ade0a354
68d8b42ddec39ec0174162d90d4abaa004d1983e 17-Jul-2014 Ian Rogers <irogers@google.com> Wire up check JNI force copy mode.

Increase check JNI checks.
Break apart jni_internal.h in to jni_env_ext.h and java_vm_ext.h.
Fix the abuse of ScopedObjectAccess/annotalysis by ScopedCheck in the case
of VM routines.
Make class loader override and shared library class loader JNI global
references rather than mirror pointers.
Clean-ups to native bridge.

Change-Id: If7c6110b5aade7a402bfb67534af86a7b2cdeb55
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
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
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
9db911eb76976fc1c73c8e563beb3620f1cadf99 04-Jun-2014 Mathieu Chartier <mathieuc@google.com> Print mutexes held in Thread::Dump.

Should help finding and fixing thread suspend timeout issues.

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

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
9e36931cc79ca665908db9575126881d1cfdea5a 21-May-2014 Chao-ying Fu <chao-ying.fu@intel.com> Move modify_ldt_lock into global lock order.

Mutex modify_ldt_lock was being removed during runtime shutdown while
daemons thread may still detach. Avoid this by placing in global lock
order.
This fixes cts dalvik vm-tests-tf that hang on some x86 devices.

By irogers: also, tidy global locks to agree with enum constants and
add extra verification that the global annotalysis order agrees with
the LockLevel order. Bumped the oat version and moved the locks as
LockLevel additions previously caused entrypoints to be moved. Make
unattached lock not handle the default mutex level case by moving the
allocated thread ids lock into the global order.

Change-Id: I9d03f19d44ea254accf0ceae8022563c77f7a02f
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
5a9ba014516fcdeab617d1c006fdf2936865f178 19-May-2014 Ian Rogers <irogers@google.com> Build fix.

Change-Id: Ie5a3abb9a729a4a724e247b127c200a7be4d900d
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
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
a2cee18799d7e61adb037a4219adb23fef7d022b 17-Apr-2014 Christopher Ferris <cferris@google.com> Modify unwind to comply with stack parser tools.

Bug: 14081592

Change-Id: I6906b2575c74d64f1c3ba7602779b3a789de1c69
bb43b433c845e253a11346f0f03706d58a44f23c 14-Apr-2014 Sebastien Hertz <shertz@google.com> Clear unused roots from debugger

SingleStepControl and DebugInvokeReq hold roots which are only used during a
limited amount of time. Clear these roots once we finish using them.

Also cleans some code around single-step.

Change-Id: Ica2f65e04a4d60272199490cd40ad1803d3b9f02
7bf9f190cd33a7e2f8584299eb889e9df66e0323 04-Apr-2014 Mathieu Chartier <mathieuc@google.com> Improve invalid root dumping.

The invalid root dumping now attempts to print the root type.

Change-Id: Ie821296d569f34909ba6e2705f5c347cd2143a3a
2966e13d504a72d55c62bf864e183ec80703c699 02-Apr-2014 Ian Rogers <irogers@google.com> Avoid debug check violation in thread registration.

Bug: 13757855
Change-Id: Ied83a7fc43e2b9a89a8b99aa4f74069ef8a369b1
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
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
6dda898d47b3e8931e4404330e81b7110108e34f 06-Mar-2014 Mathieu Chartier <mathieuc@google.com> Disable compaction for jni workarounds.

Compaction can't work when jni workarounds is enabled. Also some
other refactoring.

Change-Id: Ia7b0f2b39c79f5a0a5f50874d823b950ab02a0c3
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
21e729c7859ce7909e85d135f6c9e32bbba38860 18-Feb-2014 Sebastien Hertz <shertz@google.com> Fix failing check during JDWP invoke.

Fixes a race where the JDWP thread expects the invoke thread can be suspended
(suspend_count != 0) before invoke thread actually updates its suspend count.

It happens after the invoke thread signals the JDWP thread to notify invoke is
completed but before incrementing its suspend count. In the meantime, the JDWP
thread wakes up and checks whether invoke thread has updated its supend count.
But there is no way to prevent the JDWP thread to do so before the invoke
thread updates its suspend count.

We now move the invoke completion code after the suspend count update. Then the
JDWP thread wakes up at the right time.

Bug: 11247837
Bug: 12578041
Change-Id: Ib6079c6e330671b34217838e26b1e758706d3da6
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
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
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
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
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
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
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
967a0adf8b93a23d2a8fef82e06bd913db94ac19 11-Sep-2013 Hiroshi Yamauchi <yamauchi@google.com> More allocation code optimizations.

- Inline Class::AllocObject() and Array::Alloc().
- Inline some short Mutex functions and add LIKELY/UNLIKELY to some
Mutex functions.
- This change improves the Ritz MemAllocTest by ~6% on Nexus 4 and
~10% on host.

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

Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
df62950e7a32031b82360c407d46a37b94188fbb 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/parens issues

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