History log of /art/runtime/mirror/object-inl.h
Revision Date Author Comments
8f4b056427a9d2321e3aa4f21ca8ffb18b3e5ae6 02-Mar-2018 David Sehr <sehr@google.com> Move most of runtime/base to libartbase/base

Enforce the layering that code in runtime/base should not depend on
runtime by separating it into libartbase. Some of the code in
runtime/base depends on the Runtime class, so it cannot be moved yet.
Also, some of the tests depend on CommonRuntimeTest, which itself needs
to be factored (in a subsequent CL).

Bug: 22322814
Test: make -j 50 checkbuild
make -j 50 test-art-host

Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
Merged-In: c431b9dc4b23cc950eb313695258df5d89f53b22

(cherry picked from commit c431b9dc4b23cc950eb313695258df5d89f53b22)
928033d81f63912f669acd27a72897694eb31db6 07-Feb-2018 Orion Hodson <oth@google.com> Revert^2 "ART: Interpreter support for VarHandle accessors"

This reverts commit c4d3bf4eaff9720ed0bb7775db6fc24a1bd755dd.

Bug: 65872996
Test: art/test/testrunner.py -b --host
Change-Id: I2d1017c45cee5b2fd2dd05e5eeff0a72146663b1
001eff919009f60af4f8184ab37c10ef56275c68 24-Jan-2018 Roland Levillain <rpl@google.com> Improve to-space invariant error reporting in the CC collector.

In particular, distinguish references in an unused region from
the region space (which should never be encountered) from a
reference in a non-moving space.

Test: art/test/testrunner/testrunner.py
Bug: 72758079
Bug: 73004523
Change-Id: Iac632ae71dce9a36b33c14586eeb709dc2d7e7ce
c4d3bf4eaff9720ed0bb7775db6fc24a1bd755dd 06-Feb-2018 Orion Hodson <oth@google.com> Revert "ART: Interpreter support for VarHandle accessors"

This reverts commit becc83b59ff703c02198f832dbc3216a0ab8a022.

Reason for revert: breaks on the ART buildbots due to localized toolchain differences.

Change-Id: Ieb1d93b0fc7116ddc542d8bbfee1975bcb30a8f7
becc83b59ff703c02198f832dbc3216a0ab8a022 08-Dec-2017 Orion Hodson <oth@google.com> ART: Interpreter support for VarHandle accessors

Add support for invoking VarHandle accessors in the interpreter and
forces code with VarHandles accessor invocations to use the interpreter.

Bug: 65872996
Test: art/test/run-test --host 712
Change-Id: I9ee3ad6aef6a3bc73d90cec0a8e023e5db42b7a2
4557b3858a66aa20e42bce937e1f0620aad880a2 03-Jan-2018 Orion Hodson <oth@google.com> ART: Rename Atomic::CompareExchange methods

Renames Atomic::CompareExchange methods to Atomic::CompareAndSet
equivalents. These methods return a boolean and do not get the witness
value. This makes space for Atomic::CompareAndExchange methods in a
later commit that will return a boolean and get the witness value.

This is pre-work for VarHandle accessors which require both forms.

Bug: 65872996
Test: art/test.py --host -j32
Change-Id: I9c691250e5556cbfde7811381b06d2920247f1a1
09659c22dc2f2c85a0ade965d1fc5160944b8692 19-Sep-2017 Andreas Gampe <agampe@google.com> ART: Remove heap poisoning from globals.h

Remove mostly-unused include and move it to its users.

Test: m
Change-Id: Ibb40f919db64a490290c6e18cf1123aaf44199fc
cc55e1dcdd2ec669c635420468b3cc4c99740f0a 28-Jul-2017 Hans Boehm <hboehm@google.com> Don't use fences to implement volatiles

Mixing the fence-based implementation with acquire/release instructions
on ARMv8 is not just ugly but incorrect. A volatile store; volatile
load sequence implemented as a release store followed by ld; dmb
does not prevent reordering.

This should remove the last places we were using fences to implement
volatiles.

The HeapReference representation is changed to be an Atomic,
thereby avoiding many casts. We no longer inherit from ObjectReference,
which was documented to be a value type. HeapReference is not, since
it contains an atomic.

Disentangle HeapReference and ObjectReference/CompressedReference
uses sufficiently to get the code to compile again. They were
previously used somewhat interchangably in a few places, in spite
of the different intended semantics (value-type vs. a concurrently-
updateable field). Further disentanglement might be useful.

Flag a strange fence use I haven't yet understood.

Test: Booted AOSP. Ran default tests. Some object code inspection.

Bug: 31023171

Test: Built AOSP
Change-Id: I7b3c3e624f480994541c8e3a79e585071c122a3d
895f92218f705ff8ad9c47b8be0c093130d9fbbc 05-Jul-2017 Andreas Gampe <agampe@google.com> ART: Fix up small header includes

Test: m
Change-Id: I6978d6eb4b95a6ee810e5a48ca6f5d6c590d4ce1
8cf9cb386cd9286d67e879f1ee501ec00d72a4e1 19-Jul-2017 Andreas Gampe <agampe@google.com> ART: Include cleanup

Let clang-format reorder the header includes.

Derived with:

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

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

Test: mmma art
Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
6d3e76884710e639e79a46d505395bc83ad5ec7d 11-Jul-2017 Chang Xing <chxing@google.com> Abstract SetField functions with Transaction check

Abstracted several functions which set objects' fields with a check to
test whether transaction is active to determine one template argument,
this make more object modification operations support transaction.

Replaced some function calls with transaction checking version to
support clinit for app image to run under transaction.

Tests shows not breaking anything, testcase cover this situation will be
added shortly.

Test: make test-art-host -j64
Change-Id: Ic15a4428a7c7cce6832651e1894eb760354de009
2ff3b97500b717f69415ae474d5cfb1613cd15ee 06-Jun-2017 Andreas Gampe <agampe@google.com> ART: More header cleanups

Clean up some more includes. Move some -inls from object-inl to
object-refvisitor-inl. Fix up transitives.

Test: m test-art-host
Change-Id: I0e3e268d95a1c71b0a80fc963d13d191a97b2283
fdd513d6c522841e82f1dc144d19a8d60269b9f7 01-Jun-2017 Mathieu Chartier <mathieuc@google.com> Move to release CAS for updating object fields

Relaxed cas is not sufficient to make sure threads that read the
field will see the copied contents of objects.

Bug: 37187694
Bug: 62240510

Test: test-art-host

(cherry picked from commit a1f20c3f8d0dabb9723acccf3ba760acf3ebe62d)

Change-Id: I8bff8a67c2c52eb131714b52e6d842c8c08dd70a
a1f20c3f8d0dabb9723acccf3ba760acf3ebe62d 01-Jun-2017 Mathieu Chartier <mathieuc@google.com> Move to release CAS for updating object fields

Relaxed cas is not sufficient to make sure threads that read the
field will see the copied contents of objects.

Bug: 37187694
Bug: 62240510

Test: test-art-host

Change-Id: I1239817e2b63e0e43ac3ae3148b73487408b378b
c15a2f4f45661a7f5f542e406282c146ea1a968d 21-Apr-2017 Andreas Gampe <agampe@google.com> ART: Add object-readbarrier-inl.h

Move some read-barrier code into a new header. This prunes the
include tree for the concurrent-copying collector. Clean up other
related includes.

Test: mmma art
Change-Id: I40ce4e74f2e5d4c692529ffb4df933230b6fd73e
c6ea7d00ad069a2736f603daa3d8eaa9a1f8ea11 02-Feb-2017 Andreas Gampe <agampe@google.com> ART: Clean up art_method.h

Clean up the header. Fix up other headers including the -inl file,
in an effort to prune the include graph. Fix broken transitive
includes by making includes explicit. Introduce new -inl files
for method handles and reference visiting.

Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art
Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art
Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
d08f66f519f6cf75c2eb05a489b6e87f739badff 13-Apr-2017 Mathieu Chartier <mathieuc@google.com> Various debug ART GC performance improvements

Removed unnecessary read barriers in SizeOf and a few other places.
Disabled disallow read barrier check.

Before:
GC time: 15.817s
Real 0m26.113s
user 1m16.780s
sys 0m3.152s

After:
GC time: 9.212s
real 0m19.875s
user 1m9.916s
sys 0m1.916s

Bug: 35644369
Test: test-art-host

Change-Id: I79a65259deff2a478a96e02ae69b14730b6dcbe6
1595815c2a914a78df7dfb6f0082f47d4e82bb36 10-Feb-2017 Alexey Frunze <Alexey.Frunze@imgtec.com> MIPS: Implement read barriers.

This is the core functionality. Further improvements
will be done separately.

This also adds/moves memory barriers where they belong and
removes the UnsafeGetLongVolatile and UnsafePutLongVolatile
MIPS32 intrinsics as they need to load/store a pair of
registers atomically, which is not supported directly by
the CPU.

Test: booted MIPS32R2 in QEMU
Test: test-art-target-run-test
Test: booted MIPS64 (with 2nd arch MIPS32R6) in QEMU
Test: "testrunner.py --target --optimizing -j1"
Test: same MIPS64 boot/test with ART_READ_BARRIER_TYPE=TABLELOOKUP
Test: "testrunner.py --target --optimizing --32 -j2" on CI20
Test: same CI20 test with ART_READ_BARRIER_TYPE=TABLELOOKUP

Change-Id: I0ff91525fefba3ec1cc019f50316478a888acced
90b936ddda63139ff46a6755c3b83ad6e4ab4ac5 31-Jan-2017 Andreas Gampe <agampe@google.com> ART: Refactor verify_object.h

Move the actual VerifyObject check into a new cc file, as we
commonly don't enable the check at all. This allows to cut the
-inl include from almost all current users.

This also exposes missing -inl includes. Also fix up some of our old
mess where .h defined functions require -inl.h defined functions.

Test: m

Change-Id: I3dd821bbe2015564a29bf1ed9be00f7a7276ad61
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
12b58b23de974232e991c650405f929f8b0dcc9f 01-Nov-2016 Hiroshi Yamauchi <yamauchi@google.com> Clean up the runtime read barrier and fix fake address dependency.

- Rename GetReadBarrierPointer to GetReadBarrierState.
- Change its return type to uint32_t.
- Fix the runtime fake address dependency for arm/arm64 using inline
asm.
- Drop ReadBarrier::black_ptr_ and some brooks code.

Bug: 12687968
Test: test-art with CC, Ritz EAAC, libartd boot on N9.
Change-Id: I595970db825db5be2e98ee1fcbd7696d5501af55
ef41db7a3f322a1feb305fdb457410c4cea94d00 26-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move interpreter to ObjPtr

Moved most of interpreter, interpreter_common,
interpreter_switch_impl, and some of mterp to ObjPtr.

Bug: 31113334

Test: test-art-host ART_TEST_INTERPRETER=true
Test: art/tools/run-libcore-tests.sh '--mode=host' '--variant=X32' --debug

Change-Id: I0935d18287e1332205c17c5a018aa167788ab897
709b070044354d9f47641f273edacaeeb0240ab7 13-Oct-2016 David Sehr <sehr@google.com> Remove mirror:: and ArtMethod deps in utils.{h,cc}

The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.

One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.

Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
31e88225b2ef68e7f32f11186acf922c74ddabab 15-Oct-2016 Mathieu Chartier <mathieuc@google.com> Move most mirror:: args to ObjPtr

Fixed possible moving GC bugs in ClinitImageUpdate class.

Bug: 31113334

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

Bug: 31113334

Test: test-art-host

Change-Id: I2c4c84645e194c3c435a4a6fd670176b0e98671f
a59d9b228b1eda3bf71a81b6201ec64e26086c23 27-Sep-2016 Mathieu Chartier <mathieuc@google.com> Use ObjPtr for reflection.cc/h/inl

Changed Pretty helpers to use this to reduce usage of Decode. The
eventual goal is not have almost any calls to ObjPtr::Decode.

Moved ObjPtr out of mirror namespace for convenience. Added more
PoisonObjectPointers calls in class linker, thread suspension.

Bug: 31113334

Test: test-art-host

Change-Id: I44d08db5143d95ed1b65e2f00f9749ef5cf379f7
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
c381c36aacf977f7e314e6a91e47b31b04639f62 23-Aug-2016 Mathieu Chartier <mathieuc@google.com> Avoid CAS for marking region space bitmap for baker

Only have the GC thread mark it. This occurs when popping from the
mark stack. The race where an object may be pushed to the mark
stack twice is handled by not scanning if it is already marked.

Also avoid checking is_active when marking from the GC.

EAAC: 1263 -> 1253 (average of 30 runs)
GC time: 7.21s -> 6.83s (average of 18 runs)

Timings on 960 mhz N6P.

Bug: 12687968

Change-Id: I47e98c3e258829d2ba0babd803a219c82a36168c
Test: test-art-host, debug N6P booting with baker CC.
23da026ec7a7fae22833ed2f61a80d9f9bf7e732 30-Jul-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Use try lock to fix class resolution race""

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

Bug: 27417671
Bug: 30500547

Test: test-art-host ART_TEST_GC_STRESS=true

This reverts commit 69bf969c055c31a75d17ea92aeee756042678114.

(cherry picked from commit 4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114)

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

This reverts commit a704eda0078989a73cac111ed309aca50d2e289b.

Bug: 27417671
Bug: 30500547

(cherry picked from commit 69bf969c055c31a75d17ea92aeee756042678114)

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

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

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

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

Added a test.

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

Bug: 27417671

(cherry picked from commit a704eda0078989a73cac111ed309aca50d2e289b)

Change-Id: I1150b19bdc1a5cc87ae95eda4f2b6b4bca215a60
d6a595baf0f389a7eb29fa3d94390c18a29c28da 04-Aug-2016 Mathieu Chartier <mathieuc@google.com> Fix CC table lookup tests

Only set the mark bits for baker barrier, not sure why this
doesn't work for table lookup barrier yet.

Bug: 30162165

Test: test-art-host with CC table lookup

Change-Id: I4309ac22bfc0f8a5c9bf081365e3e38da43eee30
36a270ae4f288e49493432b7128f899ad579849e 29-Jul-2016 Mathieu Chartier <mathieuc@google.com> Change one read barrier bit to mark bit

Optimization to help slow path performance. When the GC marks an
object through the read barrier slow path. The GC sets the mark bit
in the lock word of that reference. This bit is checked from the
assembly entrypoint the common case is that it is set. If the bit is
set, the read barrier knows the object is already marked and there is
no work to do.

To prevent dirty pages in zygote and image, the bit is set by the
image writer and zygote space creation.

EAAC score (lower is better):
N9: 777 -> 700 (average 31 of runs)
N6P (960000 mhz): 1737.48 -> 1442.31 (average of 25 runs)

Bug: 30162165
Bug: 12687968

Test: N9, N6P booting, test-art-host, test-art-target all with CC

Change-Id: Iae0cacfae221e33151d3c0ab65338d1c822ab63d
542451cc546779f5c67840e105c51205a1b0a8fd 26-Jul-2016 Andreas Gampe <agampe@google.com> ART: Convert pointer size to enum

Move away from size_t to dedicated enum (class).

Bug: 30373134
Bug: 30419309
Test: m test-art-host
Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114 30-Jul-2016 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Use try lock to fix class resolution race""

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

Bug: 27417671
Bug: 30500547

Test: test-art-host ART_TEST_GC_STRESS=true

This reverts commit 69bf969c055c31a75d17ea92aeee756042678114.

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

This reverts commit a704eda0078989a73cac111ed309aca50d2e289b.

Bug: 27417671
Bug: 30500547
Change-Id: Ieea05236b9e61c722660cd9497c9d55d13ccd010
a704eda0078989a73cac111ed309aca50d2e289b 13-Jul-2016 Mathieu Chartier <mathieuc@google.com> Use try lock to fix class resolution race

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

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

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

Added a test.

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

Bug: 27417671
Change-Id: Ic6e1c3ca6f45490cf8a7bf8e137dee71ac83ff64
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
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
ed70b4a439acea537d55266bb9b1f309de8cbec9 18-Nov-2015 Hiroshi Yamauchi <yamauchi@google.com> Relax CAS in some uses of Object::AtomicSetReadBarrierPointer.

Aside from the call to change the object from gray to black, the CAS in
AtomicSetReadBarrierPointer doesn't need to be a release CAS.

CC collector Ritz EAAC GC time: 28.4 -> 26.5s (-6.7%) on N5.

Bug: 12687968

Change-Id: Ic162717981b98e7f1e762fd6b27bd0c146187ca4
5abc6f913bc77aa3b9c05ad07905d4c1c28b2661 30-Jun-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Add Object::Get/SetField methods for 8 and 16 bit fields.

For simplicity new methods lack support for transactions.
Those new netods are used to implement sun.misc.Unsafe.get/set
methods for 8/16 bit wide primitives. Those methods are used
by the java primitive serialization/deserialization methods.

Change-Id: Iaa133b32beac996642f691e1611536f5fd11a260
fed3e2fd4919b58f8e4f8cbc317ee101f3b9af49 20-Oct-2015 Hiroshi Yamauchi <yamauchi@google.com> Relax some CASes for the CC collector.

That is, removing some unnecessary memory fences.

We can use the relaxed CAS for the mark bitmap and reference field/GC
root updates because only the atomicity of the updated word matters
there.

We can use the release CAS for the read barrier bits in the lock word
because it needs to make sure the reference field updates are visible
when the object changes black from gray (the field update stores won't
be reordered after the CAS.)

The CC collector's Ritz EAAC GC time decreases from 34.7s to
29.1s (-16%) on N5.

Bug: 12687968

Change-Id: If082d5911a25fac695df66263a8f55ce8149b199
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
66c2d2d64d7ea75602eb63de7ae9bd2eaeb0a3c2 25-Aug-2015 Mathieu Chartier <mathieuc@google.com> Address some comments for class flags

Change-Id: I354f48aefc37ce92c4d02cfce1723db0e28907bf
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
e4275c07e9852a6944f47efa9d0591fceb8e8e36 07-Aug-2015 Mathieu Chartier <mathieuc@google.com> Visit class roots from ClassLoader::VisitReferences

This causes the classes of a class loader to get marked when that
class loader gets marked instead of during class root visiting.

Bug: 22720414

Change-Id: If53f042aff1d9f7bf94ecbe6886601edda029b7d
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
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
3b45ef277e4a5f7e0314d5df7ef82e480156ba75 27-May-2015 Andreas Gampe <agampe@google.com> ART: Fix VerifyObject runtime verification

Update some bit-rotted code to work again. Most tests now work, for
some the verification overhead results in a timeout.

Change-Id: Ieab4f2de474a05e915e24abc93da3c2eeed996eb
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
60f63f53c01cb38ca18a815603282e802a6cf918 24-Apr-2015 Hiroshi Yamauchi <yamauchi@google.com> Use the lock word bits for Baker-style read barrier.

This enables the standard object header to be used with the
Baker-style read barrier.

Bug: 19355854
Bug: 12687968

Change-Id: Ie552b6e1dfe30e96cb1d0895bd0dff25f9d7d015
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
2cd334ae2d4287216523882f0d298cf3901b7ab1 09-Jan-2015 Hiroshi Yamauchi <yamauchi@google.com> More of the concurrent copying collector.

Bug: 12687968
Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
2d7210188805292e463be4bcf7a133b654d7e0ea 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8

(cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f)
e832e64a7e82d7f72aedbd7d798fb929d458ee8f 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8
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
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
2c4257be8191c5eefde744e8965fcefc80a0a97d 24-Oct-2014 Ian Rogers <irogers@google.com> Tidy logging code not using UNIMPLEMENTED.

Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
13735955f39b3b304c37d2b2840663c131262c18 08-Oct-2014 Ian Rogers <irogers@google.com> stdint types all the way!

Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
cdc1aaffabbdf417d29b203b2cd2763ed2d623f8 09-Oct-2014 Ian Rogers <irogers@google.com> Simplify instance reference offsets.

Don't encode Object's class. Use trailing rather than leading zeroes to give
offset position.

Change-Id: I1ae74e7a01f63696429644adf81cdf6ee58832fe
faff0f05fef90577c9744505555675185832aacd 10-Sep-2014 Mingyao Yang <mingyao@google.com> Remove reference_static_offsets used for iterating through class static fields.

Since static fields are contiguous in class object and there is no need to
traverse super classes, it's not meaningful to use reference_static_offsets.
Also especially with embedded vtable/imt, static field offset can't be encoded
with an unsigned integer anyway.

A corresponding change is made to Class.java to remove the member field.

Bug: 16236588
Change-Id: I1fde3cd9efce884945876f0658c63d992164fd94
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
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
d8434439dc64add41cdfa69ddf96b960af9050de 11-Jul-2014 Hans Boehm <hboehm@google.com> Call strong CAS from unsafe. Add more CAS versions.

Adds a number of additional CAS versions. Calls the correct
one from sun.misc.unsafe, fixing a recently introduced bug.
Avoid unnecessary ordering constraint when installing hash code.

Change-Id: I7c09d0c95ceb2a549ec28ee34084198ab3107946
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
228602f562f1d130d06e60a98752d99c2d467d6a 10-Jul-2014 Ian Rogers <irogers@google.com> Make CAS operations in Object use art::Atomic.

Make naming consistent with art::Atomic.

Change-Id: If3abdb019ef8b53bd809e3fef3fd5248aeb27e9a
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
3035961cb41865b80b927546be0c708b6389cec6 22-May-2014 Hans Boehm <hboehm@google.com> Clean up and augment Atomic class. Replace QuasiAtomic MemBars.

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

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

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

Avoid some redundant fences for long volatile operations.

Incompletely converts low-level memory access operations to Atomic.

Change-Id: Iea828431a0cea46540eb74fcaa02071cab6fdcda
61c5ebc6aee2cac1c363de6fbdac25ada1697fdb 06-Jun-2014 Mathieu Chartier <mathieuc@google.com> Change FieldHelper to use a handle.

Fixed compaction bugs related to FieldHelper::GetType in:
artSet32InstanceFromCode
SetFieldValueImpl
CheckReceiver
Field_set
interpreter::DoFieldPut
MethodVerifier::VerifyISGet
MethodVerifier::VerifyISPut
MethodVerifier::VerifyIGetQuick

Bug: 13077697

Change-Id: I7de9ded2893b5568d43e4daa86fd135bf5508b72
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
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
6a154a419022e2caed4edfd1f311edf733278f35 02-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Update the GetFieldObject calls behind the read barrier macros.

This is a leftover from changes 92535 and 93191.

Bug: 12687968
Change-Id: I4f09d258d037546c716b78d6f1ae6abe5af1137d
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
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
bbd695c71e0bf518f582e84524e1cdeb3de3896c 16-Apr-2014 Mathieu Chartier <mathieuc@google.com> Replace ObjectSet with LargeObjectBitmap.

Speeds up large object marking since large objects no longer required
a lock. Changed the GCs to use the heap bitmap for marking objects
which aren't in the fast path. This eliminates the need for a
MarkLargeObject function.

Maps before (10 GC iterations):
Mean partial time: 180ms
Mean sticky time: 151ms

Maps after:
Mean partial time: 161ms
Mean sticky time: 101ms

Note: the GC durations are long due to recent ergonomic changes and
because the fast bulk free hasn't yet been enabled. Over 50% of the
GC time is spent in RosAllocSpace::FreeList.

Bug: 13571028

Change-Id: Id8f94718aeaa13052672ccbae1e8edf77d653f62
4d7f61d44a732cfbc8573e5d93364983fd746888 17-Apr-2014 Mathieu Chartier <mathieuc@google.com> Use non volatile lock words in semispace collector.

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

Fixed timing logger errors.

Change-Id: I4193c6ccbbbe7a7220dfaabbf3472a5dcebae616
800ac2defde5d12b2f1f313c6b6162560cfa6fc7 03-Apr-2014 Hiroshi Yamauchi <yamauchi@google.com> Insert an empty read barrier call.

Bug: 12687968
Change-Id: Ie1d28658e16e09f6a983cb5c1f0d5b375b7ae069
624468cd401cc1ac0dd70c746301e0788a597759 01-Apr-2014 Hiroshi Yamauchi <yamauchi@google.com> Make the support code for read barriers a bit more general.

Add an option for Baker in addition to Brooks.

Bug: 12687968
Change-Id: I8a31db817ff6686c72951b6534f588228e270b11
580a8dfda74e7999f6b3e28e239ae8461a39dfcb 26-Mar-2014 Mathieu Chartier <mathieuc@google.com> Less redundant verification.

~3 less objects verified per object scanned in the GC. Helps the
irogers dogfood experience.

Change-Id: I6efeab7842a6c702adecef73fb573c19291fecf2
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
8fa2dad7fe7909c8335101d6c8904ae997cdf29f 13-Mar-2014 Mathieu Chartier <mathieuc@google.com> Refactor reference code into mirror namespace.

Added two new files: mirror/reference.h and mirror/reference-inl.h.

Change-Id: Ibe3ff6379aef7096ff130594535b7f7c0b7dabce
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
9d04a20bde1b1855cefc64aebc1a44e253b1a13b 31-Jan-2014 Hiroshi Yamauchi <yamauchi@google.com> (Experimental) Add Brooks pointers.

This feature is disabled by default.

Verified that the Brooks pointers are installed correctly by using the
CMS/SS collectors.

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

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

Also fixed moving GC bugs in MonitorEnter, and FindFieldID.

Change-Id: I794e4fbcc2010875fc6b299c6d4c9fb0f071b71a
29501cf5663c7951717bae3521815d121a778396 08-Feb-2014 Ian Rogers <irogers@google.com> Make primitive getter/setters consistently signed.

Use QuasiAtomic for Cas64, which fixes the MIPS build of ART.

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

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

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

Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
b122a4bbed34ab22b4c1541ee25e5cf22f12a926 20-Nov-2013 Ian Rogers <irogers@google.com> Tidy up memory barriers.

Change-Id: I937ea93e6df1835ecfe2d4bb7d84c24fe7fc097b
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
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
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
deb43702e611d6c75b459ea352a00f5d98fc0aa9 04-Sep-2013 Jeff Hao <jeffhao@google.com> Fix handling of unresolved references in verifier.

The verifier should not treat use of unresolved references as a reason to reject
the entire class. Instead, the verifier treats the instruction as a throw. If
that class is run, the interpreter with extra checks will throw an exception.

Bug: 10457426

(cherry picked from commit a3faaf4bece7f42529c013fe87bd41de59798656)

Change-Id: I161bfdbfa116890ffa9e7a593c756229bd939eb4
a3faaf4bece7f42529c013fe87bd41de59798656 04-Sep-2013 Jeff Hao <jeffhao@google.com> Fix handling of unresolved references in verifier.

The verifier should not treat use of unresolved references as a reason to reject
the entire class. Instead, the verifier treats the instruction as a throw. If
that class is run, the interpreter with extra checks will throw an exception.

Bug: 10457426

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