History log of /art/runtime/mirror/class-inl.h
Revision Date Author Comments
dcc8b753b0477476d1464da173582d3ec949e3b2 25-May-2016 Nicolas Geoffray <ngeoffray@google.com> Remove bogus DCHECK.

bug:28771056

(cherry picked from commit 0950abe82f86a9943feb7719876ec291c6581037)

Change-Id: I8c5b737c0882ecb8d67d8f799356f30afe3dd87b
e1e5a864476847a86a816545f8cd7beb1818c133 21-Mar-2016 Vladimir Marko <vmarko@google.com> Remove bogus DCHECK().

Bug: 27684368
Change-Id: Ic3653280b32a471fbfdb5459ea382bc15c86cdbc
b79eb75ba5671b787ac0622ded2de970f8f0d2c1 07-Mar-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "ProfilingInfo roots should be visited by the declaring class."

This reverts commit 9a3be989d0aee1a6998e33813c7f70906d27f89a.

Superceded by CL 206308.

Bug: 27435111
ebd5fc6a55f535cfdc1043878dd5366032d72fba 07-Mar-2016 Hiroshi Yamauchi <yamauchi@google.com> Revert "Query declaring class before querying IsNative."

This reverts commit 26329cd578efe9cd7e60c46fef1bfb549062a283.

Superceded by CL 206308.

Bug: 27435111
26329cd578efe9cd7e60c46fef1bfb549062a283 04-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Query declaring class before querying IsNative.

IsNative checks that the declaring class is not null.

Change-Id: I9b775858cdb685eb633b3d8a8a271a3d451bb8a9
9a3be989d0aee1a6998e33813c7f70906d27f89a 04-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> ProfilingInfo roots should be visited by the declaring class.

There seems to be an implicit assumption that only classes can
visit native roots (ie kVisitNativeRoots in Class::VisitReferences).
However, some places like Dbg::VisitRoots and
AllocRecordObjectMap::VisitRoots visit ArtMethod::VisitRoot
directly, and that breaks the assumptions.

bug:27435111
Change-Id: I5b476e614ba820394635d946cb562bf872a50e7e
7ead0c009c64f1e10aa39e44ea10383dd859d332 22-Feb-2016 Alex Light <allight@google.com> Make JNI work correctly with default methods.

Also adds some tests for JNI and DefaultMethods.

Bug: 27259142
Bug: 24618811

(cherry picked from commit 3612149aee482ab7a17da68b0ef5fef3879729a2)

Change-Id: I31222e3e41059d803be1dbb0f40e1144ac4bf457
3612149aee482ab7a17da68b0ef5fef3879729a2 22-Feb-2016 Alex Light <allight@google.com> Make JNI work correctly with default methods.

Also adds some tests for JNI and DefaultMethods.

Bug: 27259142
Bug: 24618811

Change-Id: I31222e3e41059d803be1dbb0f40e1144ac4bf457
5496f69c0a4c2cc357a065f57b7f4ff5d9ad2fa9 17-Feb-2016 Hiroshi Yamauchi <yamauchi@google.com> Disable read barriers in GC VisitReferences calls.

It's safe to disable read barriers in the CC collector's
VisitReferences calls. It speeds up the collector by some amount,
eg. Ritzperf EAAC GC time on N5 decreases by ~4.2%.

This is based on Mathieu Chartier's idea.

Bug: 12687968

Change-Id: I884dee7018f92761fad54269f4cd01db4fa82f2a
dfe02f6aafee264478d510b9742ee266ea52e8a8 02-Feb-2016 Mathieu Chartier <mathieuc@google.com> Fix remaining read barrier issues in image relocation

Added a way to disallow read barriers, this makes it easy to find
the issues.

Bug: 26786304
Change-Id: I7ebb50832686d03e096a979aae9741239371683f
f4b3dbad413023795b92a842aad1c3f2fe4a57e9 27-Jan-2016 Mathieu Chartier <mathieuc@google.com> Cast method pointer to uintptr_t before uint64_t

Previously we were casting a pointer to uint64_t. This sign extends.
This change fixes 64 bit app image crashes on angler.

Bug: 22858531
Change-Id: I03e973a0c5a1d74db7e8db0f13f5b1825d8d8ab5
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
705ad49f353d3f90d8b63625aca2c2035bacdbef 21-Sep-2015 Alex Light <allight@google.com> Support directly invoking interface default methods

With the Java 8 Language one is allowed to directly call default
interface methods of interfaces one (directly) implements through the
use of the super keyword. We support this behavior through the
invoke-super opcode with the target being an interface.

We add 3 tests for this behavior.

Currently only supports slow-path interpreter.

Invoke-super is currently extremely slow.

Bug: 24618811

Change-Id: I7e06e17326f7dbae0116bd7dfefca151f0092bd2
e64300b8488716056775ecbfa2915dd1b4ce7e08 16-Dec-2015 Alex Light <allight@google.com> Revert "Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class""

This reverts commit ae358c1d5cef227b44d6f4971b79e1ab91aa26eb.

Bug: 24618811

Change-Id: I8becf9bae3258450b90cfef5e79589db7c535a4d
2efb0aa57da168944f99a2d13aed2a426cfa76e7 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3.

Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230
ae358c1d5cef227b44d6f4971b79e1ab91aa26eb 15-Dec-2015 Alex Light <allight@google.com> Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"

This reverts commit 6286a97bea0f584342803a215550038852b24776.

Change-Id: I5b00f6d1350e9c587acd4b185367dc815ea707de
9539150b85142c18e9e8c2264b5b6100942667c3 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

Manual cherry-pick of 6286a97 to master

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
6286a97bea0f584342803a215550038852b24776 04-Dec-2015 Alex Light <allight@google.com> Combine direct_methods_ and virtual_methods_ fields of mirror::Class

This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.

Bug: 24618811

Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
a7a4759946d9f11c88dc108b2b6a9518ce9c1e18 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

(cherry picked from commit 3a0909248e04b22c3981cbf617bc2502ed5b6380)

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
3a0909248e04b22c3981cbf617bc2502ed5b6380 24-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "lambda: Add support for invoke-interface for boxed innate lambdas"

955-lambda is flaky

Bug: 24618608
Bug: 25107649

This reverts commit 457e874459ae638145cab6d572e34d48480e39d2.

Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
457e874459ae638145cab6d572e34d48480e39d2 23-Oct-2015 Igor Murashkin <iam@google.com> lambda: Add support for invoke-interface for boxed innate lambdas

Lambda closures created with the 'create-lambda' instruction
(termed "innate lambdas") can be turned into an object with 'box-lambda'.

This CL enables support for those kinds of lambdas to work with
'invoke-interface' by generating a proxy class for the lambda.

Note: MIPS32/64 support not included.

Bug: 24618608
Bug: 25107649
Change-Id: Ic8f1bb66ebeaed4097e758a50becf1cff6ccaefb
4b00d3415beb7a816a3b5948f43f3b2e4b856ea8 13-Nov-2015 Mathieu Chartier <mathieuc@google.com> Refactor some patching logic

Reduce duplication since app images in-place relocation will require
this code also.

Bug: 22858531
Change-Id: Ibb901b67267e27ef3bc2a0baff77189d4dcd018a
99babb6add7db19ce7605f6d5e4aee79d52e386f 03-Nov-2015 Andreas Gampe <agampe@google.com> ART: Change behavior for rethrowing init failures

Allow to store a Throwable instance or a throwable class. Handle
rethrow accordingly.

Bug: 25444180
Change-Id: I703c2c6eaf34ad0e3bc0f5a104d65f2ff1b212ca
35831e8bfa1c0944d4c978d99c4c5b9577945170 11-Sep-2015 Vladimir Marko <vmarko@google.com> Reduce memory used by CompiledMethods.

Use LengthPrefixedArray<>s instead of SwapVector<>s to store
CompiledMethod data and get rid of the unnecessary members
of CompiledMethod to reduce dex2oat memory usage. Refactor
the deduplication from CompilerDriver to a new class.

Use HashSet<> instead of std::set<> for the DedupeSet<> to
further decrease the memory usage and improve performance.

This reduces the dex2oat memory usage when compiling boot
image on Nexus 5 (with Optimizing, -j1) by ~6.75MiB (5%).
This also reduces the compile time by ~2.2% (~1.6% dex2oat
time; with Optimizing, without -j).

Change-Id: I974f1f5e58350de2bf487a2bca3907fa05fb80ea
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
1147b9bd68323c753ed1a0b6106b205fd640c820 15-Sep-2015 Mathieu Chartier <mathieuc@google.com> Use image pointer size for profile info

May fix some random crashes in dex2oat due to cross compilation.

Change-Id: I633652500e8c7dfec38044dffd07eb467973d82a
05792b98980741111b4d0a24d68cff2a8e070a3a 03-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Move DexCache arrays to native.

This CL has a companion CL in libcore/
https://android-review.googlesource.com/162985

Change-Id: Icbc9e20ad1b565e603195b12714762bb446515fa
52a7f5caebdf359ab877f1928aad59f1e9ad29fa 19-Aug-2015 Mathieu Chartier <mathieuc@google.com> Add class flags to class to help GC scanning

Reduces GC time and pauses by reducing the number of loads required
to scan an object.

Average total GC time before on EvaluateAndApplyChanges (EAAC): 7.452s
After: 7.144s

Average GC pause times before on EAAC: 860.67us
After: 722.75us

Adding the class flags field cause a memory increase of ~24k system
wide on low memory devices.

Change-Id: I3f04212d5787bfbf5e55026584d149f55476105e
059ef3ddb2088f926ac452889e0953fdcd646a5e 18-Aug-2015 Mathieu Chartier <mathieuc@google.com> Always visit object class from VisitReferences

We don't want to unload classes which have instances.

Slight increase in CMS GC time from ~6.5s to ~7.3s on
EvaluateAndApplyChanges.

Bug: 22720414
Change-Id: I467ff9c9d55163d2a90b999aef3bdd7b3f648bac
14632857428b7e37761e6e811c19021715a400f8 17-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Rename ArtMethod's size and alignment methods.

Remove the historical prefix "Object" to avoid confusion
with Java objects.

Change-Id: Ib36422c9a24878d8d4bd757977d99cbf66b3d567
cf36d493124d8048efa0bd6f67d817ce3cd6b725 12-Aug-2015 Vladimir Marko <vmarko@google.com> ART: Compress LengthPrefixedArray on 32-bit targets.

Previously, the LengthPrefixedArray<ArtMethod> on 32-bit
targets contained a 64-bit length field followed by the
ArtMethod elements with size only a multiple of 4, not 8.
Consequently, an odd-length array broke the alignment for
the following array which would have the 64-bit length
placed at an unaligned address.

To fix that, we make the length field 32-bit and explicitly
pass the alignment information to the LengthPrefixedArray.
This also makes the 32-bit boot image a bit smaller.
On Nexus 5, AOSP, ToT, the field section is 11528B smaller
and the method section is 21036B smaller. 64-bit targets
should see the same savings for the field section but no
difference for the methods section.

Change-Id: I3e03e7b94129025c8a1c117c27645a34dec516d2
54d220eb9cc51215d75b9e0fe921b94bebbb3fd6 31-Jul-2015 Mathieu Chartier <mathieuc@google.com> Move ArtFields and ArtMethods to be a length prefixed array

Fixes race conditions between changing method and fields arrays
being seen in the wrong order by the GC.

Bug: 22832610
Change-Id: Ia21d6698f73ba207a6392c3d6b9be2658933073f
2e76830f0b3f23825677436c0633714402715099 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Revert "Use the object class as top in reference type propagation""""

This reverts commit b734808d0c93af98ec4e3539fdb0a8c0787263b0.

Change-Id: Ifd925f166761bcb9be2268ff0fc9fa3a72f00c6f
b734808d0c93af98ec4e3539fdb0a8c0787263b0 28-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Revert "Use the object class as top in reference type propagation"""

This reverts commit 80caa1478cf3df4eac1214d8a63a4da6f4fe622b.

Change-Id: I63b51ca418b19b2bfb5ede3f8444f8fbeb8a339d
80caa1478cf3df4eac1214d8a63a4da6f4fe622b 16-Jul-2015 Calin Juravle <calin@google.com> Revert "Revert "Use the object class as top in reference type propagation""

This reverts commit 7733bd644ac71f86d4b30a319624b23343882e53.

Change-Id: I7d393a808c01c084c18d632a54e0554b4b455f2c
da7c650022a974be10e2f00fa07d5109e3d8826f 24-Jul-2015 Mathieu Chartier <mathieuc@google.com> Visit class native roots from VisitReferences

Visit class roots when we call Class::VisitReferences instead of in
the class linker. This makes it easier to implement class unloading
since unmarked classes won't have their roots visited by the class
linker.

Bug: 22181835
Change-Id: I63f31e5ebef7b2a0b764b3ba3cb038b3f561b379
7733bd644ac71f86d4b30a319624b23343882e53 22-Jul-2015 Calin Juravle <calin@google.com> Revert "Use the object class as top in reference type propagation"

This reverts commit 3fabec7a25d151b26ba7de13615bbead0dd615a6.

Change-Id: Id8614f6b6e3e0e4c9caeb9f771e4c145d9fec64f
3fabec7a25d151b26ba7de13615bbead0dd615a6 16-Jul-2015 Calin Juravle <calin@google.com> Use the object class as top in reference type propagation

This properly types all instructions, making it safe to query the type
at any time.

This also moves a few functions from class.h to class-inl.h to please
gcc linker when compiling for target.

Change-Id: I6b7ce965c10834c994b95529ab65a548515b4406
22a07b9272d79f4b377f6fe89bea7b9251731b05 11-Jul-2015 Mathieu Chartier <mathieuc@google.com> Change VisitNativeRoots to use unchecked get for method arrays

Fixes some DCHECKs.

Change-Id: I464b599866a09bd4294b7033d69be880821767fb
1de19d0fcc34212323b8c94bba5200046af1f187 10-Jul-2015 Mathieu Chartier <mathieuc@google.com> Fix race condition for method root marking in VisitNativeRoots

Only mark if non null, we may see a non zero length with a null
array due to race conditions with class loading.

Bug: 22077752
Change-Id: Icd37f70482efe320185d46ce4391aa0e0e43ff6f
bad9c7b7f88689133cae59d9ccae231822a2020c 14-Jun-2015 Mathieu Chartier <mathieuc@google.com> New experimental GC stress mode

Tries to do a GC for every unique call stack (up to 16 frames).
The goal is to catch moving GC bugs and lock violations without being
rediculously slow. Some tests fail on 64 bits, 32 bit host doesn't
work. N5 is booting.

Added runtime -Xgc options: gcstress and nogcstress.

Bug: 21664466

(cherry picked from commit 310008008c90fea246efd00cb99ee7ded97c5209)

Change-Id: Icb8e420f2048e8ee83bcca7937563166a2638f5c
310008008c90fea246efd00cb99ee7ded97c5209 14-Jun-2015 Mathieu Chartier <mathieuc@google.com> New experimental GC stress mode

Tries to do a GC for every unique call stack (up to 16 frames).
The goal is to catch moving GC bugs and lock violations without being
rediculously slow. Some tests fail on 64 bits, 32 bit host doesn't
work. N5 is booting.

Added runtime -Xgc options: gcstress and nogcstress.

Bug: 21664466

Change-Id: Icb8e420f2048e8ee83bcca7937563166a2638f5c
33d6903e570daf8f3cf7c1f6ebd9a6dd22c7c23c 18-Jun-2015 Roland Levillain <rpl@google.com> Replace some run-time assertions with compile-time ones in ART.

Change-Id: I16c3fad45c4b98b94b7c83d071374096e81d407a
c449e8b79aaaf156ce055524c41474cc1200ed5a 11-Jun-2015 Igor Murashkin <iam@google.com> runtime: Minor cleanup and extra comments around interpreter

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

Bug: 19264997

(cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33)

Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d

Fix some ArtMethod related bugs

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

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

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

TODO: Fix JDWP tests.

Bug: 19264997

Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3

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

Bug: 19264997
Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457

Fix JDWP tests after ArtMethod change

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

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

Bug: 19264997
Change-Id: I363e293796848c3ec491c963813f62d868da44d2

Fix accidental IMT and root marking regression

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

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

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

Bug: 19264997
Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0

Fix bogus image test assert

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

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

Bug: 19264997
Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a

[MIPS64] Fix art_quick_invoke_stub argument offsets.

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

This fixes mips64 boot.

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

Optimizing + quick tests are passing, devices boot.

TODO: Test and fix bugs in mips64.

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

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

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

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

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

Bug: 13925192

(cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0)

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

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

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

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

Bug: 13925192
Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
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
d3ed9a320a89cb9b91b2361892c043ab7e112717 10-Apr-2015 Mathieu Chartier <mathieuc@google.com> Fix DCHECK failures from Class::VisitFieldRoots

We now use GetDeclaringClassUnchecked when marking roots to fix
flaky test failures. Fixed a race condition in root marking where
we could have non zero field array length with a null pointer.
Fixed a race condition where we could be marking roots before
FixupTemporaryDeclaringClass had finished. The solution is to
only do the declaring class CHECK if we are at least resolved.
Fixed JDWP tests by changing FieldId / MethodId to be 64 bits.

Also some cleanup.

Change-Id: Ibac09519860d93c3f68a5cc964bbc91dc10a279a
3481ba2c4e4f3aa80d8c6d50a9f85dacb56b508b 13-Apr-2015 Vladimir Marko <vmarko@google.com> ART: Clean up includes.

Reduce dependencies to improve incremental build times.
Break up circular dependency involving class_linker-inl.h.

Change-Id: I4be742c5c2b5cd9855beea86630fd68aab76b0db
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
e01a520fe0010f8abd344b5ed7120787d7ed1d71 19-Mar-2015 Hiroshi Yamauchi <yamauchi@google.com> Assembly TLAB allocation fast path for x86_64.

TODO: resolved/initialized cases, other architectures.

Bug: 9986565
Change-Id: If6df3449a3b2f5074d11babdda0fd2791fd54946
987ca8b9f054a68eaaeb6ac762dc0d8a07fe180d 15-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add more info to GetSFields DCHECK

Some hprof test 64 bit failures had this DCHECK failing.

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

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
a6928661ad617880c99e3d8199b95871736564db 12-Dec-2014 Andreas Gampe <agampe@google.com> ART: More logging on GetAccessFlags failure

Bug: 18732531
Change-Id: I803d0dcd8c5e142b57dbdc40051fecbf71dd351d
3ac90da48e9cd56eb4b392c7f176e9267d146500 02-Dec-2014 Pavel Vyssotski <pavel.n.vyssotski@intel.com> Fix OOM throwing if it happens in finalizer reference (take 2)

The Class::Alloc should return null if OOM happened during
adding finalizer reference, even if finalizable object is
allocated succesfully.

Added new more reliable test.

Change-Id: Id5fed3bdb16297d6d3a2b14ce62cc305aa703d60
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
Signed-off-by: Pavel Vyssotski <pavel.n.vyssotski@intel.com>
eace45873190a27302b3644c32ec82854b59d299 25-Nov-2014 Mathieu Chartier <mathieuc@google.com> Move dexCacheStrings from ArtMethod to Class

Adds one load for const strings which are not direct.

Saves >= 60KB of memory avg per app.
Image size: -350KB.

Bug: 17643507
Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8

(cherry picked from commit f521f423b66e952f746885dd9f6cf8ef2788955d)
f521f423b66e952f746885dd9f6cf8ef2788955d 25-Nov-2014 Mathieu Chartier <mathieuc@google.com> Move dex cache strings from ArtMethod -> Class

Adds one load for const strings which are not direct.

Saves >= 60KB of memory avg per app.
Image size: -350KB.

Bug: 17643507
Change-Id: I2d1a3253d9de09682be9bc6b420a29513d592cc8
76649e8d775519fe19f2b14d18ac488c13296054 10-Nov-2014 Vladimir Marko <vmarko@google.com> Keep original order of fields in Class.

The fields of a class are ordered alphabetically in the dex
file. Keep the same order in the field arrays so that we can
do binary search lookups by name. Those lookups will be
implemented in a subsequent change in libcore/.

Bug: 18211592

(cherry picked from commit bfa3ed0ad988e1da13626ddbaf6dcae0c58ea79e)

Change-Id: I8f979de62ffe37d1c7d5c721717d2f3501e7c9e6
bfa3ed0ad988e1da13626ddbaf6dcae0c58ea79e 10-Nov-2014 Vladimir Marko <vmarko@google.com> Keep original order of fields in Class.

The fields of a class are ordered alphabetically in the dex
file. Keep the same order in the field arrays so that we can
do binary search lookups by name. Those lookups will be
implemented in a subsequent change in libcore/.

Bug: 18211592
Change-Id: I8f979de62ffe37d1c7d5c721717d2f3501e7c9e6
575e78c41ece0dec969d31f46be563d4eb7ae43b 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: Replace COMPILE_ASSERT with static_assert (runtime)

Replace all occurrences of COMPILE_ASSERT in the runtime tree.

Change-Id: I01e420899c760094fb342cc6cb9e692dd670a0b2
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
f4c15a18eb055735857a280856be5b142e0c1113 21-Oct-2014 Hiroshi Yamauchi <yamauchi@google.com> Fix a DCHECK failure IsResolved() || IsErroneous().

Bug: 17914035
Change-Id: I90877d31fdce3d3bf7b5f22f7759f9536ab14d03
74d6a8221c11ac4aa72808863db423aca44117f2 03-Oct-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Fix OOM throwing if it happens in finalizer reference"

This reverts commit 6d7729d6ae8b2ac3800e92092d61390ce4e3b6d7.

Change-Id: I3e863b7372657ee85b0e48029c3a3e2b4ba75a7c
6d7729d6ae8b2ac3800e92092d61390ce4e3b6d7 01-Oct-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> Fix OOM throwing if it happens in finalizer reference

The Class::Alloc should return null if OOM happened during
adding finalizer reference, even if finalizable object is
allocated succesfully.

Change-Id: I66c1cdda50228bf1302839785ce4d4889b676f5b
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
f0edfc355893d53d1104b05501c99ad5ccf305c4 25-Sep-2014 Hiroshi Yamauchi <yamauchi@google.com> Some optimizations for the array alloc path.

- Force Array::Alloc() to be inlined.
- Simplify the array size overflow check.
- Turn fill_usable into a template parameter.
- Remove a branch in Array::DataOffset() and avoid
Primitive::ComponentSize(), which has a switch, in the array alloc
path.
- Strength reductions in the array size computation by using component
size shifts instead of component sizes. Store component size shift
in the upper 16 bits of primitive_type field.
- Speedup: ~4% (3435->3284) in MemAllocTest on N4.

Bug: 9986565

Change-Id: I4b142ffac4ab8b5b915836f1660a949d6442344c
48498591b90a8ff7b24b1ce05c220e3bc42013df 11-Sep-2014 Andreas Gampe <agampe@google.com> ART: Correctly make methods preverified

Bug: 16828525

(cherry picked from commit df1532b9ba0cda2d00b78fbdef461f8a6cf8a737)

Change-Id: I66756348b2aa50e41dacca59769b6810a91c73b0
df1532b9ba0cda2d00b78fbdef461f8a6cf8a737 11-Sep-2014 Andreas Gampe <agampe@google.com> ART: Correctly make methods preverified

Bug: 16828525
Change-Id: I66756348b2aa50e41dacca59769b6810a91c73b0
381e4ca3cc9fc6405ff20e1de873a56d78d51923 26-Aug-2014 Fred Shih <ffred@google.com> Filling hole between subclass and superclass.

Subclasses no longer need to be 4-byte aligned at the end. Any gaps
between a superclass and its subclasses will be filled in by halfword
or byte fields if possible.

Refactored the alignment and shuffling methods to use a priority queue
in order to reduce the amount of logic when laying out objects.

Change-Id: Ifed71af534e0c5e77bb14555c44b973fe66df6da
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
cb6b0f31ede2275e79e6199ec391147585a37a2a 12-Aug-2014 Ian Rogers <irogers@google.com> Avoid use of std::string where we have const char*.

Removing the ClassHelper caused std::string creation for all calls to
Class::GetDescriptor and a significant performance regression. Make the
std::string an out argument so the caller can maintain it and its life time
while allowing GetDescriptor to return the common const char* case.

Don't generate GC maps when compilation is disabled.

Remove other uses of std::string that are occuring on critical paths.
Use the cheaper SkipClass in CompileMethod in CompilerDriver.
Specialize the utf8 as utf16 comparison code for the common shorter byte
encoding.
Force a bit of inlining, remove some UNLIKELYs (they are prone to pessimizing
code), add some LIKELYs.

x86-64 host 1-thread interpret-only of 57 apks:
Before: 29.539s
After: 23.467s

Regular compile:
Before: 1m35.347s
After: 1m20.056s

Bug: 16853450
Change-Id: Ic705ea24784bee24ab80084d06174cbf87d557ad

Conflicts:
runtime/utils.cc
1ff3c98775a4577cf053dba9a0c2d5c21c07b298 12-Aug-2014 Ian Rogers <irogers@google.com> Avoid use of std::string where we have const char*.

Removing the ClassHelper caused std::string creation for all calls to
Class::GetDescriptor and a significant performance regression. Make the
std::string an out argument so the caller can maintain it and its life time
while allowing GetDescriptor to return the common const char* case.

Don't generate GC maps when compilation is disabled.

Remove other uses of std::string that are occuring on critical paths.
Use the cheaper SkipClass in CompileMethod in CompilerDriver.
Specialize the utf8 as utf16 comparison code for the common shorter byte
encoding.
Force a bit of inlining, remove some UNLIKELYs (they are prone to pessimizing
code), add some LIKELYs.

x86-64 host 1-thread interpret-only of 57 apks:
Before: 29.539s
After: 23.467s

Regular compile:
Before: 1m35.347s
After: 1m20.056s

Bug: 16853450
Change-Id: Ic705ea24784bee24ab80084d06174cbf87d557ad
e19f2b00eebd61e73761ab531866654f08968711 16-Jul-2014 Mingyao Yang <mingyao@google.com> Set vtable in class object to null after linking.

This is follow-up work of embedding imt and vtable for
faster interface/virtual call dispatching.
Once vtable becomes embedded, the original vtable is nulled.

(cherry picked from commit 2cdbad7c62f126581ec5177104de961c4d71adaa)

Change-Id: I6acdcd1ee560d387fb77c55c58bbe3598c197ba1
2cdbad7c62f126581ec5177104de961c4d71adaa 16-Jul-2014 Mingyao Yang <mingyao@google.com> Set vtable in class object to null after linking.

This is follow-up work of embedding imt and vtable for
faster interface/virtual call dispatching.
Once vtable becomes embedded, the original vtable is nulled.

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

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

(cherry picked from commit 4ee7a665e7f9cd2c5ace2d6304e33f64067b209f)

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

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

Change-Id: I7e6a526954467aaf68deeed999880dfe9aa5f06e
98d1cc8033251c93786e2fa8c59a2e555a9493be 16-May-2014 Mingyao Yang <mingyao@google.com> Improve performance of invokevirtual/invokeinterface with embedded imt/vtable

Add an embedded version of imt/vtable into class object. Both tables start at
fixed offset within class object so method/entry point can be loaded directly
from class object for invokeinterface/invokevirtual.

Bug: 8142917
Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
4e99b3d8955131f3fc71aa113f0fa71f0092cb6f 24-Jun-2014 Sebastien Hertz <shertz@google.com> Add missing class initialization during compilation and tests

Adds missing class initialization during compilation and tests, especially
java.lang.Class. Otherwise, we'd be able to execute code while the referring
class is not initialized or initializing.

Also adds mirror::Class::AssertInitializedOrInitializingInThread method to
check class initialization when entering the interpreter: the called method's
declaring class must either be initialized or be initializing by the current
thread (other threads must be waiting for the class initialization to complete
holding its lock). Note we only do this check in debug build.

Bump oat version to force compilation.

Bug: 15899971
Change-Id: I9a4edd3739a3ca4cf1c4929dcbb44cdf7a1ca1fe
4f1ebc2b86c8467d1ecb3ec655316e6d7ee8b8b5 25-Jun-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers to the constant roots.

This change makes it possible to concurrently scan the constant roots
(the roots visited by Runtime::VisitConstantRoots()) such as the class
of java.lang.Class by adding read barriers.

Bug: 12687968
Change-Id: If1afea471c4e1093688d2db37b7f1fc2742edeef
52e4b43d62896b56f8c2bd041e528472bb4a0d8d 10-Jun-2014 Mathieu Chartier <mathieuc@google.com> Add mark compact collector.

The mark compact collector is a 4 phase collection, doing a normal
full mark_sweep, calculating forwarding addresses of objects in the
from space, updating references of objects in the from space, and
moving the objects in the from space.

Support is diabled by default since it needs to have non movable
classes and field arrays. Performance numbers is around 50% as fast.

The main advantage that this has over semispace is that the worst
case memory usage is 50% since we only need one space isntead of two.

TODO: Make field arrays and classes movable. This causes complication
since Object::VisitReferences relies on these, so if we update the
fields of an object but another future object uses this object to
figure out what fields are reference fields it doesn't work.

Bug: 14059466

Change-Id: I661ed3b71ad4dde124ef80312c95696b4a5665a1
bd0fb61e24270b1f382ecbef4c1260c703550e84 20-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Simplify Class::IsArtFieldClass().

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

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

Bug: 12687968
Change-Id: Ibbecc08f4e3b898851805d690dff8ccac55e94f2
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
f832284dd847ff077577bb5712225430bbbb3b67 16-May-2014 Mathieu Chartier <mathieuc@google.com> Delete ClassHelper and fix compaction bug in GetDirectInterface

Cleanup helps to prevent compaction bugs. Fixed a fairly serious
compaction error caused by calling ClassHelper::GetDirectInterface
without handling the case where it causes thread suspension due to
ResolveType.

Bug: 8981901

Change-Id: I82b3bb6dd48d21eb6ece7aae0733c4a23c2bc408
25023c744c4388a6459b21cc3babf8c602b024a2 09-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Make it possible to disable read barriers in Class::GetObjectSize()

This is a leftover from cl/91831 (commit
9103c86a98524e9ddfd14f8cee56e919f68eee9b) that attempted to make it
possible to disable read barriers in Object::SizeOf().

Bug: 12687968
Change-Id: I2b05076832936881ec61bc21b6eb6b7c04e0a1f0
6e83c172f385cb45dd13bbcf41d2df8e410828c6 02-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Replace the bool kDoReadBarrier template parameter with an enum.

Fix one kDoReadBarrier/kIsVolatile mixup in an Object::GetFieldObject
call.

Bug: 12687968

Change-Id: I896b1137b21a20c0504abd2bf3fe6f83805f3300
8668c3cbdcf9471bd97e0da68a240051f2973074 25-Apr-2014 Mathieu Chartier <mathieuc@google.com> Add finalizer references from the entrypoints.

We now have an invariant where we never allocate finalizable
objects with the Initialized or Resolved entrypoints. This speeds up
allocation by only doing the check in the slow path.

Before:
MemAllocTest: 3625, 3707, 3641
EvaluateAndApplyChanges: 3448, 3421, 3413

After:
MemAllocTest: 3164, 3109, 3135
EvaluateAndApplyChanges: 3272, 3299, 3353

Bug: 14078487

Change-Id: I2b0534af3e7c75ea5e5257cf3647744f7abfb74e
b0fa5dc7769c1e054032f39de0a3f6d6dd06f8cf 29-Apr-2014 Ian Rogers <irogers@google.com> Force inlining on trivial accessors.

Make volatility for GetFieldObject a template parameter.
Move some trivial mirror::String routines to a -inl.h.

Bug: 14285442

Change-Id: Ie23b11d4f18cb15a62c3bbb42837a8aaf6b68f92
9103c86a98524e9ddfd14f8cee56e919f68eee9b 22-Apr-2014 Hiroshi Yamauchi <yamauchi@google.com> More code for the read barrier support.

Make it possible to disable the RB in Object::SizeOf() (and the
functions it calls transitively) which the collector will need to call
to get the size of an object when copying.

Add Object::AtomicSetReadBarrierPointer() for atomic write of a RB
pointer.

Bug: 12687968
Change-Id: Ibedd252860ac7ccd17e4e7d71b377a8892b48ff0
4cd662e54440f76fc920cb2c67acab3bba8b33dd 04-Apr-2014 Hiroshi Yamauchi <yamauchi@google.com> Fix Object::Clone()'s pre-fence barrier.

Pass in a pre-fence barrier object that sets in the array length
instead of setting it after returning from AllocObject().

Fix another potential bug due to the wrong default pre-fence barrier
parameter value. Since this appears error-prone, removed the default
parameter value and make it an explicit parameter.

Fix another potential moving GC bug due to a lack of a SirtRef.

Bug: 13097759
Change-Id: I466aa0e50f9e1a5dbf20be5a195edee619c7514e
407f702da4f867c074fc3c8c688b8f8c32279eff 18-Feb-2014 Mathieu Chartier <mathieuc@google.com> Refactor object reference visiting logic.

Refactored the reference visiting logic to be in mirror::Object
instead of MarkSweep.

Change-Id: I773249478dc463d83b465e85c2402320488577c0
c2f4d0240b3a9b905dff5b546924865f15241481 04-Mar-2014 Mathieu Chartier <mathieuc@google.com> Fix SafePrettyTypeOf to never call VerifyObject.

Calling VerifyObject from the segfault handler caused another
segfault.

Change-Id: I459646594d830cbb110a4ac2bac25a7b90794854
7170092b783c35cf48aaeafe903acad4eee81efc 21-Nov-2013 Jeff Hao <jeffhao@google.com> Search for miranda methods in virtual methods instead of interface.

Also added tests that get miranda methods via reflection and jni.
Miranda methods can't be found via reflection, and have the interface
class as their declaring class when found via jni.

Bug: 11736932
(cherry picked from 201803fb1acd15b9daae51d816e1b08aededdc41)

Change-Id: If6700303698967b7fd2c0152216461c447cbf2f9
4e30541a92381fb280cd0be9a1763b713ee4d64c 19-Feb-2014 Mathieu Chartier <mathieuc@google.com> Fix and optimize verify object.

VerifyObject no longer resides in heap. You can now enable
VerifyObject for non-debug builds. VerifyStack is still slow, so it
is now guarded by its own flag.

Fixed the image writer to not use verification at places where
verification fails due to invalid reads.

Fixed RosAlloc to use SizeOf which doesn't call verify object.

Added a flag paremeter to some of the mirror getters / setters to
be able to selectively disable VerifyObject on certain calls.

Optimized the GC to not verify each object multiple times during
object scanning if verify object is enabled.

Added 3 verification options: verify reads, verify this, and verify
writes so that you can select how much verification you want for
mirror getters and setters.

Removed some useless DCHECKs which would slow debug builds without
providing any benefits.

TODO: RosAlloc verification doesn't currently work with verify
objects.

Bug: 12934910
Bug: 12879358

Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
073278cd7129ff07dbcd6ccfabd2c34f47ec92ad 20-Feb-2014 Brian Carlstrom <bdc@google.com> Do not FixupStaticTrampolines of uninitialized classes

Bug: 13027732
Change-Id: I5966d63afd8fbcd091801297290f117f3c9cb44c
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
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
64cffee929a1782622015fd18beebc86d0afb1da 04-Feb-2014 Vladimir Marko <vmarko@google.com> Make DexCache references const.

Clean up after https://android-review.googlesource.com/80446 .

Change-Id: I32dac9d8aa68bb891ec8b551d771f65db7be409d
89786437f4c0176b35ca0376153dd18ab7df4924 31-Jan-2014 Vladimir Marko <vmarko@google.com> Don't assume resolved type has the same dex cache.

When we resolve a type with a certain DexCache that type's
GetDexCache() doesn't necessarily return the same DexCache.
This could have led to the wrong DexFile being used in
access checks by the CompilerDriver.

Change-Id: I2c836477f69f142bcbff902207dc0ad83854a398
23a282146042a0d171aec2a415176f5d0621a90c 09-Jan-2014 Vladimir Marko <vmarko@google.com> Clean up access checks.

Change-Id: Ia62ba6c8f1d0a9bfbbfde2d7be4c52c0f982b9d2
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
201803fb1acd15b9daae51d816e1b08aededdc41 21-Nov-2013 Jeff Hao <jeffhao@google.com> Search for miranda methods in virtual methods instead of interface.

Also added tests that get miranda methods via reflection and jni.
Miranda methods can't be found via reflection, and have the interface
class as their declaring class when found via jni.

Bug: 11736932
Change-Id: I92b4fdf31be64269898ed2686a28dfb6008b213a
cbb2d20bea2861f244da2e2318d8c088300a3710 15-Nov-2013 Mathieu Chartier <mathieuc@google.com> Refactor allocation entrypoints.

Adds support for switching entrypoints during runtime. Enables
addition of new allocators with out requiring significant copy
paste. Slight speedup on ritzperf probably due to more inlining.

TODO: Ensuring that the entire allocation path is inlined so
that the switch statement in the allocation code is optimized
out.

Rosalloc measurements:
4583
4453
4439
4434
4751

After change:
4184
4287
4131
4335
4097

Change-Id: I1352a3cbcdf6dae93921582726324d91312df5c9
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
88474b416eb257078e590bf9bc7957cee604a186 24-Oct-2013 Jeff Hao <jeffhao@google.com> Implement Interface Method Tables (IMT).

Change-Id: Idf7fe85e1293453a8ad862ff2380dcd5db4e3a39
79b4f38dd35b83206e8166aaafb94bd75c3318b3 24-Oct-2013 Mathieu Chartier <mathieuc@google.com> Fix incorrect initial dex cache size.

We were previously setting it to be sizeof(DexCacheClass) instead
of sizeof(DexCache). This was causing some problems with
compaction when I relied on the object sizes being accurate to
visit objects in the bump pointer space.

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

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

Bug: 9986565
Change-Id: I1606c74ddb21676cbc1de1a40e9b076fc23eaea4
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
2ce745c06271d5223d57dbf08117b20d5b60694a 18-Jul-2013 Brian Carlstrom <bdc@google.com> Fix cpplint whitespace/braces issues

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