History log of /art/runtime/runtime.h
Revision Date Author Comments
fb74d8bc938b1095b8e1e51083070feeb65cbd0f 04-May-2018 Calin Juravle <calin@google.com> Support system server ART-profiling

We don't have to map the code cache as executable if we only want to save
profiles. This enables system server profiling without disabling SElinux
to bypass the jit code cache exec-mapping.

Test: m test-art-host
boot a device with system server profiling enabled.
Bug: 73313191

(cherry picked from commit e6fcde455478f767f080f380f5958c6e0177e667)

Merged-In: I7f25a905e0b23456183e39e58ad8f4b829ddf0c5
Change-Id: I7f25a905e0b23456183e39e58ad8f4b829ddf0c5
5bcef17fcee4f535c6d39177b1c55eefea81f854 01-May-2018 Mathew Inwood <mathewi@google.com> Include package name in tron events.

Add this state to Runtime, together with a getter and setter to it can be
passed at zygote fork time.

The package name needs to be included in the event itself, as the PID/UID
also present are not used to look up the package name later.

Bug: 77517571
Test: m
Test: $ adb lolcat -b events | grep sysui_multi_action
Change-Id: I40ec89152b5ecc9a81555f2e74bc4f4b44b2bcac
90f8addf6c68a9be6d813e5da7f6bea370a048f9 24-Feb-2018 Alex Light <allight@google.com> Always allow agent attach on userdebug builds with kArtTiVersion

We added support for the jvmti-alike ArtTi for use by debuggers on
userdebug/eng builds of android. Extend this support to allow any
agent to be loaded on any process of a userdebug device. These agents
will need to make use of kArtTiVersion (0x70010200) envs.

Test: build
Test: ./test.py --host -j50
Test: ensure AS profiler continues to work with userdebug devices
Bug: 78195998
Merged-In: I984d1ea937eb49afb376a48bea3d67085192020e
Change-Id: I984d1ea937eb49afb376a48bea3d67085192020e
(cherry picked from commit f889c70e79643373320f5742cc719d6c467531b9)
73ddda4403c8088a730b8d456de46bb8e0307ed8 03-Apr-2018 Mathew Inwood <mathewi@google.com> Log an event on hidden API accesses.

The new event consists of:
- The type of access (reflection, JNI, etc.)
- The action taken (warn or deny)
- The type of member accessed (field or method)
- Name of the class which defined the member accessed
- The name of the member
- The type signature of the member (type of field, or method signature)

The fully qualified member name is also not included to avoid the overhead
of building the string. It can be build from the information included.

Similarly, the package name, version, etc. are not included as they can
be inferred from the context when analyzing the event log.

The event is sampled, according to a sampling rate that can be set by a
configuration option, to reduce log spam.

Test: $ m
Test: $ adb shell settings put global hidden_api_access_log_sampling_rate 65536
Test: $ adb lolcat -b events | grep art_hidden_api_access

Sample output:
16796 16796 I art_hidden_api_access: [1,0,Ldalvik/system/VMRuntime;,getRuntime,()Ldalvik/system/VMRuntime;]
16796 16796 I art_hidden_api_access: [1,2,Ldalvik/system/VMRuntime;,setHiddenApiExemptions,([Ljava/lang/String;)V]
16796 16796 I art_hidden_api_access: [1,3,Landroid/app/Activity;,mDoReportFullyDrawn,Z]
(Timestamps have been elided)

Bug: 64382372
Bug: 77517571
Change-Id: I012b2c9fbffbd00ed3219918e7a736a4f7435ec8
c8ce5f520d2ba84ff8f393f78ba953ae6d467ca8 05-Apr-2018 Mathew Inwood <mathewi@google.com> Treat hidden API exemptions as whitelist.

This was a request from android-api-council, effectively to treat
exempted APIs as equivalent to public APIs. The reasoning for this is
that if the support library uses such APIs, we don't want to confuse
developers with a warning in the log.

To avoid examing the exemptions list on all light greylist API accesses,
also change the light greylist warn behavior to only print a warning in
the log if the app is debuggable. This means:
- less log spam from light greylist usages
- debuggable apps still get info about light greylist usage

Bug: 64382372
Test: m
Test: Boot device
Test: $ adb shell settings put global hidden_api_blacklist_exemptions \
Test: "\"Landroid/app/Activity;->mWindow:,Landroid/app/Activity;->mCalled:\""
Test: Verified with test app & adb logcat
Change-Id: Ibada61b591517f7e72c7101aea04ff0ad4beb0ee
3383aa5cc3bac56576cf48086183f59ac4de279e 16-Mar-2018 Mathew Inwood <mathewi@google.com> Support for API exemptions from API blacklisting.

Add support to VMRuntime for setting a list of exemptions from the hidden
API enforcement. The list is used as a prefix match against the signature
of a field/method. Any signatures that match are treated as being on the
light grey list, rather than the dark grey list or blacklist.

Refactor some code in hidden_api.h that deals with field/method signatures,
to encapsulate the signature in a new class MemberSignature. This allows us
to avoid building the entire signature in member, instead just using its
constituent parts.

Test: $ make test-art-host-gtest-hidden_api_test
Test: $ adb shell settings put global hidden_api_blacklist_exemptions \
Test: Landroid/view/RemoteAnimationDefinition\\\;:Landroid/app/ActivityManager\\\$TaskDescription\\\;
Test: Manually verify logcat output from app which uses named APIs
Bug: 73337509

(cherry picked from commit 7d74ef585063ca2adc0ba9c18008b7c1671ff699)

Merged-In: Id608743d1b5a7a37059875d8991d0d4d65f5fc36
Change-Id: Ic868557e12c3896888184501a59481a56edebd03
a5dc52c023be28850e4d7422655d96771cb472f5 19-Feb-2018 Mathew Inwood <mathewi@google.com> More flexible API enforcement policy support.

This CL adds the ability to configure which banned API lists to enforce,
defined by new enum hiddenapi::ApiEnforcementPolicy. Currently, the policy
can be set at zygote fork time, but not at dex optimization time where
blacklist enforcement is still assumed. As such, making the policy more
strict will not work as expected yet. This will be improved in a follow up
CL.

(cherry-picked from commit 159f596eec01adbb5a1c9654402c137cdb943131)

Test: art tests pass
Test: Device boots

BUG: 73337509
Change-Id: I0f2eab0895acabfaca39c82bdb98316976c73bea
Merged-In: I33f9afce628a86727e400052f4d5979d3536da8c
ef012225dcec8f736fc8fd848f5d8ee01c3c280f 21-Jun-2017 Roland Levillain <rpl@google.com> Fix typos.

Test: art/test/testrunner/testrunner.py
Change-Id: I5f5e052c940650a3adb3a8717b84260e6b306500
f3d6cddd1d3a8c12abe1027b11d71a7d87005f3f 07-Feb-2018 David Brazdil <dbrazdil@google.com> Revert "Do not show UI hidden API warning for exempt apps but print into log"

This reverts commit e5bc69765d685bcbd3d98a3b792f6d90e4e3dabc.

Reason for revert: This is no longer required

Change-Id: I80d4a866916a77032e205257d6f920b928fb876f
2b23147405b2f53d38b7b990c40baf698ed5739c 05-Feb-2018 David Brazdil <dbrazdil@google.com> Do not show UI hidden API warning for exempt apps but print into log

This is a configuration for dogfood builds in which we want to print
warnings into the log for all apps but not show UI toast for system
apps so as to not spam dogfooders unnecessarily.

Bug: 64382372
Test: make
Change-Id: I5b0d5757610dadd1593a5e388e5345c060cf39cf
(cherry picked from commit e5bc69765d685bcbd3d98a3b792f6d90e4e3dabc)
e5bc69765d685bcbd3d98a3b792f6d90e4e3dabc 05-Feb-2018 David Brazdil <dbrazdil@google.com> Do not show UI hidden API warning for exempt apps but print into log

This is a configuration for dogfood builds in which we want to print
warnings into the log for all apps but not show UI toast for system
apps so as to not spam dogfooders unnecessarily.

Bug: 64382372
Test: make
Change-Id: I5b0d5757610dadd1593a5e388e5345c060cf39cf
92265222f1e1df56ee6d106493b1bd2be65d5ce9 02-Feb-2018 David Brazdil <dbrazdil@google.com> Only set UI warning on hidden API dark greylist

The framework might show a toast notification on access to greylisted
hidden APIs. Only show this warning on dark greylist so as to not spam
early testers.

Bug: 64382372
Test: make
Change-Id: I8b5f7b4938e0f238c513e37d7db06856b966802f
ee7d2fd16d47b54d7fb5b9d5ec772fbc315faf4b 20-Jan-2018 David Brazdil <dbrazdil@google.com> Start warning on hidden API greylist

Insert checks into reflection, JNI and the verifier to print
a warning when greylisted methods are invoked and fields accessed.
We do this on actual access, because reflection allows to list
all methods/fields and simply listing a greylisted member would
print too many false positives.

Issuing a warning also sets a boolean flag in Runtime. This will
be made accessible through VMRuntime to the framework which will
issue a Toast on Activity start.

The change was tested with internal microbenchmarks of reflection
and those flagged one issue. Microbenchmark invoking a field getter
has regressed by 35%. We will profile this benchmark in detail and
consider options for improvement. Bug b/72482474 was created to track
progress.

Test: art/test.py -b -r -t 674-hiddenapi
Bug: 64382372
Bug: 72482474
Change-Id: I323244935e9091a2f8d012385cefaac6b1fe3777
5a61bb7969347ffe8e0bf4f4dff841cc6c21ed85 19-Jan-2018 David Brazdil <dbrazdil@google.com> Start enforcing hidden API blacklist

Insert checks into reflection, JNI and Class::CanAccessMember to
make blacklisted hidden APIs undiscoverable.

The change was tested with internal microbenchmarks of reflection
and those showed no measurable performance impact.

Test: art/test.py -b -r -t 674-hiddenapi
Bug: 64382372
Change-Id: I9e39804b837ae9ffeba926f2a5b1e8e9986c472b
3e0fa0aa5d929737f1d1c4bac07e2695ac438324 15-Jan-2018 David Brazdil <dbrazdil@google.com> Add runtime option for no hidden API access checks

Add a new Runtime option -Xno-hidden-api-checks to disable
enforcing hidden API access restrictions.

Test: m test-art-host
Bug: 64382372
Change-Id: I8bd5b7ef307f21ba71d05a066a9d5dd2d7614543
a7db026ff647eefb589043dbb55bbf28637755e8 16-Jan-2018 David Brazdil <dbrazdil@google.com> Add a new runtime option for target SDK version

SDK version can be set through VMRuntime, but we also need a way
of setting it in dex2oat.

Bug: 64382372
Test: make test-art-host
Change-Id: I82b9360be59a8bc1984006379d8011d50a0199c3
2ce6fc80711af9afa3ecda8fdff6f4ed80aa3022 19-Dec-2017 Alex Light <allight@google.com> Support using adbconnection and openjdkjvmti without JAVA_DEBUGGABLE

We need to support using a best-effort JDWP when we have the
ENABLE_JDWP attribute without the JAVA_DEBUGGABLE attribute. This is
used on eng and userdebug builds. We do this by making the plugin try
to change the runtime to debuggable if possible and to allow getting
an ArtTiEnv which is a best-effort version of JVMTI by calling GetEnv
with (JVMTI_VERSION_1_2 | 0x4000000). This is needed since if the
runtime isn't debuggable we cannot guarantee compatibility with the
JVMTI specification in all cases due to compiler optimizations such as
inlining. By creating this special version agents are able to
positively signal that they are able to deal with this uncertainty.

We also support using openjdkjvmti without being JAVA_DEBUGGABLE. This
is done by either only allowing the best effort ArtTiEnvs or by
changing the environment to be debuggable if we are loaded early
enough.

Moving the runtime to debuggable state involves deoptimizing the boot
image and throwing out any image files associated with non-debuggable
oat-files.

Bug: 62821960
Test: ./test.py --host -j50
Test: Manual
Test: Build, Test debugging system_server and other processes.
Change-Id: I2233299fceb83c76785e5de09e51eaf18b7922e8
9e734c7ab4599d7747a05db0dc73c7b668cb6683 05-Jan-2018 David Sehr <sehr@google.com> Create dex subdirectory

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

Bug: 71361973
Test: make -j 50 test-art-host
Change-Id: I59e984ed660b93e0776556308be3d653722f5223
7b38e692caa474bf0470349d016ef8f4502d50b9 29-Dec-2017 Andreas Gampe <agampe@google.com> ART: Take classloader into account for AttachAgent

Take a classloader into account for attaching an agent, if given.
This will use the library path from the classloader to find the
agent library.

Switch to libnativeloader to do the actual loading.

Bug: 70901841
Test: m test-art-host
Change-Id: I59ec55178792bc738fb06e0299522e207dd4a784
aadcbc64c674995ccdaf686789c8d39ada9913ad 28-Dec-2017 Andreas Gampe <agampe@google.com> ART: Refactor Agent into Agent and AgentSpec

Separate configuration/loading and runtime state.

Test: m test-art-host
Change-Id: I69bb91e13ef10b9e1ce313f45b0b809b913d8e10
403207107da7f11525c4d305184c56b35ec1c17a 14-Dec-2017 Alex Light <allight@google.com> Add support for selecting alternate JDWP implementations

Change JDWP options parsing to take place later and add a
-XjdwpProvider:_ option that can be used by the runtime to select an
appropriate JDWP provider. The argument is a string.

If 'none' is given JDWP will be totally disabled.

If 'internal' is given the current internal JDWP implementation is
used.

If 'default' is given the 'internal' JDWP implementation will
currently be used.

Other values will be added in the future.

Also adds a runtime callback that will be invoked when the runtime
wants to start or stop the debugger (namely at the post-zygote fork
and just before exit) and check if a debugger is availible.

Also add '-XjdwpOptions:_' in preparation for the eventual removal of
the existing -Xrunjdwp=_ and -Xagentlib:jdwp=_ as top-level options.
All of these options now store their arguments as a std::string to be
interpreted by the JDWP implementation as it sees fit. Also change the
jdwpOptions to default to transport=dt_android_adb if there is not one
specified and it is available. This will make changing the default
transport based on the JDWP provider easier.

These new options are needed to allow us to support both the old,
internal, JDWP implementation as its replacement is tested and
verified. This lets us switch between them with little difficulty.

We will probably remove one or both of these options once we have
confidence that the new jdwp implementation has stuck.

Test: ./test.py --host -j50
Test: ./test/run-test --host --debug 001-HelloWorld
Test: Manual, flash walleye, debug app

Bug: 62821960

Change-Id: Ie31db6b6f7d76a03d4ab8e178fcf298ed0eec203
7919db947bc41f6f5d194c50b88d0cba47319a1c 29-Nov-2017 Alex Light <allight@google.com> Speed up MterpShouldSwitchInterpreters check

We were often performing a pair of TLS reads in order to determine in
the current thread has any pending asynchronous exceptions (exceptions
thrown by the JVMTI StopThread function). This is quite slow and was
impacting some benchmarks. Since it is expected that asynchronous
exceptions are extremely rare we will first check to see if any
asynchronous exceptions have been sent on the current process. Only if
at least one asynchronous exception has been thrown will we do the
expensive TLS lookups to determine if one has been thrown on the
current thread.

Using a global instance value without synchronization or atomics is ok
here since the checkpoint that actually sets the async_exception_thrown
flag provides synchronization by either occurring on the target thread
or passing the checkpoint.

According to go/lem this gives us a 7% increase on the caffeine
string benchmark.

Test: go/lem runs
Test: ./test.py --host -j50
Bug: 68010816
Change-Id: I62684a5b3a7fc7cc600f5efd2a2393d9c4025917
2ffb703bf431d74326c88266b4ddaf225eb3c6ad 08-Nov-2017 Igor Murashkin <iam@google.com> cpplint: Cleanup errors

Cleanup errors from upstream cpplint in preparation
for moving art's cpplint fork to upstream tip-of-tree cpplint.

Test: cd art && mm
Bug: 68951293
Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
c42cb0e08a7c8f7085115e57b0ea92da9eee1575 13-Oct-2017 Mathieu Chartier <mathieuc@google.com> Add -XX:MadviseRandomAccess option

If enabled, ART will advise random access to the kernel for files
that are thought to have such access patterns.

Bug: 67772594
Test: verify that -XX:MadviseRandomAccess:true is passed to runtime init

(cherry picked from commit 087f2046dfdf41646c740a05004b4d40cbd99b11)

Change-Id: I76a5f62846d563a4f2cf25e47dbd320464aee8c1
087f2046dfdf41646c740a05004b4d40cbd99b11 13-Oct-2017 Mathieu Chartier <mathieuc@google.com> Add -XX:MadviseRandomAccess option

If enabled, ART will advise random access to the kernel for files
that are thought to have such access patterns.

Bug: 67772594
Test: verify that -XX:MadviseRandomAccess:true is passed to runtime init
Change-Id: Iaaf8159d2ed69ed4968870a6104e3d1a8454b711
68bf3903250ff0bea11c4705ba331818c5bf5792 07-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Handle new zygote flags in ART

Add support for DISABLE_VERIFIER and ONLY_USE_SYSTEM_OAT_FILES.

bug: 30972906
bug: 63920015

Test: device boots
Change-Id: I7c4eddc070908aed980d54d374c0b261d1f32d57
77fee87b262e969b29a9ac121a8bcbf87b68d9ce 05-Sep-2017 Alex Light <allight@google.com> Add support for JVMTI monitor events.

Adds support for the JVMTI can_generate_monitor_events capability and
all associated events. This adds support for the
JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED,
JVMTI_EVENT_MONITOR_CONTENDED_ENTER, and
JVMTI_EVENT_MONITOR_CONTENDED_ENTERED events.

Bug: 65558434
Bug: 62821960
Bug: 34415266

Test: ./test.py --host -j50

Change-Id: I0fe8038e6c4249e77d37a67e5056b5d2a94b6f48
0a87a653a296854c9a0abacd9bb1557ee4c4d05d 12-Apr-2017 Mingyao Yang <mingyao@google.com> Add two special runtime methods.

This is in preparation for being able to deoptimize upon returning
from a runtime method. We need to identify two special runtime methods:
clinit and suspend-check since if deoptimization happens when returning
from these two methods, we need to execute the dex instruction that
corresponds to the dex pc of the deoptimization point. A clinit can
be implicit for an invoke-static, in which case the invocation hasn't
happen yet so we have to execute the invoke-static in the interpreter.
For a suspend-check, the dex instruction for it hasn't been executed yet.

Test: full run-test/gtest on both host and target.
Bug: 33616143
Change-Id: Id1bdfcfa84a9ca27d5ee9da4b4a99467b1a4a845
55e6b552af6aa34439cb0699db5ddf08c437719b 25-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move CHA to ClassLinker

Move the ClassHierarchyAnalysis singleton to ClassLinker. Hierarchy
analysis is a link-time effort and belongs to class-loading instead
of the global Runtime object.

Also clean up to use a unique_ptr, and add null checks to allow
bypassing the analysis.

(cherry-picked from commit c1ac9ee48ddf483ec770b424d63de4982262ea33)

Bug: 34193647
Bug: 63467744
Test: m test-art-host
Change-Id: I14ef536e37eb19c0dede372ffd68a826c482cf71
605fe24d07062a038c8332a4d98f47052e9cee6a 21-Jul-2017 Chang Xing <chxing@google.com> Implemented Nested Transaction

Transaction can be created recursively and every transaction knows which
class it is created for.

The goal of implementing nested transaction is to let every class
initialization (especially execution of class initializer) associates
with one transaction which provides the ability to track whether field
accesses are valid. To achieve this goal, we implemented a subclass for
ClassLinker called AotClassLinker, which will be instantiated instead of
ClassLinker under AOT compiler.

All invocations of InitializeClass happens at AOT compiler will be
wrapped with creating and destorying transactions.

Transactions will be paused when rollbacking, otherwise the memory will
not be rollbacked properly.

The use the transaction is changed and all usage are updated,
corresponding with native tests mentioning transaction, including
transaction_test and unstarted_runtime_test.

The validation rules will be implemented and explained in another CL.

Test: make test-art-host -j64

Change-Id: If53d3ee3231c337a9ea917f5b885c173917765de
5a906fcc111ffc07d9fd1e7265e8b4a89609f00e 27-Jul-2017 Chang Xing <chxing@google.com> Add strict flag in transaction

Add a flag named strict_ indicating whether we are compiling app images,
which need more strict constraints to control <clinit>s' behavours.

When the transaction is marked as strict mode, behaviour changes
including nested transactions, field access validation, memory
consumption limit and time out for <clinit> at compile time.

Test: make test-art-host -j64

Change-Id: I7cc0eea161803ad0d7763725d4deaeee21858054
c1ac9ee48ddf483ec770b424d63de4982262ea33 25-Jul-2017 Andreas Gampe <agampe@google.com> ART: Move CHA to ClassLinker

Move the ClassHierarchyAnalysis singleton to ClassLinker. Hierarchy
analysis is a link-time effort and belongs to class-loading instead
of the global Runtime object.

Also clean up to use a unique_ptr, and add null checks to allow
bypassing the analysis.

Bug: 34193647
Test: m test-art-host
Change-Id: I14ef536e37eb19c0dede372ffd68a826c482cf71
cade5c3c75588da6d873df727acdaf3378a66efa 21-Jul-2017 Chang Xing <chxing@google.com> Track class initializing in transaction

Add a field and a corresponding constructor to transaction which keeps
track of the class that the transaction is initializing.

To implement constraints for <clinit> behaviors, the transaction needs
to know which class it is initializing.

Test: make test-art-host -j64
Change-Id: I87b3fcb3ef15914c79c6687ec8a87058265eaead
16d1dd86dca33520b44d9802695e19d3b658af3e 21-Jul-2017 Chang Xing <chxing@google.com> Move transaction creation to runtime

Move the transaction creation to runtime instead of passing a pointer to
runtime when EnterTransactionMode. Because later there will be more
places to create transaction so this makes the code cleaner and more
compact.

Test: make test-art-host -j64
Change-Id: I971edf3110eb6634b6e0f7f56256be04517a5281
0ffbe5f14b14e84585a75ababd4864c187afae04 22-Jun-2017 Andreas Gampe <agampe@google.com> ART: Refactor abort code

Remove Runtime::Aborter and let Runtime::Abort set the abort message
on target.

This works around a missing tail-call optimization that leads to a
superfluous frame on the call-stack when aborting.

Partially reverts commit 3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0.

(cherry picked from commit 51d80ccca5eb2ea0eef0de836dcc03e0545f63db)

Bug: 62810360
Test: m test-art-host
Test: Manual inspection of abort dump
Change-Id: Ie4efc8bbdc8b665b23081b37a11921fe26b182b4
51d80ccca5eb2ea0eef0de836dcc03e0545f63db 22-Jun-2017 Andreas Gampe <agampe@google.com> ART: Refactor abort code

Remove Runtime::Aborter and let Runtime::Abort set the abort message
on target.

This works around a missing tail-call optimization that leads to a
superfluous frame on the call-stack when aborting.

Partially reverts commit 3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0.

Bug: 62810360
Test: m test-art-host
Test: Manual inspection of abort dump
Change-Id: Ie4efc8bbdc8b665b23081b37a11921fe26b182b4
8228cdf4ad6322ec8133564aaa51f966d36c0f17 31-May-2017 Andreas Gampe <agampe@google.com> ART: Move CalleeSaveType to callee_save_type.h

Move the type out of runtime to decrease dependencies. Make it
a proper enum class. Fix up usage.

Test: m test-art-host
Change-Id: Id84c44bf3c59f37c8a43548e720c5fb65707b198
d482e73fe26cb9161511a80e3db39e08b9808ab6 25-Apr-2017 Andreas Gampe <agampe@google.com> ART: More header cleanup - runtime.h

Remove unnecessary runtime.h includes. Refactor other headers
(move to forward declarations) to make this possible.

Test: mmma art
Change-Id: I297f0ad444ba92169edd16d8c7cbe95bb6dbb800
0ebb078b8356c540a4bb5b5ccbd6f55abafc181f 24-May-2017 Nicolas Geoffray <ngeoffray@google.com> Record types when the interpreter executes intrinsics.

Otherwise, we could keep on deopting, as the JIT compiler wouldn't
see those types when doing inlining decisions.

bug: 37655083
Test: 652-deopt-intrinsic

(cherry picked from commit b9bec2e3846f3f500ca1354c849a81dfbb095b6b)

Change-Id: I8918626f78255ab2f6f2fd2f51017fb9fa7d4f99
b9bec2e3846f3f500ca1354c849a81dfbb095b6b 24-May-2017 Nicolas Geoffray <ngeoffray@google.com> Record types when the interpreter executes intrinsics.

Otherwise, we could keep on deopting, as the JIT compiler wouldn't
see those types when doing inlining decisions.

bug: 37655083
Test: 652-deopt-intrinsic
Change-Id: I33908a8e1565ac2eb9bd3ba9033916173ede4560
eb71033745325ffd5682fe7a6a48900e74657b02 10-May-2017 Narayan Kamath <narayan@google.com> ART: Use file descriptors handed out by tombstoned for traces.

There no longer needs to be any logic in ART to generate file
names and create files. The test of file creation logic has
therefore been deleted.

Test: manual, tests in other components.
Bug: 32064548

Change-Id: I9bce6ddf3270839c40060d1287e79f9bd57d75aa
2ac67d526eb348019433138b04eb1473d45cb0f4 12-May-2017 Andreas Gampe <agampe@google.com> ART: Reserve sentinel fault page

Attempt to reserve a single page on startup that contains addresses we
use for clobbering.

Test: m test-art-host
Change-Id: Ibc0a29c99ff3ff42290877faaadcb914234024e4
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
993f0cb5597c32dc90e8d56801f71540d2412335 10-May-2017 Nicolas Geoffray <ngeoffray@google.com> Fix braino in enum use.

bug:37655083
Test: jdwp

(cherry picked from commit 81cc43e7d3c4dcd197b3d3a0fa9d1a3be9413367)

Change-Id: I566cc66efc6e1377c53650bfca9e4ffa2ffcb533
81cc43e7d3c4dcd197b3d3a0fa9d1a3be9413367 10-May-2017 Nicolas Geoffray <ngeoffray@google.com> Fix braino in enum use.

bug:37655083
Test: jdwp
Change-Id: I9611a43553aa753d2b8e9cb0dcd99484560f3e62
79efadfdd861584f1c47654ade975eae6c43c360 08-May-2017 Nicolas Geoffray <ngeoffray@google.com> Add runtime reasons for deopt.

Currently to help investigate. Also:
1) Log when deoptimization happens (which method and what reason)
2) Trace when deoptimization happens (to make it visible in systrace)

bug:37655083
Test: test-art-host test-art-target

(cherry picked from commit 4e92c3ce7ef354620a785553bbada554fca83a67)

Change-Id: I992398a1038ab61ea0e5106af6b6ad0a3305312e
4e92c3ce7ef354620a785553bbada554fca83a67 08-May-2017 Nicolas Geoffray <ngeoffray@google.com> Add runtime reasons for deopt.

Currently to help investigate. Also:
1) Log when deoptimization happens (which method and what reason)
2) Trace when deoptimization happens (to make it visible in systrace)

bug:37655083
Test: test-art-host test-art-target
Change-Id: I0c2d87b40db09e8e475cf97a7c784a034c585e97
bcea58374cbd1447c2c7f2ffdc08e10e8accb721 03-May-2017 Igor Murashkin <iam@google.com> runtime: Properly unload partially loaded image spaces

When one of the (non-app) image space successfully loads,
it sets up runtime callee-save methods.

If it is later unloaded, callee-save methods are now pointing to memory
that is no longer valid (viewed as all 0s in the debugger).

Runtime::Init skips creating its own runtime methods if it already sees
that the runtime methods were set to non-null, thus dangling runtime
methods.

This crash would nominally manifest itself in unwinding the first time, or as a DCHECK
failure in the interpreter bridge invocation during aborting if debugging was enabled.

To get into this state:
* Fill up the /data partition (but perhaps leave a little bit of room
for one image, but not all images)
* Reboot the device or run zygote manually.

(cherry picked from commit 8275fbaccc012072948a16f537844a552db9be84)

Test: adb shell dd if=/dev/zero of=/data/local/tmp/tempFiller.deleteMe bs=1024 count=50g ; adb reboot
Bug: 36033084
Change-Id: I728c1058b003fcf5e98dc2746d53e44b688c4605
8275fbaccc012072948a16f537844a552db9be84 03-May-2017 Igor Murashkin <iam@google.com> runtime: Properly unload partially loaded image spaces

When one of the (non-app) image space successfully loads,
it sets up runtime callee-save methods.

If it is later unloaded, callee-save methods are now pointing to memory
that is no longer valid (viewed as all 0s in the debugger).

Runtime::Init skips creating its own runtime methods if it already sees
that the runtime methods were set to non-null, thus dangling runtime
methods.

This crash would nominally manifest itself in unwinding the first time, or as a DCHECK
failure in the interpreter bridge invocation during aborting if debugging was enabled.

To get into this state:
* Fill up the /data partition (but perhaps leave a little bit of room
for one image, but not all images)
* Reboot the device or run zygote manually.

Test: adb shell dd if=/dev/zero of=/data/local/tmp/tempFiller.deleteMe bs=1024 count=50g ; adb reboot
Bug: 36033084
Change-Id: I728c1058b003fcf5e98dc2746d53e44b688c4605
84695aef89a3c42ea81c23f0590ae2ceca09ce6f 07-Apr-2017 Narayan Kamath <narayan@google.com> ART: Support per PID stack trace files.

Introduce an -Xstacktracedir argument that supplies a directory
under which stack traces are written, with a unique file created
per trace. The location of the actual directory in a production
system is still not decided, and follow up changes might be
introduced to supply a per process override.

Bug: 32064548
Test: test-art-host, test-art-target

Change-Id: If377ce6a2abe8b325f6441d8de222b1ea3f40ec9
65af20b1aaa2b23abaae3e4a21d7b6cdcb156889 20-Apr-2017 Alex Light <allight@google.com> Agent libraries need to be searched for JNI functions

This makes agent libraries the option of last resort for native
method implementations. This will allow one to not need to manually
link all native methods in an agent library.

Bug: 37522517
Bug: 37432636
Test: ./test.py --host -j40
Change-Id: I5ad78a15e7e2799d2a877c5d603342899e2a1bd1
1d4950167b45369299fe30d7381516c3b5380a01 12-Apr-2017 Mathieu Chartier <mathieuc@google.com> Fix -XX:DumpGCPerformanceOnShutdown for debug builds

There was a failing DCHECK from CheckUnattachedThread. The fix is
to dump after attaching the shutdown thread.

Bug: 35644369
Test: test-art-host

Change-Id: I3d927e380888418167c101b2f09d1e547fe728cf
4151c80397c50177372ed32ca59c6fc4f9995f68 29-Mar-2017 Alex Light <allight@google.com> Change Ti::Agent collection from vector to List

We want these to be in a list to avoid the need for moving them
around, which would introduce the need to perform annoying accounting.

Test: ./test.py --host -j40
Bug: 36716572
Bug: 31455788
Change-Id: Ie16523f4e7d79934fa7844fb9b9a26e125cfa9eb
(cherry picked from commit 4b812faa25454bda4d6e79a305938449a54a3e41)
4b812faa25454bda4d6e79a305938449a54a3e41 29-Mar-2017 Alex Light <allight@google.com> Change Ti::Agent collection from vector to List

We want these to be in a list to avoid the need for moving them
around, which would introduce the need to perform annoying accounting.

Test: ./test.py --host -j40
Bug: 36716572
Bug: 31455788
Change-Id: Ie16523f4e7d79934fa7844fb9b9a26e125cfa9eb
77651c4bbd56d502bcf05347e641061bbebca099 04-Mar-2017 Calin Juravle <calin@google.com> ART: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170

(cherry picked from commit 868515e2606820ea96f8b9022b442f5bcc770867)

Change-Id: If51b3301c845a8c3bbaf87d0e35a12c700e1d0aa
Merged-In: I5a04d3bba29581dedf05e21b8b20d79afa9b405a
868515e2606820ea96f8b9022b442f5bcc770867 04-Mar-2017 Calin Juravle <calin@google.com> ART: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170
Change-Id: I5a04d3bba29581dedf05e21b8b20d79afa9b405a
bad529da18122c7044fbfd7d56153535d34367b1 14-Feb-2017 Andreas Gampe <agampe@google.com> ART: Add currentThread cutout to Unstarted Runtime

Add currentThread() and getThreadState() cutouts to the unstarted
runtime to allow further compile-time initialization. The cutouts
are protected by call-stack checks.

Add tests.

Bug: 34956610
Test: m test-art-host-gtest-unstarted_runtime_test
Change-Id: I6335bccda8bedae90376fc7c47b303576f1ac78b
433b79a9130df5f2375b9d3d7518c1f3fb84a467 30-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "Make --debuggable rely on JIT code.""

Fixed by https://android-review.googlesource.com/#/c/330165/

This reverts commit 81356645157af44152c7b7db383596b5cf3479b5.

Change-Id: Ifb74e1cc90ab6dea621f7f54a00b540d6ccd0cf6
81356645157af44152c7b7db383596b5cf3479b5 30-Jan-2017 Vladimir Marko <vmarko@google.com> Revert "Make --debuggable rely on JIT code."

Breaks 137-cfi with ART_TEST_RUN_TEST_DEBUGGABLE=true

This reverts commit a0619e25aacf8b8074132f4951f75fdbcfd42925.

bug: 28769520
Change-Id: Ifd7b8fc7c9b72c0a523fd57c4b1b80edd3547caa
a0619e25aacf8b8074132f4951f75fdbcfd42925 20-Dec-2016 Nicolas Geoffray <ngeoffray@google.com> Make --debuggable rely on JIT code.

Removes -Xfully-deoptable in the process, which was added as a
temporary workaround until this CL.
Partial revert of https://android-review.googlesource.com/#/c/302232/

Makes things consistent with existing infrastructure:

- Parse the --debuggable from the compiler options, just like
--compiler-filter.

- Add DEBUG_JAVA_DEBUGGABLE, passed by the zygote, for debuggable apps.

- Java debuggable now solely relies on JIT for simplicity.

- Debugging under userdebug for non-java-debuggable apps is still
best effort.

Test: test-art-host, jdwp

bug: 28769520
Change-Id: Id0593aacd85b9780da97f20914a50943957c858f
ac30fa2151095d2b5fe42f169a02ed09fea312b4 19-Jan-2017 Andreas Gampe <agampe@google.com> ART: Make RuntimeCallbacks unique_ptr

Reduce the transitive closure of headers on runtime.h

Test: m
Change-Id: Ib5a3632c28b08bf07773f217a7ad711c1f12af6b
04bbb5be5b9c0f0b3a72116353d23ea63c8bc5e9 19-Jan-2017 Andreas Gampe <agampe@google.com> Revert "Revert "ART: Start RuntimeCallbacks""

This reverts commit bf6331a45f730e1f1044af2ce43bceda660ae6fc.

Switch to using the mutator lock.

Bug: 31684920
Test: m test-art-host-gtest-runtime_callbacks_test
Test: art/tools/run-jdwp-tests.sh --mode=host --debug
Change-Id: I6ce0f71de2aa9f90cd23cfca7723a793b560b16b
bf6331a45f730e1f1044af2ce43bceda660ae6fc 19-Jan-2017 Nicolas Geoffray <ngeoffray@google.com> Revert "ART: Start RuntimeCallbacks"

jdwp tests failing with:
STDERR> dalvikvm32 E 01-18 23:14:50 12180 12198 thread-inl.h:137] holding "runtime callbacks lock" at point where thread suspension is expected

Bug: 31684920

This reverts commit 13093d455b8266338fd713b04261c58e9dc2b164.

Change-Id: I94e4154e273d006eecdd485607dcfd96392d6a00
9a506613529a17b7372a3abb02b9ffee8ea507d7 19-Jan-2017 Andreas Gampe <agampe@google.com> ART: Remove unused runtime.h include

This has not been used since 98e6ce44c700abd9375fe17f0aa31fea1e1e938b.

Test: m
Change-Id: If10971f9fcfb2417eece23f0c9186734314ad81b
13093d455b8266338fd713b04261c58e9dc2b164 18-Jan-2017 Andreas Gampe <agampe@google.com> ART: Start RuntimeCallbacks

Add a central RuntimeCallbacks structure to handle certain interesting
runtime events.

In a first iteration, add ThreadLifecycleCallback with ThreadStart and
ThreadStop. Move Dbg over to ThreadLifecycleCallback.

Add a test.

Bug: 31684920
Test: m test-art-host-gtest-runtime_callbacks_test
Test: art/tools/run-jdwp-tests.sh --mode=host
Change-Id: Ie0f77739a563207bfb4f04374e72dc6935c40b4f
9320675cb21a53b3dd59d80d440a96e04c84f28d 17-Jan-2017 Narayan Kamath <narayan@google.com> MethodHandles: Remove experimental flag.

Runtime::IsMethodHandlesEnabled now always returns true.
This change also removes the (now unnecessary) run scripts
for method handle tests.

Note that the --experimental=method-handles flag is left in
place for the test build steps (etc/default-build) because it's still a
convenient way to supply arguments to jack / smali.

Test: make test-art-host

Change-Id: I8475c7b8ac2615ac382a06ce54be39dce3cc7713
40d4c7636e51f910b2c9ef226b7183e6ccc9ab4b 08-Nov-2016 neo.chae <neo.chae@lge.com> Add visiting for class loaders in StickyMarkSweep

StickyMarkSweep clear the mark stack,
Because all reachable objects must be referenced by a root or a dirty card.
But, there are some marking hole for class object.

If some object is marked and the object and it's class object is not dirty,
Then class object cannot be marking by card table.

In previous OS including mashmellow,
Class table was maintaned by class linker
and all class object was marked with kVisitRootFlagAllRoots flag.

In N OS,
Class object is not marked with kVisitRootFlagAllRoots.
So, I added new flag to mark class object and using it StickyMarkSweep.

Added regression test in 141-class-unload.

Test: test-art-host
Merged-In: I57599e6db53b260f4c5ef466b63962141b8da5c3

(cherry picked from commit a2d1b28599e38ee0180f0f7130a879eac5be9dec)

Bug: 33924225

Change-Id: I57599e6db53b260f4c5ef466b63962141b8da5c3
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
b3da36c182329f228b8c78d306a57fa11a6004ea 15-Dec-2016 Hans Boehm <hboehm@google.com> Reduce the number of fences needed for monitors

Add the necessary CasWeakAcquire primitives for LockWords.

Have MonitorEnter initially read the lockword using a
memory_order_relaxed operation. In the unlikely case we need more,
compensate with an explicit fence.

In the uncontended case, install the thin lock with Acquire,
rather than SequentiallyConsistent semantics.

Have MonitorExit use a Release instead of SequentiallyConsistent
CAS in the ReadBarrier case. Add TODO for the other case.

Together, these should usually eliminate 3 fences (or acq/rel)
per critical section.

Have Install() only use Release ordering.

Add TODO for inflation spinning, which looks to me like it could be
improved appreciably.

Drive-by fix:

GetMaxSpinsBeforeThinLockInflation spelling

Test: Build for several targets, boot, m art-test-host art-test-target

Change-Id: I2cab09723252065f6365e4234ee3249c69ece888
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
063fc772b5b8aed7d769cd7cccb6ddc7619326ee 02-Aug-2016 Mingyao Yang <mingyao@google.com> Class Hierarchy Analysis (CHA)

The class linker now tracks whether a method has a single implementation
and if so, the JIT compiler will try to devirtualize a virtual call for
the method into a direct call. If the single-implementation assumption
is violated due to additional class linking, compiled code that makes the
assumption is invalidated. Deoptimization is triggered for compiled code
live on stack. Instead of patching return pc's on stack, a CHA guard is
added which checks a hidden should_deoptimize flag for deoptimization.
This approach limits the number of deoptimization points.

This CL does not devirtualize abstract/interface method invocation.

Slides on CHA:
https://docs.google.com/a/google.com/presentation/d/1Ax6cabP1vM44aLOaJU3B26n5fTE9w5YU-1CRevIDsBc/edit?usp=sharing

Change-Id: I18bf716a601b6413b46312e925a6ad9e4008efa4
Test: ART_TEST_JIT=true m test-art-host/target-run-test test-art-host-gtest
8a0128a5ca0784f6d2b4ca27907e8967a74bc4c5 28-Nov-2016 Andreas Gampe <agampe@google.com> ART: Add dex::StringIndex

Add abstraction for uint32_t string index.

Test: m test-art-host
Change-Id: I917c2881702fe3df112c713f06980f2278ced7ed
6b16d891bdf18cabed861cd67407eef9be639efd 11-Nov-2016 Alex Light <allight@google.com> Add option to force all code to be deoptimizable

Currently this can only be passed during runtime startup. We will add
support for doing it from the zygote in the future.

Bug: 28769520
Bug: 32369913

Test: m test-art-host

Change-Id: I5eb16887ea14b140217c123b3effd47c5c8b2768
a2d1b28599e38ee0180f0f7130a879eac5be9dec 08-Nov-2016 neo.chae <neo.chae@lge.com> Add visiting for class loaders in StickyMarkSweep

StickyMarkSweep clear the mark stack,
Because all reachable objects must be referenced by a root or a dirty card.
But, there are some marking hole for class object.

If some object is marked and the object and it's class object is not dirty,
Then class object cannot be marking by card table.

In previous OS including mashmellow,
Class table was maintaned by class linker
and all class object was marked with kVisitRootFlagAllRoots flag.

In N OS,
Class object is not marked with kVisitRootFlagAllRoots.
So, I added new flag to mark class object and using it StickyMarkSweep.

Added regression test in 141-class-unload.

Test: test-art-host

Change-Id: I57599e6db53b260f4c5ef466b63962141b8da5c3
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
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
d98b4ed7a73af40f5292337495333616d9974da0 05-Nov-2016 Andreas Gampe <agampe@google.com> ART: Make excludes explicit

Fix some missing lock excludes.

Test: m
Change-Id: If74708c5d16469490e3374b7d5ffc23dd2ea5ec1
5c657fe8e3afdce77dc610446f37a43865cff702 03-Nov-2016 Vladimir Marko <vmarko@google.com> Pass some arguments by const reference.

Test: Rely on TreeHugger.
Bug: 32619234
Change-Id: Ia26277893641dcb3562eaeacaec4e089a978d56a
3d74bf45706429f0cbfce0c1e7d213416c5ecf50 02-Nov-2016 Narayan Kamath <narayan@google.com> Revert accidental change introduced in 000e188570.

Test: make test-art-host
Bug: 30550796
Change-Id: I1f4c7e4c2f6778b28d52bc3be419810d21d9378e
9e868098b4a5d666570e3924518978d7abd3542e 31-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move intern table to ObjPtr

Also moved StringLog to use a GcRoot.

Also removed read barriers from lookup to prevent making weak strings
strongly live more often than necessary.

Bug: 31113334

Test: clean-oat-host && test-art-host CC baker

Change-Id: I05586e125d5dfed8d184890468fd398c79f32619
000e1885701c8fdad07a784e3771881fa9be1d8a 24-Oct-2016 Narayan Kamath <narayan@google.com> method_handles: Complete support for emulated stack frames.

Most of this change is a refactor that templatizes the code
that performs argument conversions. This allows us to copy arguments
between two shadow frames, or an emulated stack frame and a shadow
frame.

Test: make test-art-host
Bug: 30550796

Change-Id: I23e65735a2dbd28f3c7b7d1ccf9762e77e0cf1f1
eb84221ffc00357be6d69e2e461c7a45ee96334a 07-Oct-2016 Leonard Mosescu <mosescu@google.com> Enable agent attaching during live phase

This is the ART part, the plumbing from VMDebug_attachAgent() to
actually loading the agent into the runtime.

Test: m test-art-host

Bug: 31682382

Change-Id: I3ccc67aa050c1f78278882128983686ed44ddec2
da0a69edb24122d3d35ce1483c5ab94de919d714 11-Oct-2016 Richard Uhler <ruhler@google.com> Return error message if IndirectReferenceTable construction fails.

Previously if there was an error when constructing the
IndirectReferenceTable, the error message was lost. Now expose and
include the error message when throwing an exception related to
failures to construct the IndirectReferenceTable.

The error message is propagated through JVMEnvExt, JavaVMExt, and
Runtime::Init as well.

Bug: 32013594
Test: Added new 151-OpenFileLimit runtest.
Test: m test-art-host, m test-art-target

Change-Id: I3692f6928c9570358571bce634569d6f14cdeb05
f57589fd40e5b69dad5aff060ccef756507f381a 17-Oct-2016 David Sehr <sehr@google.com> Remove logging dependency on runtime

Moved the abort backtracing function to runtime, forcing callers to
supply the aborter at InitLogging. This makes runtime properly layer
on top of logging by removing the cyclic dependency.

Bug: 22322814
Test: test-art-host
Change-Id: I8b2e72174e937bb88fe1bddd6d04b564cfb011a9
a058fdf0cf7435a13a6e8cae5e3a9bfa1513828d 07-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move mirror::Object setters to ObjPtr

Bug: 31113334

Test: test-art-host

Change-Id: I2c4c84645e194c3c435a4a6fd670176b0e98671f
8778c521de4f686118549ef7b20ae497e53b9e93 05-Oct-2016 Mathieu Chartier <mathieuc@google.com> Change indirect reference table to use ObjPtr

Bug: 31113334

Test: test-art-host

Change-Id: I340fdf430897ebd790ea4e35f94bcee776e98445
47d522b27febaeb4168b9069550218b3f55e1905 04-Oct-2016 Andreas Gampe <agampe@google.com> ART: Reprint long messages on abort

Add an abort message parameter to Runtime::Abort. In case the message
is multiline (and will thus not be completely preserved in the
Android abort reason), reprint the message after all threads have
been dumped.

Bug: 31893081
Test: m test-art-host
Change-Id: I65bc77691fec79f7c868a90d6132805fcc91e473
(cherry picked from commit 90a32b16feb58d4edf932fdcb6a070be3418e365)
90a32b16feb58d4edf932fdcb6a070be3418e365 04-Oct-2016 Andreas Gampe <agampe@google.com> ART: Reprint long messages on abort

Add an abort message parameter to Runtime::Abort. In case the message
is multiline (and will thus not be completely preserved in the
Android abort reason), reprint the message after all threads have
been dumped.

Bug: 31893081
Test: m test-art-host
Change-Id: I65bc77691fec79f7c868a90d6132805fcc91e473
25352fc06c84cdab8a2ab6d173b0514066ade2b9 03-Aug-2016 Narayan Kamath <narayan@google.com> class_linker: Add support for resolving method types.

- Add a new fixed size dex cache array for resolved method types.
The size of this array is set to 1024.
- Also introduces a new runtime flag that controls this feature.

Test: make test-art-host
Bug: 30550796

Change-Id: I147b33398d71ee21f2e91b418d3700d4630801ff
b2267032bd852c5566462057135967b24fdfe076 14-Sep-2016 Robert Sesek <rsesek@google.com> Move art::Runtime::InitZygote logic from art into frameworks/base.

Test: m test-art
Test: m
Test: aosp_angler-eng boots
Change-Id: I119cdd74e5909137365ce723fca1a003ef3c5f95
fda5714edb368270b7ef639054f4cba1d5f4874c 09-Sep-2016 Andreas Gampe <agampe@google.com> ART: Add generic system-weak holder infrastructure

Add an "interface" for a generic system-weak holder that is
integrated with the well-known instances in Runtime. Add a
simple implementation handling synchronization.

Add a test.

Bug: 31385027
Test: m test-art-host-gtest-system_weak_test
Test: m ART_USE_READ_BARRIER=true test-art-host-gtest-system_weak_test
Test: m ART_DEFAULT_GC_TYPE=SS test-art-host-gtest-system_weak_test
Test: m ART_DEFAULT_GC_TYPE=GSS test-art-host-gtest-system_weak_test
Change-Id: I1100e2cbd9ee57860993d0039de73d197681c542
bb816d66aabb9c2a2e095517d2013041116332db 07-Sep-2016 Mathieu Chartier <mathieuc@google.com> Add transactions for string resolve

Fixes a bug where resolved strings can be left in the dex cache after
a transaction is rolled back even though the interned string was
removed.

Added test in transaction_test.

Bug: 31239436

Test: test-art-host

Change-Id: I42c67bcefeae8db134cde34c480261f52db4102e
0e4a2f0d6b526d398b71a54395c3071a8e78e503 17-Aug-2016 David Sehr <sehr@google.com> Save environment snapshot and use at fork/exec

Some applications may inadvertently or maliciously set of environment
variables such as LD_LIBRARY_PATH before spawning subprocesses.
To make this more difficult, save the environment at the time the
runtime starts and use the saved copy anytime Exec is called.

BUG: 30160149
TEST: make test-art-{host,target}

Change-Id: I887b78bdb21ab20855636a96da14a74c767bbfef
(cherry picked from commit d106d9f871c957286ccdeb79c1c2a5ed41f859a6)
bdf7f1c3ab65ccb70f62db5ab31dba060632d458 31-Aug-2016 Andreas Gampe <agampe@google.com> ART: SHARED_REQUIRES to REQUIRES_SHARED

This coincides with the actual attribute name and upstream usage.
Preparation for deferring to libbase.

Test: m
Test: m test-art-host
Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
d106d9f871c957286ccdeb79c1c2a5ed41f859a6 17-Aug-2016 David Sehr <sehr@google.com> Save environment snapshot and use at fork/exec

Some applications may inadvertently or maliciously set of environment
variables such as LD_LIBRARY_PATH before spawning subprocesses.
To make this more difficult, save the environment at the time the
runtime starts and use the saved copy anytime Exec is called.

BUG: 30160149
TEST: make test-art-{host,target}

Change-Id: I887b78bdb21ab20855636a96da14a74c767bbfef
47393386aa1f44c61a10045c7dbb5d559c9f7cab 23-Aug-2016 David Sehr <sehr@google.com> Revert "Save environment snapshot and use at fork/exec"

This reverts commit 1488ff8aa3b041734ef0fbd113df512a2376e44e.

Change-Id: I3c237c94ffa865378f8efd9aa2b0fb2ad33867c2
1488ff8aa3b041734ef0fbd113df512a2376e44e 17-Aug-2016 David Sehr <sehr@google.com> Save environment snapshot and use at fork/exec

Some applications may inadvertently or maliciously set of environment
variables such as LD_LIBRARY_PATH before spawning subprocesses.
To make this more difficult, save the environment at the time the
runtime starts and use the saved copy anytime Exec is called.

BUG=b/30160149
TEST=make test-art-{host,target}-gtest-utils_test

Change-Id: Ice0097bf0de30db3d4ead124caf93316f39e3df3
185d134a3b43ab7529053e965917e0fa74bceba4 11-Aug-2016 Alex Light <allight@google.com> Add basic runtime-plugins support.

This allows one to pass shared-libraries on the command line that the
runtime will load as plugins. They have access to runtime code and can
install hooks to add functionality. Currently the only hook they can
touch is JavaVMExt::AddEnvironmentHook to register a callback for
GetEnv(). More hooks might be added in the future.

Test: ./test/run-test 900
Change-Id: I852b4daf5a3fa71e9888722bc07794632c0e5010
7233c7e752c0d26387d143ee74420e9cd1f09390 28-Jul-2016 Alex Light <allight@google.com> Create a basic agent loading framework.

Currently we only allow agents to be loaded at runtime startup, though
this is expected to change soon.

Test: ./test/run-test --host 900
Change-Id: Id648eaed4bbbe6fdef41d64922d023a4db0bfa54
fd36f1f927c138575184a1f4c7ea4e7abb3e2dbf 03-Aug-2016 Vladimir Marko <vmarko@google.com> Rename callee save enumerators.

And related image method enumerators, macros, etc.
Clean up some entrypoint assembly comments.

This is a follow-up to
https://android-review.googlesource.com/252348

Test: Run ART test suite on host and Nexus 9.
Bug: 30212852
Change-Id: I2707342d4255c88c547655be83ed97a67e12ae9e
14832efeb92334c562ebedef34e920d30e3cee69 05-Aug-2016 Narayan Kamath <narayan@google.com> Revert experimental lambda feature.

This is a revert of the following changes :

30c475a2046951a81769c2db0b2dad66cd71e189.
lambda: Minor capture-variable/liberate-variable clean-up after post-merge reviews.

6918bf13eb855b3aa8ccdddda2d27ae8c60cec56.
lambda: Experimental support for capture-variable and liberate-variable

fc1ccd740b7c8e96dfac675cfc580122cd1b40a6.
lambda: Infrastructure to support capture/liberate-variable dex opcodes

e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7.
runtime: Add lambda box/unbox object equality

2ee54e249ad21c74f29a161e248bebe7d22fddf1.
runtime: Partially implement box-lambda and unbox-lambda experimental opcodes

158f35c98e2ec0d40d2c032b8cdce5fb60944a7f.
interpreter: Add experimental lambda opcodes for invoke/create-lambda

a3bb72036f5454e410467f7151dc89f725ae1151.
Added format 25x to dexdump(2).

Plus surrounding cleanups.

Test: make test-art
Change-Id: Ic6f999ad17385ef933f763641049cf721510b202
952dbb19cd094b8bfb01dbb33e0878db429e499a 28-Jul-2016 Vladimir Marko <vmarko@google.com> Change suspend entrypoint to save all registers.

We avoid the need to save/restore registers in slow paths
and get significant code size savings. On Nexus 9, AOSP:
- 32-bit boot.oat: -1.4MiB (-1.9%)
- 64-bit boot.oat: -2.0MiB (-2.3%)
- other 32-bit oat files in dalvik-cache: -200KiB (-1.7%)
- other 64-bit oat files in dalvik-cache: -2.3MiB (-2.1%)

Test: Run ART test suite on host and Nexus 9 with gc stress.
Bug: 30212852
Change-Id: I7015afc1e7d30341618c9200a3dc9ae277afd134
138dbff9246c89ac9fbe0b086b54fdab3f4451fb 28-Jun-2016 Calin Juravle <calin@google.com> Clean up profiler options

- remove obsolete options
- using ProfileSaverOptions instead of hard-coded values in the profile
saver

Bug: 24698874
Change-Id: I4ff535d29a644d1bd5509844f89615b70a723749
Test: cmdline_parser_test, gtest and run-tests pass.
f711f2cf3c28dfe865e36f17419a16f06a0ebb5a 23-May-2016 Mingyao Yang <mingyao@google.com> Partial fragment deoptimization

We used to do either single frame deoptimization, or full fragment
deoptimization which deoptimizes all the frames in a fragment.
This change allows some methods to be not deoptimizeable, likely due
to some kind of optimization. So we need another deoptimization mode
that unwinds partial fragment. Deoptimizations are now generalized into
either full or partial fragment. A full fragment deoptimization will
deopt all frames in the fragment, and then returns from the invoke stub
to enter interpreter. A partial fragment deoptimization will deopt a
single frame, or all frames up to the method that's not deoptimizeable,
and then jumps to the interpreter bridge.

Currently code not deoptimizeable is the code in boot image since the
code may not be compiled with debuggable flag.

Bug: 28769520
Change-Id: I875c694791cc8ebd5121abcd92ce7b0db95aca38
d361afbf6677b5af99fe2a44e92ef9d6e3ad7c17 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

(cherry picked from commit cdca476bf3394ce9d97a369e84e701b427009318)

Change-Id: Iedb4ca9a28ae178fa7c2d486803fa27b402a85ed
946593d7c593c912684022a808fd156e17852248 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

(cherry picked from commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6)

Change-Id: I475ca30e60691cd00b818aabbeb88e6ce3a2ae17
5c4b2ec16bcd779731bed1d2a0bd902dba3d5f92 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

(cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21)

Change-Id: I3ce151651bf95047b0f692c185016f693ac4f820
91288d8f03b9aab28b61a4a76e552ad7e0c15c8b 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

(cherry picked from commit cdca476bf3394ce9d97a369e84e701b427009318)

Change-Id: Ia94fc7acc7ae3879921c4e8d0a02b156037ac286
d23d7d145c86975acbcc75505b8a323337066ac0 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

(cherry picked from commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6)

Change-Id: Iffd25c5fb732ff72b58c787c107dc33c56f8c8d4
cdca476bf3394ce9d97a369e84e701b427009318 28-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Write conflict tables in image""

Added test.

Bug: 27906566

This reverts commit 8e2478d23e89a7022c93ddc608dcbba7b29b91e6.

Change-Id: I0894f5f7cd11af29ed9d0345b51f527fc8a41d19
ffc87076dda9878cb2cc098149bae441d38b9268 20-Apr-2016 Calin Juravle <calin@google.com> Split profile recording from jit compilation

We still use ProfileInfo objects to record profile information. That
gives us the flexibility to add the inline caches in the future and the
convenience of the already implemented GC.

If UseJIT is false and SaveProfilingInfo true, we will only record the
ProfileInfo and never launch compilation tasks.

Bug: 27916886

(cherry picked from commit e5de54cfab5f14ba0b8ff25d8d60901c7021943f)

Change-Id: I68afc181d71447895fb12346c1806e99bcab1de2
97cbc9206e9adc473a90650ebdb5d620f517ff04 15-Apr-2016 Calin Juravle <calin@google.com> Allow the framework to register sensistive threads to the runtime

Bug: 27865109
Bug: 28065407

(cherry picked from commit 8fff24953c78bd58f3a42ac83b340b90e7e7228a)

Change-Id: I82094e46a2fd12617e091d98831193f9ff56d26b
8e2478d23e89a7022c93ddc608dcbba7b29b91e6 27-Apr-2016 Mathieu Chartier <mathieuc@google.com> Revert "Write conflict tables in image"

Some strange issues on angler.

This reverts commit cda9386add68d94697449c6cb08b356747e55c21.

Change-Id: Iba3a8bac6ce40ee16d83163823356951fecb6787
e42888f9df4163303244070c65d5229d3e201742 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

(cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21)

Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
cda9386add68d94697449c6cb08b356747e55c21 14-Apr-2016 Mathieu Chartier <mathieuc@google.com> Write conflict tables in image

Add image sections for runtime methods and conflict tables. This
makes it that we do not need to fake up a length prefixed array
for runtime methods.

Reduces .art private dirty and PSS.

System wide .art PSS goes from 32.5MB to 30.5MB after system boot.

Business card .art private dirty goes from 588K to 504K.

Increases image size by ~100K.

Bug: 27906566

Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
e5de54cfab5f14ba0b8ff25d8d60901c7021943f 20-Apr-2016 Calin Juravle <calin@google.com> Split profile recording from jit compilation

We still use ProfileInfo objects to record profile information. That
gives us the flexibility to add the inline caches in the future and the
convenience of the already implemented GC.

If UseJIT is false and SaveProfilingInfo true, we will only record the
ProfileInfo and never launch compilation tasks.

Bug: 27916886
Change-Id: I6e4768dc5d58f2f85f947b276b4244aa11ce3fca
8fff24953c78bd58f3a42ac83b340b90e7e7228a 15-Apr-2016 Calin Juravle <calin@google.com> Allow the framework to register sensistive threads to the runtime

Bug: 27865109
Bug: 28065407
Change-Id: Ieac3215879c40b16eb21b47a457fd0345d45177a
f38a6618b453b76a3370bbf6b351971687099388 11-Apr-2016 Andreas Gampe <agampe@google.com> ART: Flag to fail thread creation

Add a flag to mark when the zygote is not allowed to create threads.

Bug: 27248115
Bug: 28149511

(cherry picked from commit 415d8070e37c20dfb7e6dc37e74fdb5fffc2022e)

Change-Id: I1dc3620d9e7d0054c672b993d89459fc4b353dfc
415d8070e37c20dfb7e6dc37e74fdb5fffc2022e 11-Apr-2016 Andreas Gampe <agampe@google.com> ART: Flag to fail thread creation

Add a flag to mark when the zygote is not allowed to create threads.

Bug: 27248115
Bug: 28149511
Change-Id: I1dc3620d9e7d0054c672b993d89459fc4b353dfc
796d63050a18f263b93ea34951a61deaecab3422 13-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Add an ImtConflictTable to better resolve IMT conflicts.

- Attach a ImtConflictTable to conflict runtime ArtMethod.
- Initially 0, a new one will be created at the first hit of
the conflict method.
- If the assembly code does not find a target method in the table,
we will create a new one again, copying the data from the previous
table and adding the new mapping.

Implemented for arm/arm64/x86/x64.

bug:27556801
bug:24769046

Change-Id: Ie74d1c77cf73d451a1142bdc5e3683f9f84bb4e7
f8cb1781a4e4be5df1f845206f7b37ed89092b64 19-Mar-2016 Mathieu Chartier <mathieuc@google.com> Move process state into runtime

Clean up.

Bug: 27420435

(cherry picked from commit f8484c8b55f4b423048f94dfabbe44110a039a9b)

Change-Id: Ia20781ee36e6a31c88ca41d3866b26813cff434d
f8484c8b55f4b423048f94dfabbe44110a039a9b 19-Mar-2016 Mathieu Chartier <mathieuc@google.com> Move process state into runtime

Clean up.

Bug: 27420435

Change-Id: I8fff84ed1b29a12310094b10fb6382268e69d54b
f448016e70fa91269d3750384aab1ac98d7896fd 16-Mar-2016 David Srbecky <dsrbecky@google.com> Do not JIT boot image during native-debugging (keep AOT code instead).

The performance impact is currently significant and being able
to debug framework is not our primary goal for native debugging.

Change-Id: I3366c2a6317004f9dd16700b271a6c9b974f1c6e
a1425a1c9c98ae3fc772834933a5d55566fb5699 12-Mar-2016 Andreas Gampe <agampe@google.com> ART: Remember whether the cache was pruned

Remember (and expose) whether the cache was pruned when initializing
the runtime.

Bug: 27618311

(cherry picked from commit 7ef1b4b20bd7cf485f5e443927c1e6fa797a0439)

Change-Id: I178d18d731a9dce5cb11ed0874c9c9c9d36d7d8e
7ef1b4b20bd7cf485f5e443927c1e6fa797a0439 12-Mar-2016 Andreas Gampe <agampe@google.com> ART: Remember whether the cache was pruned

Remember (and expose) whether the cache was pruned when initializing
the runtime.

Bug: 27618311
Change-Id: I178d18d731a9dce5cb11ed0874c9c9c9d36d7d8e
c90bc92bc577020ff4d3caced4cee1cdf41fa5de 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105

(cherry picked from commit 86a9ebe4197e963249ffbbaa1830da97ed642fa5)

Change-Id: I8be1fd4d854fa1e23c3c1054c9c083ad7b27317b
86a9ebe4197e963249ffbbaa1830da97ed642fa5 24-Feb-2016 Calin Juravle <calin@google.com> Record foreign dex files loaded by the app in the profile

A foreign dex file is a file which is not owned by the app
(it's not part of its code paths or its private data directory).

When such a dex file is loaded by the app, the runtime will record
a marker in a dedicated profile folder (foreing_dex_profile_path).
The marker is just a file named after the canonical location of the
dex file where '/' is replaced by '@'.

The markers will be used by the system server system server to
decide if the apk should be fully or profile guide compiled.

Bug: 27334750
Bug: 26080105
Change-Id: If4fa8208be4e2f6f0b748b8a5417c4ae9c2d5df6
25e0456b6ea13eba290b63ea88b6b7120ed89413 01-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Give the JIT its own arena pool to avoid lock contentions.

Sharing it with the verifier and the class loader is not ideal,
especially at startup time.

bug:27398183
bug:23128949
Change-Id: I1b91663a13f6c5b33ad3b4be780d93eb7fe445b4
ca76a1a0c1737b3e04961ba382c113102fdc00bf 02-Feb-2016 Jean-Philippe Halimi <jean-philippe.halimi@intel.com> Dex-wide ArenaPool scoping for AOT compilation

The Arena Pool is a structure that holds memory allocated by the Arena
Allocator, preventing system allocations and deallocations to occur too often
during AOT compilation. Currently, the Arena Pool holds memory it allocates
during the whole AOT compilation process. Unfortunately, such a behavior
generates memory usage overhead, which is exacerbated by bigger applications
such as Facebook.

In this particular app, method size imbalance provokes unnecessary memory
pressure, as one method might require a lot of arena allocations that won't be
used in the remaining compilation. Because the compiler memory footprint keeps
increasing during AOT compilation, the memory pressure becomes very high.

The proposed patch is an attempt to find a tradeoff between allocations /
deallocations time overhead, and the aforementioned memory pressure overhead
resulting of the allocations being held by the Arena Pool. The patch adds a
feature freeing up all memory allocated in the Arena Pool after each dex file
is done compiling.

We have measured no significant AOT compile-time overhead with the patch
(<0.3%), because the selected dex-file granularity is coarse enough. In the
meantime, it provides significant memory footprint improvements. The impact is
especially big with Facebook, because this app has a few methods generating
huge memory footprint peaks (peak native heap footprint goes down 34%).

Change-Id: I27e867e6a20b8a6c28a82cb83140941a8c2b5847
Signed-off-by: Jean-Philippe Halimi <jean-philippe.halimi@intel.com>
98e6ce44c700abd9375fe17f0aa31fea1e1e938b 16-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Remove string init map.

Partial revert of the String init change.

- Make Quick bailout in the presence of String allocation.
- Rely on the compiler for knowing when dex registers alias.

bug:27173201

Change-Id: I0bf58ba3825c71cef110b53f3a0a6f567cb2ef9a
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
d3e7c6c76f564b58e66010c30b62bb56ef046f2c 04-Feb-2016 Calin Juravle <calin@google.com> Don't use native bridge for non zygote-spawn processes

... unless we force it for testing purposes.

Bug: 26954924
Change-Id: Ib4660a35175abb479d0399e18b6194eb04dbc248
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
4d77b6a511659f26fdc711e23825ffa6e7feed7a 01-Dec-2015 Calin Juravle <calin@google.com> Save profile information in a separate thread.

Previously we would save the profiling information only when the app
was sent to background. This missed on an important number of updates
on the jit code cache and it didn't work for background processes.

Bug: 26080105

Change-Id: I84075629870e69b3ed372f00f4806af1e9391e0f
66f55237679db90cb0a0a265043a787932b466f8 08-Dec-2015 Calin Juravle <calin@google.com> Pass down to the runtime the application code paths.

When registering the app with the runtime the framework needs to pass
down the list of application code paths. This will be used by JIT to
know what profile info to persist.

This fixes the reliance on OatFileManager::GetPrimaryOatFile which may
produce inconsistent results based on external factors (i.e. class path
order or failing to compile the first dex file from the class path)

Bug: 26080105
Change-Id: Iadcebd2684fcd48569e8f76ef21bd4d117fedc05
d66c8621610dc18d324132c8e5b081520f719777 11-Dec-2015 Nicolas Geoffray <ngeoffray@google.com> Special case system_server to not create the JIT code cache.

Change-Id: I34485c709b0c70b8d9c34bebcf399781aebaf11b
88b2b80aed15bb1f931cddd40e44ca525ef10018 04-Dec-2015 Vladimir Marko <vmarko@google.com> Allow initializing runtime with parsed options.

Needed by upcoming refactoring of dex2oat to allow
early writing of dex files to the oat file.

Change-Id: Ia13c26132846801522f181f51f64035d625e8416
31f2c155975c5794d481df03eb0947cb48d2c6b5 23-Oct-2015 Calin Juravle <calin@google.com> Save jit profiling info to file.

Currently saves only the hot method references and omits the inline
cache.

Change-Id: I79e91f855f6b52dc19a9a86662604f2eee16613c
ba69a51724d33444064443e456ce78b71db2fd16 17-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Fix bogus DCHECK and rename DidForkFromZygote.

The method can also be called for non-zygote forked processes.

(cherry picked from commit 9d157e48e0abc48f08fd98e4c5e918d029c1b84c)

Change-Id: Id4f57b77c1a7f802f80e066afcf30afecc198bfc
787ae8eb018d46b4b464e3a7c8de37d9262deb61 05-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Remove DEBUG_JIT from Zygote flags.

The flag is being obsolete by the move to JIT.

(cherry picked from commit 0f042e04efba887557e40f981bd9c41b121c4652)

Change-Id: I32c3183e791690964c00fab02a6ee7bbacf6b665
9d157e48e0abc48f08fd98e4c5e918d029c1b84c 17-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Fix bogus DCHECK and rename DidForkFromZygote.

The method can also be called for non-zygote forked processes.

Change-Id: Ie93f92bdca9fb8d5bccec0e770e71a38aff2aaef
0f042e04efba887557e40f981bd9c41b121c4652 05-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Remove DEBUG_JIT from Zygote flags.

The flag is being obsolete by the move to JIT.

Change-Id: Iefb12690523e45300557701a9b9c0b9f04feff50
07ddb6f713f8c919e6da7c4b473cfb3bacb7cf10 05-Nov-2015 Mathieu Chartier <mathieuc@google.com> Fix elf writer to properly handle empty text sections

Previously, empty text sections caused an underflow in the oat file
size.

Added regression test.

Bug: 22858531
Change-Id: I9391a3666ab04e32472a9776d5217fe1743417a9
32cc9ee0cdffecb0ec8d80a7fd55d7dccae3a7ee 15-Oct-2015 Mathieu Chartier <mathieuc@google.com> Change hash table load factors

Changed class table and intern table load factors to query the
runtime. The runtime returns load factors based on whether or not we
are a low ram device.

DescriptorEquals time for class linking goes from 10% -> 1.2% for
compiling GmsCore with interpret only.

Added test.

Bug: 24917584

Change-Id: Iaaf5d2eab1b0c2d188d299e4bc1852cdb3801173
e58991b3b2282b5761f1a6023a16c803e1c4eb45 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Unload oat files""

Fixed a race where two threads calling OatFile::Open could both use
dlopen on the host.

Bug: 22720414

This reverts commit 72da5e7461fec3b1e116050f2e6f233efb9c54f3.

Change-Id: I1636045b724944d2a09417527280784967957095
eb7c144a6aff7da673ba53d501c46f00311d4d7f 31-Aug-2015 Alex Light <allight@google.com> Add initial default method support to Art

This commit starts the process of adding default methods and their
associated pieces to ART.

This adds full support for calling default methods using
invoke-interface and invoke-virtual on objects implementing the
interfaces. Verifier is changed to allow this when the runtime is
started with -Xexperimental:default-methods.

This also adds support for defining and calling static methods on
interface classes with invoke-static.

Directly calling overridden default methods using invoke-super is not
yet supported.

This adds 5 new run-tests for this functionality.

Bug: 24618811

Change-Id: I35ca800d99d3329348b277789b70ceeeba6e7f03
f9c6fc610b27887f832e453a0da1789187293408 07-Oct-2015 Mathieu Chartier <mathieuc@google.com> Add OatFileManager

Takes over a large amount of functionality from the class linker.

Changed OatFile to loading the same OatFile multiple times. This is
required for unloading OatFiles and moving dex caches to BSS since
these require a different OatFile for each dex cache and class
loader.

Bug: 22720414

Change-Id: I0321096723a294dc72949f21e66da82727b512fc
951ec2c93c79c5539cbcc669566f0808d4460338 22-Sep-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add one LinearAlloc per ClassLoader""

Issue was fixed by:
https://android-review.googlesource.com/#/c/171945/

Bug: 22720414

This reverts commit 7de5dfe37f3cf24e1166412b589f6f67dcd1f1c0.
7de5dfe37f3cf24e1166412b589f6f67dcd1f1c0 22-Sep-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Add one LinearAlloc per ClassLoader"

Times out on 32bit target/host for 132-daemon-locks-shutdown test.

Bug: 22720414

This reverts commit 356412e2b7ba3fde164bc08a44fee0ddc19c54e1.

Change-Id: I5ab3a09e88a5ad8c306a27d2606ecbecc80b9326
356412e2b7ba3fde164bc08a44fee0ddc19c54e1 21-Sep-2015 Mathieu Chartier <mathieuc@google.com> Add one LinearAlloc per ClassLoader

Also added freeing linear alloc and class table when the
corresponding class loader is no longer reachable.

Bug: 22720414

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

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

Bug: 12687968
Change-Id: I33850c8d12e6e1a3aed1c2bb18eba263cbab76e8
673ed3d8aedc5462a47ded827c99f35d46525457 28-Aug-2015 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Change dex caches to be weak roots""

This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.

Boot.oat creation time goes from 4.7s to 4.9s on host due to extra
locking. Will try to improve this in another CL.

Bug: 23602225
Bug: 22720414

Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
81a9087f0df0518c39405b7d18ba5858a6d8b77b 28-Aug-2015 Brian Carlstrom <bdc@google.com> Revert "Change dex caches to be weak roots"

This reverts commit 3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4.
3ae6b1d42523bb2a0ddb5edff1aaf05b592f28f4 14-Aug-2015 Mathieu Chartier <mathieuc@google.com> Change dex caches to be weak roots

Changed dex caches to be weak roots. This is necessary for class
unloading since the resolved types arrays would keep classes live
when they should be unloaded. Currently the dex caches still don't
get freed due to the class loader roots.

Also deleted some unused functionality in image writer.

Bug: 22720414
Change-Id: If22cb3cad7e3baabc8158a77d7f20799faf4c341
b1d8c314b55bb2df2b2bb72a3daaf5db65b7ebc7 04-Aug-2015 Igor Murashkin <iam@google.com> Revert "cleanup: Replace pointers with out-parameters and fix-up formatting"

This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639.

--

Revert "runtime: cleanup class_linker out-parameters and formatting"

This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b.

--

Revert "base: replace raw pointers for out-parameters with safer out<T>"

This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
a315f5c546b796f55f4872bb6efc15eb858d9639 01-Aug-2015 Igor Murashkin <iam@google.com> cleanup: Replace pointers with out-parameters and fix-up formatting

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

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

Change-Id: I0bb15111149d53bb21aac2199ef33bd35333b0ca
dd6712578b6aa8a292bc6249295b6d2a7b182717 23-Jul-2015 Andreas Gampe <agampe@google.com> ART: Change the stack dump format to be in line with debuggerd

Make offsets 16 digits on 64-bit platforms.

Add the ability to provide the build fingerprint, and print it in
the traces output.

Bug: 22693991

(cherry picked from commit 242ae94dc39be53e519a6163ea1db494ceb75954)

Change-Id: Ibd3d3b3bd65dce84acfb97a487807d6f280a9508
242ae94dc39be53e519a6163ea1db494ceb75954 23-Jul-2015 Andreas Gampe <agampe@google.com> ART: Change the stack dump format to be in line with debuggerd

Make offsets 16 digits on 64-bit platforms.

Add the ability to provide the build fingerprint, and print it in
the traces output.

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

Also enable -Wthread-safety-negative.

Changes:
Switch to capabilities and negative capabilities.

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

Bug: 20072211

Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
e2facc5b18cd756a8b5500fb3d90da69c9ee0fb7 10-Jul-2015 Igor Murashkin <iam@google.com> runtime: Add lambda box/unbox object equality

A lambda that is boxed with box-lambda is now stored as a weak reference
in a global runtime table (lambda::BoxTable). Repeatedly boxing the same
lambda closure value will always return the same java.lang.Object back.

Since there is no way to observe the address of an object, a GC can
happen and clean up the table of any dead boxed lambdas, which can also
shrink the table to prevent the memory use from growing too much.

(Note that a lambda closure is immutable, so hashing over it is
guaranteed safe.)

Change-Id: I786c1323ff14eed937936b303d511875f9642524
7617abdb402fd0419daa3eefb2ad059ccbb8b6db 11-Jul-2015 Igor Murashkin <iam@google.com> runtime: Add -Xverify:softfail and ART_TEST_INTERPRETER_ACCESS_CHECKS

Use ART_TEST_INTERPRETER_ACCESS_CHECKS=true to run all the tests through
the interpreter with access checks enabled. The normal interpreter tests
do not currently enable access checks, which means that a large part of
the interpreter codebase is untested.

The verifier will force every class into a soft fail mode if
-Xverify:softfail is used, thereby ensuring that if used along with the
interpreter (-Xint) that the interpret is always in access checks mode.

This is used alongside with --compile-filter=verify-at-runtime to
prevent the AOT compiler from putting down any code.

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

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

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

Change-Id: Ie572481a25fead59fc8978d2c317a33ac418516c
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
7a4d0157eb690266928902a67922f346e290f4c6 10-Jul-2015 Nicolas Geoffray <ngeoffray@google.com> Change JIT code to use optimizing.

Obviously, will fall back to quick for most methods currently,
due to lack of -QUICK opcodes support.

Change-Id: I28882fbe805cd907275b6047437d9639a475964a
01aaf6ef3e3e35cc8e41cf3fe899a7bf337042f4 19-Jun-2015 Calin Juravle <calin@google.com> Allow for sig chain to be disabled.

Tools like dex2oat or patchoat don't need the sig chain or the fault
manager. This also enables building a statically link version of
dex2oat.

Change-Id: I9897728cac48acade854bb027bfde860628ebf84
158f35c98e2ec0d40d2c032b8cdce5fb60944a7f 11-Jun-2015 Igor Murashkin <iam@google.com> interpreter: Add experimental lambda opcodes for invoke/create-lambda

These opcodes are not yet fully specified, and *will* change before they become shippable.
Do not write production code against experimental opcodes.

--

Implement partial interpreter support for new dex instructions invoke/create-lambda, and a
new opcode format 25x.

* Does not verify, in fact verification will soft fail when we see those opcodes.
* Compilers will punt to interpreter since they don't support new opcodes.
* As there is no way to capture/liberate variables yet, the "closure" is just
an ArtMethod for the time being.

All new opcodes are disabled by default, use runtime option -Xexperimental-lambdas to enable them.

For example:
dalvikvm ... -Xexperimental-lambdas ...
dex2oat --runtime-arg -Xexperimental-lambdas ...

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

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

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

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

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

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

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

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

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

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

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

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

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

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

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

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

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

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

This fixes mips64 boot.

Bug: 19264997
Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
4edd8476339fd93ba8ff384ad107f1fc662e64a3 01-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix accidental IMT and root marking regression

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

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

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

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997
Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
848f70a3d73833fc1bf3032a9ff6812e429661d9 15-Jan-2014 Jeff Hao <jeffhao@google.com> Replace String CharArray with internal uint16_t array.

Summary of high level changes:
- Adds compiler inliner support to identify string init methods
- Adds compiler support (quick & optimizing) with new invoke code path
that calls method off the thread pointer
- Adds thread entrypoints for all string init methods
- Adds map to verifier to log when receiver of string init has been
copied to other registers. used by compiler and interpreter

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

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

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
c785344b87221f5e4e6473e5b762e4e61fe65dcf 27-Mar-2015 Mathieu Chartier <mathieuc@google.com> Move ArtField to native

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

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

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

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

No reflection performance changes.

Bug: 19264997
Bug: 17643507

Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
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
2fd7e69505195cda4caaa3161aaf37315552a698 02-Apr-2015 Sebastien Hertz <shertz@google.com> Use specific exception class to abort transaction

We used to throw a java.lang.InternalError when aborting a
transaction (when preinitializing image classes at compilation time).

We now use dedicated class dalvik.system.TransactionAbortError that
is only thrown by the compiler to abort a transaction. This class has
constructors taking a java.lang.Throwable "cause" so we can wrap
exceptions causing the transaction to abort (for instance class
java.lang.ClassNotFoundException) and give more information about the
cause of the transaction abort.

Bug: 20019689
Change-Id: I019a72a1c754d8bba6a7ad6bb0f02e4fd6668622
f6a780abeaed4bf745720e8f836a3064d3ffbec4 03-Apr-2015 Andreas Gampe <agampe@google.com> ART: Move trace options to a struct

Bundles the different options and moves them to a struct in the
implementation file. Will allow for easier change for streaming.

Change-Id: I486e0942614e714964eb233e2d6b4e3e12aa704f
461687d898dfd91253f242072849a9fe43e5f523 31-Mar-2015 Mathieu Chartier <mathieuc@google.com> Visit image roots for hprof

Bug: 19995360

(cherry picked from commit 0cab5e68f14ee403380664146db6dc7ddfc32064)

Change-Id: I17868bff2a701dc25291d41b9732c6b86f92be08
0cab5e68f14ee403380664146db6dc7ddfc32064 31-Mar-2015 Mathieu Chartier <mathieuc@google.com> Visit image roots for hprof

Bug: 19995360
Change-Id: I1f2989c8bccf508b1d47dfd0d7aee4c7bb275b56
4585f876eb5dfb936bd0d6cb6acd78a1f2182ba6 28-Mar-2015 Andreas Gampe <agampe@google.com> ART: Some runtime cleanup

Use an enum for the compiler-callback mode.

Refactor and remove some unnecessary includes in runtime.h.

Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a
81c6f8db12b203878a7d72444ead2bc7cf5c47ad 26-Mar-2015 Andreas Gampe <agampe@google.com> ART: PathClassLoader for compiler

Use an actual PathClassLoader when compiling apps, instead of a
side structure and cutout.

This CL sets up a minimal object 'cluster' that recreates the Java
side of a regular ClassLoader such that the Class-Linker will
recognize it and use the internal native fast-path.

This CL removes the now unnecessary compile-time-classpath and
replaces it with a single 'compiling-the-boot-image' flag in the
compiler callbacks.

Note: This functionality is *only* intended for the compiler, as
the objects have not been completely initialized.

Bug: 19781184

Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
785049f8083e56e88dfeab5ff74fb3817f9854e3 18-Jul-2014 Dmitriy Ivanov <dimitry@google.com> Add paths to apk!lib/<abi> to LD_LIBRARY_PATH

Add paths to .apk to LD_LIBRARY_PATH to enable
bionic linker's "open from zip-file" feature.

Bug: 8076853
Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
455f67c4cf0b4f04e117db3024fd189fa1c7dab9 17-Mar-2015 Mathieu Chartier <mathieuc@google.com> Fix JIT options with late init

Previously we couldn't create the JIT since we didn't have any
JITOptions.

Bug: 19735273

Change-Id: I24b8ed131ed8b18f75ec94291e135d8a1c089ebd
12d625f87bcd6c4059a205bb39007a255f57f382 13-Mar-2015 Mathieu Chartier <mathieuc@google.com> Change method verifiers to be thread local roots

Bug: 10921004

Change-Id: I3a1425d76cd380587ba67ef6d5ec1227564e55bf
2435a43f6c851c23922d8508fb17c6079248201c 13-Mar-2015 bowen_lai <bowen_lai@htc.com> ART: Add entries_ lock for race condition

GCDaemon thread would visit incorrect RegType content when there is
another thread initializing classes.
Add a lock to protect entries_.

https://code.google.com/p/android/issues/detail?id=159849

Change-Id: Iabaa1c7f5cc5106b60a6e3856152e0797e8a5d6d
9b34b244ecddd8a35c922ed87bc3df0ca4db0282 09-Mar-2015 Mathieu Chartier <mathieuc@google.com> Trim arenas for JIT

Moved arena pool into the runtime. Added arena trimming to arena
pool. When called, this madvises the used memory.

Changed the JIT compiler to trim arenas after compilation. Changed
the arena mmap name to dalvik-LinearAlloc.

Native PSS before:
80353 kB: Native
80775 kB: Native
78116 kB: Native
After:
73357 kB: Native
70181 kB: Native
70306 kB: Native

Bug: 17950037
Bug: 17643507
Bug: 19264997

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

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

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

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

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

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

Currently disabled by default unless -Xjit is passed in.

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

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

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

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

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

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

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

Bug: 17950037

Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
24e04aa68c575d349eac0d9d09aab9bd3106ef94 12-Sep-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: Allow the execution to stop if the compilation fails via an option

The current implementation continues the execution of the application if
dex2oat fails by relying on the interpreter.

This patch adds a -Xno-dex-file-fallback option to stop the default behavior.
This can be used two-fold.

First, one can enforce that a runtime only starts with a boot image. A
follow-up patch will ensure that dex2oat (for apps) and patchoat in general
request that mode and close gracefully otherwise.

Second, this can be used for testing and debugging purposes, as it ensures
that compiler failures & aborts are not silently ignored.

Add testing.

Bug: 19100590
Change-Id: Iaf07b5ccf00942ca8a8ec8687599320a3ddbc089
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
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
5a2be3f40125af8b25fbbd9d55dc968168c76ed7 16-Feb-2015 Narayan Kamath <narayan@google.com> Implement a simple count based boot marker.

We write the number of failed boots to the marker and only
prune the dalvik cache if the number of consecutive failed
boots is higher than a predefined threshold.

Note that the code is forgiving of errors related to boot
markers; we continue the boot process even if we're unable
to create / write or flush the boot marker.

bug: 19360096
Change-Id: Ia17c3b783318ddf43c9199d0f7f09c54a4176667
b3b173bbbd1d1cbad555de13c3fa6765f5078bce 06-Feb-2015 Sebastien Hertz <shertz@google.com> Follow up 129144

Passes JDWP options to debugger on runtime init so we no longer need
to keep them on the heap.

Updates ParseJdwpOption to return Result for consistency.

Bug: 19275792
Change-Id: I68b7e58908164d3e4cf9e3fbcc3dfab6ce0579a5
3be6e9d904baa13d7cf51dfc6742dea12e766b2e 05-Feb-2015 Sebastien Hertz <shertz@google.com> Read JDWP options from runtime

Allocates JDWP::JdwpOptions on the heap and copies parsed options to
avoid the need to include jdwp/jdwp.h into runtime.h file.

Also does some minor cleanup and removes the old JDWP options parsing
code that became dead code after we move it to the new command-line
parser.

Bug: 19275792
Change-Id: I71901c89fbf2cc3c1901a089e2a98b4326c6ee70
1c80becf5406cd6d95dc24bf47a0c5a3809ea281 03-Feb-2015 Sebastien Hertz <shertz@google.com> Fix transaction aborting

During compilation, a java.lang.InternalError is used to indicate
that class initialization failed and the enclosing transaction
should be aborted and the changes rolled back. However there is
nothing preventing the code executed from a class initializer from
catching that exception (like catching Throwable and ignore it).
Therefore we may return from the class initializer with no pending
exception, even if the transaction was aborted, and not rollback
the changes properly.

To fix this, we now rely on the new Transaction::aborted_ field to
know whether a transaction aborted. When returning from the class
initializer without pending exception, we now check wether we aborted
the enclosing transaction. If that's the case, we set the status of
the class to kStatusError and throw a new java.lang.InternalError
with the original abort message.

This CL also contains some cleanup:
- Renames Transaction::Abort to Transaction::Rollback which is less
ambiguous and more reflect what is done.
- Moves the code throwing the java.lang.InternalError exception into
the Transaction::ThrowInternalError method so we do not duplicate
code. Now we may abort transaction more than once (because we may
have caught the java.lang.InternalError then execute code causing
new transaction abort), we only keep the first abort message to
throw the exception.
- Updates transaction_test with more cases and more checks.
- Bumps oat version to force recompilation with this fix.

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

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

Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
d2abbc9829ea0f657557c247a7c48c825dacfccd 19-Dec-2014 Andreas Gampe <agampe@google.com> ART: Use interpret-only for vmSafeMode

Set the compiler filter when the zygote tells us that the app is
in vmSafeMode. This ensures that secondary dex files will also be
compiled interpret-only.

Bug: 18812762

(cherry picked from commit 44893692bfb25ceb5c7c5b2e5c606948fbdea298)

Change-Id: Idb61870beebe2eeb5b11554f95ea6a725c77f16a
44893692bfb25ceb5c7c5b2e5c606948fbdea298 19-Dec-2014 Andreas Gampe <agampe@google.com> ART: Use interpret-only for vmSafeMode

Set the compiler filter when the zygote tells us that the app is
in vmSafeMode. This ensures that secondary dex files will also be
compiled interpret-only.

Bug: 18812762
Change-Id: Idb61870beebe2eeb5b11554f95ea6a725c77f16a
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
d582fa4ea62083a7598dded5b82dc2198b3daac7 06-Nov-2014 Ian Rogers <irogers@google.com> Instruction set features for ARM64, MIPS and X86.

Also, refactor how feature strings are handled so they are additive or
subtractive.
Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler
rather than #ifdefs that wouldn't have worked in cross-compilation.
Add SIMD features for x86/x86-64 proposed in:
https://android-review.googlesource.com/#/c/112370/

Bug: 18056890

Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
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
2d2621a1463d2f3f03fa73503fa42e43657cdcfc 24-Oct-2014 Mathieu Chartier <mathieuc@google.com> Optimize method linking

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

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

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

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

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

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

Bug: 18054905
Bug: 16828525

(cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4)

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

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

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

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

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

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

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

Bug: 18054905
Bug: 16828525

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

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

Bug: 18097480

(cherry picked from commit 07d83c7a25022064ac0a8dac4fe2a7a38681fa4b)

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

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

Bug: 18097480
Change-Id: I901f2d3c2ab1efb2875388f99e8c5c111ce82d5a
677cd61ad05d993c4d3b22656675874f06d6aabc 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

(cherry picked from commit 6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3)

Change-Id: I3e7595f437db4828072589d475a5453b7f31003e
6f3dbbadf4ce66982eb3d400e0a74cb73eb034f3 15-Oct-2014 Ian Rogers <irogers@google.com> Make ART compile with GCC -O0 again.

Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on
architecture.
Add to instruction_set_test to warn when InstructionSetFeatures don't agree
with ones from system properties, AT_HWCAP and /proc/cpuinfo.
Clean-up class linker entry point logic to not return entry points but to
test whether the passed code is the particular entrypoint. This works around
image trampolines that replicate entrypoints.
Bug: 17993736

Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
7223d44a4893522e90d00bca38b119f710e55122 11-Oct-2014 Ian Rogers <irogers@google.com> Switch to C++11 style [[noreturn]].

Also remove old comment about calls to Abort getting merged. We have few
LOG(FATAL)s so merging is less of an issue. Also, recompiling with O0 and
similar will avoid the optimization and we expect that for GDB debugging.

Change-Id: I840dc6f4b8511294be0e117c634ec15b745e7be5
647b1a86f518d8db0331b3d52a96392b7a62504b 10-Oct-2014 Ian Rogers <irogers@google.com> Fix 2 new sets of clang compiler warnings.

Fix issues that are flagged by -Wfloat-equal and -Wmissing-noreturn.
In the case of -Wfloat-equal the current cases in regular code are deliberate,
so the change is to silence the warning. For gtest code the appropriate fix is
to switch from EXPECT_EQ to EXPECT_(FLOAT|DOUBLE)_EQ.
The -Wmissing-noreturn warning isn't enabled due to a missing noreturn in
gtest. This issue has been reported to gtest.

Change-Id: Id84c70c21c542716c9ee0c41492e8ff8788c4ef8
31d8f5295c24730a57cb36cbc41197f0b7e8397c 29-Sep-2014 Brian Carlstrom <bdc@google.com> Add VMRuntime.isBootClassPathOnDisk

Bug: 17679443

(cherry picked from commit 95a935415d44903b28326424beb4db5c013ef089)

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

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

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

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

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

Also added some locking to prevent race conditions.

Bug: 17360878

(cherry picked from commit a98ffd745bbecb2e84a492194950c0b94966546b)

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

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

Also added some locking to prevent race conditions.

Bug: 17360878

Change-Id: I779237d55dda4f35054a4d27fb2c660a38750fc0
a6da74e941d7cee498ac3880018a1d8dc953c6eb 10-Sep-2014 jgu21 <jinghui.gu@intel.com> ART: Update for split native bridge initialization

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

Bug: 17499772

(cherry picked from commit 1d6ee090fddd4bfd35c304d6ceb929d5c529dfcc)

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

Bug: 17499772
Change-Id: Id98c10967b28e8859e5ac46f5878c304fb85c498
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
928f72bd75c385ba2708c58521171a77264d4486 10-Sep-2014 Andreas Gampe <agampe@google.com> ART: Fix things for valgrind

Wire up valgrind gtests. Add valgrind-test-art-host, currently
only depending on valgrind-test-art-host-gtest32.

Fix an Alloc setting to allow running valgrind.

Refactor the fault handler to manage (and correctly release) the
handlers.

Fix minor failure-case leaks exposed by tests.

Failing tests:

The optimizing compiler is leaking non-arena-ed structures
(e.g., assembler buffers), as code generators are not destroyed.
The solution has been moved to a follow-up CL.

Note: All 64b tests are failing as we cannot allocate a heap.

Change-Id: I7f854cfd098d9f68107ce492363e7dba9a82b9fa
13e3c6dd64ef3ca350356128d3a3e2fdd57513ee 03-Sep-2014 Andreas Gampe <agampe@google.com> ART: Change ART for new native bridge sequence

Initialize or unload after a fork.

(cherry picked from commit 6be67eeedbe60afce42300ae3e7f0e7180a96efa)

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
6be67eeedbe60afce42300ae3e7f0e7180a96efa 03-Sep-2014 Andreas Gampe <agampe@google.com> ART: Change ART for new native bridge sequence

Initialize or unload after a fork.

Change-Id: I5a20de1cb68dd1802937b369b14c50c9c1031c67
c0542af3e2170143ba40d89136e284997e16bf64 04-Sep-2014 Ian Rogers <irogers@google.com> Remove abuse of mirror::Object* to reference special values.

Remove kInvalidIndirectRefObject, kClearedJniWeakGlobal and
ObjectRegistry::kInvalidObject. Handle error conditions by passing in or
returning an error value.
GetObjectRefType is simplified to be faster and not return invalid references
that are not expected according to the spec. Adjust check JNI and
jni_internal_test appropriately.
Fix cases in the debugger/JDWP of out arguments being passed by reference.
Bug: 17376993

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

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

(cherry picked from commit 63557459a4098294a9ff44d035241de2966047c0)
63557459a4098294a9ff44d035241de2966047c0 05-Jun-2014 Ian Rogers <irogers@google.com> Pre-allocate the NoClassDefFoundError to be thrown for boot classes.

Bring over a Dalvik "optimization".
Bug: 12804658
Bug: 16853450
Change-Id: I6419de7bd2ba18d91479cb52489104954f5c4524
cdfd39f579574a75b98e7ad48c69826b00361b27 30-Aug-2014 Mathieu Chartier <mathieuc@google.com> Change intern table to unordered set.

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

Bug: 16238192

(cherry picked from commit d910fcef539e12ab181e56ec80684f39c4e95733)

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

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

Bug: 16238192

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

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

The measurements are dumped to traces.txt during SIGQUIT.

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

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82

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

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

The measurements are dumped to traces.txt during SIGQUIT.

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

Bug: 16238192

Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82
37f05ef45e0393de812d51261dc293240c17294d 17-Jul-2014 Fred Shih <ffred@google.com> Reduced memory usage of primitive fields smaller than 4-bytes

Reduced memory used by byte and boolean fields from 4 bytes down to a
single byte and shorts and chars down to two bytes. Fields are now
arranged as Reference followed by decreasing component sizes, with
fields shuffled forward as needed.

Bug: 8135266
Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
507e6180ad271eb719c67ce7394852c731d975a5 19-Aug-2014 Alex Light <allight@google.com> Support running without a boot image.

Bug: 17000769

(cherry picked from commit 64ad14dbe2225441fb7734bf6d89358d96692eea)

Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
64ad14dbe2225441fb7734bf6d89358d96692eea 19-Aug-2014 Alex Light <allight@google.com> Support running without a boot image.

Bug: 17000769

Change-Id: I6404d5050c8a2f4ee6e70d58532eb25ee9de248e
a68629ed992e2eef7b139b09e46ebe8fd3fb5ef2 22-Aug-2014 Calin Juravle <calin@google.com> Always setup the native bridge library

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

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

Bug: 16404669

(cherry picked from commit I94628639691459d48d1fbf0841f36b68d51818e7)

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

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

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

Bug: 16404669.
Change-Id: I94628639691459d48d1fbf0841f36b68d51818e7
9c290012b7f505ae1943ab87236f775b97a46e2d 22-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Execute an application even when dex2oat crashes.

Bug: 17000769

(cherry picked from commit 4fcdc94d22a4608e355aa8df36240181149d10e8)

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

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

Bug: 16884833

(cherry picked from commit I73aab8e212860ba5aee9444d801806d3da326a41)

Change-Id: I67f037ea81d2a4ede4294afd8b84b7640e534a13
c8423521c1d1136c70b153479b7df3bf4fd7fc2a 12-Aug-2014 Calin Juravle <calin@google.com> [ART] Move to system/core native bridge library

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

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

Bug: 17000769

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

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

The jdwp test passed.

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

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

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

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

Bug: 14059466
Bug: 16406852

(cherry picked from commit b363f666883860d40823d5528df3c98c897f74f4)

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

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

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

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

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

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

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

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

Bug: 15358152

Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
799eb3a5555254427db269921042419bc30d4d86 19-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the GC roots in Instrumentation.

Bug: 12687968
Change-Id: I324e2f950ce4500b0e00722044af3a9c82487b23
147eb41b53729ec8d5c188d1cac90964a51afb8a 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

Bug: 16256184
Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73

Conflicts:
compiler/dex/quick/arm64/target_arm64.cc
compiler/image_test.cc
runtime/fault_handler.cc
69dfe51b684dd9d510dbcb63295fe180f998efde 11-Jul-2014 Dave Allison <dallison@google.com> Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""

This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1.

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

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

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

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

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

This reverts commit 3d14eb620716e92c21c4d2c2d11a95be53319791.

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

Broke the build.

This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e.

Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
2153f93df36b59a61fed15bef8e7304010be04b5 26-Jun-2014 Andreas Gampe <agampe@google.com> ART: Bump runtime version to 2.1.0

Bump the version of ART to 2.1.0 to reflect recent changes like
native MultiDex support.

Change-Id: Idcff71faac932c2b30359fbe13a975fb818ecb0e
576ca0cd692c0b6ae70e776de91015b8ff000a08 07-Jun-2014 Ian Rogers <irogers@google.com> Reduce header files including header files.

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

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

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

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

Merge ART from AOSP to lmp-preview-dev.

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

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

Bug: 13247236

(cherry picked from commit 01d5a146e20660bd06f026c16f19ec080f8fdd7b)

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

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

Bug: 13247236

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

Change-Id: I973da5e74be5a62461caacbc708288fb95e1b99b
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
7624d25dad2d1ba25969ae704fccf68649103ae5 02-May-2014 Vladimir Marko <vmarko@google.com> Move quick frame info to OatQuickMethodHeader.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bug: 13748830
Bug: 13744490

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

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

Change-Id: I3ad7fe606cb99bcdd884a8fdbdd06bd7e047cd84
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
661974a5561e5ccdfbac8cb5d8df8b7e6f3483b8 09-Jan-2014 Mathieu Chartier <mathieuc@google.com> Fix valgrind gtests and memory leaks.

All tests pass other than image_test which passes if some bad reads
are disabled (buzbee working on this).

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

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

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

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

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

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

This also removes the need for host-prefix.

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

Bug: https://code.google.com/p/android/issues/detail?id=62149
Change-Id: I5c21c0433f5f341f94e7d977e8d2d69cc46d6fe3
b48b9eb6d181a1f52e2e605cf26a21505f1d46ed 01-Mar-2014 Ian Rogers <irogers@google.com> Fix clang to compile and run host tests.

Don't use the computed goto interpreter with clang 3.4 as it causes compilation
to hang.
Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it
sets clang incompatible cflags.
Most fixes are self-evident, for the quick dex file method inliner the enums
were being used with ostreams, so fix the enums and operator out python script
to allow this.
Note this change effects portable but this is untestable as portable was broken
by ELF file and mc linker changes.

Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
15d3402bbf8265eb1165694da2e4117eb128f3bc 27-Feb-2014 Mathieu Chartier <mathieuc@google.com> Add custom SIGSEGV handler to help find heap corruption.

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

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

Bug: 12934910

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

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

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

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

Sufficient to pass jni_internal_test.

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

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

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

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

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

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

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

Bug: 9676614
Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
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
a4adbfd44032d70e166e6f18096bbbed05a990ba 05-Feb-2014 Hiroshi Yamauchi <yamauchi@google.com> RosAlloc verification.

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

Bug: 9986565
Bug: 12592026
Change-Id: I923742b87805ae839f1549d78d0d492733da6a58
ef7d42fca18c16fbaf103822ad16f23246e2905d 06-Jan-2014 Ian Rogers <irogers@google.com> Object model changes to support 64bit.

Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.

Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bug: 8981901

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

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

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

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

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

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

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

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

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

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

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

Bug: 9986565
Bug: 12042213

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

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

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

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

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

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

Bug: 11771255
Bug: 8499494
Bug: 10802951

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bug: 8981901

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

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

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

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

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

Bug: 8981901

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

Change-Id: Idf7fe85e1293453a8ad862ff2380dcd5db4e3a39
e810452722ac83b294d1f7aa80bdd88e547d5af0 16-Oct-2013 Brian Carlstrom <bdc@google.com> Preload DexCaches

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

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

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

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

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

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

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

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

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

Fixes pause regression caused by fix for
Bug: 10626133

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

Required for moving collectors.

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

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

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

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

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

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

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

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

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

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

Bug: 9986416

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

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

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

Phone boots. Also removed elfwriter spam from logcat.

Change-Id: I09b9d2fc40ebfeb6f1c2f12153b0ad4134bb5159
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

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

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
ee17e0aa4d24deb11c1766bfcc6a864519df1c1e 31-Jul-2013 buzbee <buzbee@google.com> Compilation filter

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

It supports 5 modes of filtering:

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

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

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

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

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

or modify kDefaultCompilerFilter in runtime.h

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

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

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

It supports 5 modes of filtering:

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

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

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

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

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

or modify kDefaultCompilerFilter in runtime.h

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

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

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

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

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

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

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

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

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