History log of /art/runtime/native/java_lang_Class.cc
Revision Date Author Comments
f57e4a48cd77f704d2f33ea457b056fd4ecdde9b 03-May-2016 Nicolas Geoffray <ngeoffray@google.com> Put a handle on the String object.

Otherwise, a GC could occur in the loop below, and the String
be moved (note that there was already one for the Class object to
protect for that same problem).

bug:27561834

(cherry picked from commit a96f316f6f0526c91c6c102a267df6b1e4df39da)

Change-Id: I89c093dd67982abb3502975097a337c7e3816360
b3ffbe32b78c18739736fc998d65430b46c510e5 19-Apr-2016 Andreas Gampe <agampe@google.com> ART: Add some reflection cutouts

Add Class.getInnerClassFlags and Method.invoke to unstarted runtime.

Allows to compile-time initialize:
* android.net.NetworkInfo
* android.net.wifi.WifiInfo

Bug: 27265238
Change-Id: I3e267519acf14b08c687f1e831e2027d37158767
08305325d3468d5ef413eb0b36b1ea1b3746a6c4 05-Apr-2016 Jeff Hao <jeffhao@google.com> Remove AnnotationAccess and its remaining uses.

Art side of this change. Adds a test to ensure annotations not marked
for runtime retention can't be seen at runtime.

Bug: 27912552

(cherry picked from commit 1133db79350060158f99210c56f111c6dad43563)

Change-Id: I090a90bc82fc9b5e51aba02dcb3d8cccb6fb0f90
6039e5662507e42896084e561fa546b432698ee6 06-Apr-2016 Andreas Gampe <agampe@google.com> ART: Add getDeclaredConstructor cutout for unstarted runtime

In the vein of getDeclaredMethod and getDeclaredField. Refactor
code from java_lang_Class to share code.

Allows to compile-time initialize:
* sun.security.x509.AVAKeyword
* sun.security.x509.X500Name

Bug: 27265238

(cherry picked from commit f72f19fac0016499d33fd75b0463d0128a58a9f4)

Change-Id: I075c1b11f3408f5b31e4f84140a24fd8d3eaa17e
f72f19fac0016499d33fd75b0463d0128a58a9f4 06-Apr-2016 Andreas Gampe <agampe@google.com> ART: Add getDeclaredConstructor cutout for unstarted runtime

In the vein of getDeclaredMethod and getDeclaredField. Refactor
code from java_lang_Class to share code.

Allows to compile-time initialize:
* sun.security.x509.AVAKeyword
* sun.security.x509.X500Name

Bug: 27265238
Change-Id: I075c1b11f3408f5b31e4f84140a24fd8d3eaa17e
1133db79350060158f99210c56f111c6dad43563 05-Apr-2016 Jeff Hao <jeffhao@google.com> Remove AnnotationAccess and its remaining uses.

Art side of this change. Adds a test to ensure annotations not marked
for runtime retention can't be seen at runtime.

Bug: 27912552
Change-Id: I078069b7b3cb72bfe7d0b9ea61e527fee04d56a3
bc4d218ce2ceef0c4f308d4ff42f7ec1ec43c40e 22-Feb-2016 Andreas Gampe <agampe@google.com> ART: Add unstarted-runtime functions

Add more functions to allow compile-time initialization of
code.

Bug: 27248115

(cherry picked from commit 0866f4ed6338faa4a193b7e819fc7cd72bd7b0ae)

Change-Id: Iaf8d92deb73547ccd31c0d6dde68da3bc14c3985
0866f4ed6338faa4a193b7e819fc7cd72bd7b0ae 22-Feb-2016 Andreas Gampe <agampe@google.com> ART: Add unstarted-runtime functions

Add more functions to allow compile-time initialization of
code.

Bug: 27248115
Change-Id: Iaf8d92deb73547ccd31c0d6dde68da3bc14c3985
3b7027e26106e7bfaa2bfae0f24489372f7ddbf0 08-Feb-2016 Alex Light <allight@google.com> Default methods should not be found by getDeclaredMethod

(cherrypick commit 64fdc804f6b4d8a6f7d86bd9672e3bb1cde7056f)

Bug: 27060609

Change-Id: I77337f5d4c6bb9dd14f57012a9daa1e56a760f1a
64fdc804f6b4d8a6f7d86bd9672e3bb1cde7056f 08-Feb-2016 Alex Light <allight@google.com> Default methods should not be found by getDeclaredMethod

We were incorrectly returning default methods from getDeclaredMethod
calls on an implementing class that uses the default implementation.

Bug: 27060609

Change-Id: I2e07023a11585e5f7cd92c4c0e1263f54aea1f5f
df187e4cc8b1b2dc6cb0043eb91d1dfd72cb490b 01-Feb-2016 Igor Murashkin <iam@google.com> Revert "Revert "reflection: Add new 1.8 AnnotatedElement methods and tests""

This reverts commit 28a2a186537db9fc5a8492e36d9603b48854c04f.

Runtest failure has been fixed in I28c3707e38c1f69ea9d3660f68136f688122ac4e

Change-Id: I1749dc89b790d44b5e40bc8b20aa62885bda792b
28a2a186537db9fc5a8492e36d9603b48854c04f 29-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Revert "reflection: Add new 1.8 AnnotatedElement methods and tests"

Breaks interpreter access checks:

+Exception in thread "main" java.lang.InternalError: java.lang.IllegalAccessError: Method 'void java.lang.reflect.Proxy.doNewInstanceCheck()' is inaccessible to class '$Proxy0' (declaration of '$Proxy0' appears in generated class)


This reverts commit c167ee9b65f05f7c6f007d587fd1655388edaee9.

Change-Id: I6c9429cb6f298e89a2da22f7ded0728251321446
c167ee9b65f05f7c6f007d587fd1655388edaee9 15-Jan-2016 Igor Murashkin <iam@google.com> reflection: Add new 1.8 AnnotatedElement methods and tests

Also:
* Bump the size of the Class vtable size since 3 new virtuals were
added to java.lang.Class
* Refactor Method#isDefault test into a separate file within 048 test.

Change-Id: I8420a4d208bb60874a9cf996766313c7d5058c45
0e7fa6b06e37e7c95509cd234571f469bf5821c2 13-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Also print to error stream.

So we can test between all kinds of configuration (for example
host no-dex2oat removes all error logs).

Change-Id: I5936fdd963e3805c49258ee6ed50d8def23d1aca
7ea4c09989b37351e6c17a10d35934812053a746 07-Jan-2016 Nicolas Geoffray <ngeoffray@google.com> Emit an error message when looking for String#offset.

Debugging two different apps relying on it and swallowing
the getDeclaredField exception took too much of my lifetime.
Adding a LOG(ERROR) can help diagnose quicker.

Also remove unused method getDeclaredFieldInternal.

Change-Id: I0923556a4fdbad2b06c1811ed741d23dbd4aa0a0
9865bde5d822f56c4732214c2005dfcaa41f94cf 21-Dec-2015 Mathieu Chartier <mathieuc@google.com> Rename NullHandle to ScopedNullHandle

This makes it clearer that is invalid to do things like:
Handle<T> h = ScopedNullHandle<T>();

Bug: 26233305
Change-Id: I6d8f54eae01ec2e901cb7043afa853ea77db79fe
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
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
6cfc2c086c47342fd8f5cb09f565979333066473 13-Oct-2015 Mathieu Chartier <mathieuc@google.com> Avoid visiting find array class cache as roots

If we visit the find array class cache as roots it will prevent
unloading for any array classes in the cache. This is not ideal
since it may take a long time for the entries to get replaced.

Also added a missed exception check in getDeclaredClasses.

Bug: 22720414

Change-Id: Id34557fd034b3e3967ef629301ee251931937849
72f9075e92cfc4632d6c50f282a0f6319b718882 01-Oct-2015 Alex Light <allight@google.com> Move getPublicFieldRecursive to native JNI

Benchmark: libcore/benchmarks/src/benchmarks/regression/ReflectionBenchmark.java

Previous benchmarks:
Class_getField 814.26 ns; σ=6.44 ns @ 3 trials
GetInterfaceStaticField 1552.28 ns; σ=38.22 ns @ 10 trials
GetSuperClassField 939.85 ns; σ=2.94 ns @ 3 trials

New benchmarks:
Class_getField 735.97 ns; σ=0.98 ns @ 3 trials
GetInterfaceStaticField 1178.98 ns; σ=6.14 ns @ 3 trials
GetSuperClassField 853.76 ns; σ=16.86 ns @ 10 trials

Bug: 24209213

Change-Id: I08073cb36b007ac33af010dab917a6f1e51107c0
2a5892f9ebcd4b7bd7343db50e578bd24b8e55a6 01-Sep-2015 Jeff Hao <jeffhao@google.com> Move more Class annotations to native.

Art side of this change. There is also a corresponding Libcore change.

Seeing speedup in AnnotatedElementBenchmark.
GetDeclaredClasses 21.61x
GetDeclaringClass 108.73x
GetEnclosingClass 87.81x
GetEnclosingConstructor 23.35x
GetEnclosingMethod 22.71x
GetModifiers 152.47x
GetSimpleName 106.11x
IsAnonymousClass 91.28x
IsLocalClass 51.95x

Change-Id: I2b7f7eb7785fc20671fd7c338ffa9c7048a44a48
13e748b28c5f2bd1e83674d2ca899ff61ae5c0a1 25-Aug-2015 Jeff Hao <jeffhao@google.com> Revert "Revert "Move annotations to native.""

This reverts commit 7db6dd79a24570448ae737ee1946b00396696cac.

Adds check if field's declaring class is proxy.
Bug: 23508574

Change-Id: Ie829f1526e74427711e818b56d1588d92946cbf6
7db6dd79a24570448ae737ee1946b00396696cac 25-Aug-2015 Roland Levillain <rpl@google.com> Revert "Move annotations to native."

This reverts commit 0042c6d49b8488c78f0b937063e316e8d6244439.

Reverting this change (as well as the companion CL
https://android-review.googlesource.com/#/c/167510/ in
platform/libcore) as they make libcore test
libcore.java.lang.reflect.ProxyTest#test24846 fail.

Change-Id: Ie0676cabb128277c7df5dab7bde17aefd3b2c09c
0042c6d49b8488c78f0b937063e316e8d6244439 30-Jul-2015 Jeff Hao <jeffhao@google.com> Move annotations to native.

Art side of this change. There is also a corresponding Libcore change.

Seeing ~2-3x speedup over dalvik KK MR1 in AnnotatedElementBenchmark.
Benchmark Speedup of Art AOSP to Dalvik KK MR1
GetAllReturnsLargeAnnotation 2.99
GetAllReturnsMarkerAnnotation 2.20
GetAllReturnsNoAnnotation 2.43
GetAllReturnsSmallAnnotation 2.52
GetAllReturnsThreeAnnotations 2.87
GetAnnotationsOnSubclass 2.42
GetDeclaredAnnotationsOnSubclass 2.49
GetFieldAnnotation 2.68
GetFieldAnnotations 2.60
GetMethodAnnotation 2.66
GetMethodAnnotations 2.61
GetParameterAnnotations 2.52
GetTypeAnnotation 2.56
GetTypeAnnotations 2.17
IsFieldAnnotationPresent 3.26
IsMethodAnnotationPresent 4.99
IsTypeAnnotationPresent 1.34

Change-Id: Ibdbb6d23b17eaab6e83c8774b1bb9401e8227941
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
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
e71eb1d7cdc59127b6fcf101230376ce7c892a89 18-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix some java_lang_Class related moving GC bugs

There was some missing handles around mirror::Class*.

(cherry picked from commit 05b7226787f1470ad93f6f632fed60f70bc8631e

Bug: 21898408
Change-Id: Icb754074dfb469473101d20d6873a5bc3274abc5
05b7226787f1470ad93f6f632fed60f70bc8631e 18-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix some java_lang_Class related moving GC bugs

There was some missing handles around mirror::Class*.

Bug: 21898408
Change-Id: Icb754074dfb469473101d20d6873a5bc3274abc5
281e5002fe818ce75e6ca7b7f9bdffcd2a43231a 12-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix compaction bug in Class_getDeclaredMethodsUnchecked

Added handle to fix the bug.

(cherry picked from commit b89a8c66e360575d2dc1ec1229235735c56968ff)

Bug: 21638351
Change-Id: I1c3abea33aa825d3a28c1fc5cb415508686ad93e
b89a8c66e360575d2dc1ec1229235735c56968ff 12-Jun-2015 Mathieu Chartier <mathieuc@google.com> Fix compaction bug in Class_getDeclaredMethodsUnchecked

Added handle to fix the bug.

Bug: 21638351
Change-Id: I1c3abea33aa825d3a28c1fc5cb415508686ad93e
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
4e067787fff6cb6ce027d003c5ffe5dee4cb0d92 13-May-2015 Mathieu Chartier <mathieuc@google.com> Also print class for NoSuchFieldException

Example message:
Caused by: java.lang.NoSuchFieldException: No field value in class Ljava/lang/String;

Added test.

(cherry picked from commit 3beb245da9392818e3154d47593f82cf0ef69aac)

Bug: 20881251
Bug: 21027454

Change-Id: I4043cbf26c3077952b6c151da0d0edd980da26b1
3beb245da9392818e3154d47593f82cf0ef69aac 13-May-2015 Mathieu Chartier <mathieuc@google.com> Also print class for NoSuchFieldException

Example message:
Caused by: java.lang.NoSuchFieldException: No field value in class Ljava/lang/String;

Added test.

Bug: 20881251

Change-Id: I4043cbf26c3077952b6c151da0d0edd980da26b1
69bdcb29fdbd8266374e3793cb4e28dcc5daf0f9 28-Apr-2015 Jeff Hao <jeffhao@google.com> Fix java_lang_Class newInstance for strings; also quick entrypoints.

Change-Id: I35fd23c5a9051e1ffda0ecc2cbafb5d318c7b5e6
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
f36cb5f65cb150151aa40b23937e2b0ad75cc546 25-Apr-2015 Mathieu Chartier <mathieuc@google.com> Move Class.newInstance to native

Avoids 1 allocation and several JNI transitions.

Before:
Class_classNewInstance: 4462.39 ns; σ=39.42 ns @ 3 trials

After:
Class_classNewInstance: 1073.39 ns; σ=24.14 ns @ 10 trials

Bug: 20269715
Bug: 20566996
Change-Id: Icd52155ce79a978a4d869855bfdfd7735abd8187
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
fc58af45e342ba9e18bbdf597f205a58ec731658 17-Apr-2015 Mathieu Chartier <mathieuc@google.com> Add AbstractMethod, Constructor, Method

Moves functionality to ART from libcore. Precursor to moving
ArtMethods to native. Mostly performance improvements.

N5 perf before (irrelevant results removed):
Class_getConstructor 962.87 ===========
Class_getDeclaredMethod 2394.37 ============================
Class_getMethod 2509.20 ==============================
Class_newInstance 1999.81 =======================
Method_invokeI 1439.02 =================
Method_invokePreBoxedI 1415.82 ================
Method_invokeStaticI 1456.24 =================
Method_invokeStaticPreBoxedI 1427.32 =================
Method_invokeStaticV 814.47 =========
Method_invokeV 816.56 =========
After:
benchmark ns linear runtime
Class_getConstructor 1302.04 ================
Class_getDeclaredMethod 1459.01 ==================
Class_getMethod 1560.40 ===================
Class_newInstance 2029.94 =========================
Method_invokeI 1312.89 ================
Method_invokePreBoxedI 1255.01 ===============
Method_invokeStaticI 1289.13 ===============
Method_invokeStaticPreBoxedI 1196.52 ==============
Method_invokeStaticV 790.82 =========
Method_invokeV 791.73 =========

Performance improvements are more than just fixing regressions introduced
in: http://android-review.googlesource.com/#/c/146069/

Bug: 19264997

Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
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
c136312832d4be25db2ecc5673967d71d0ad4b9c 09-Apr-2015 Vladimir Marko <vmarko@google.com> Avoid using dex cache array pointers in libart.

In preparation for making dex cache arrays native, avoid
using them in Java code.

This causes a performance regression for our reflection
benchmarks. Class_getDeclaredMethod and Class_getMethod
take an up to 30% hit, measured using the Quick compiler.
We accept this hit at this stage and we will tune the
performance after we're done with the larger effort.

Companion libcore/ change:
https://android-review.googlesource.com/146069

Bug: 20134538
Change-Id: Ibbef3b50043a1311cd40723ed42e1f1c609b8fc1
02d2f290380c6aeff5f5a089ee38fa5d55e46130 03-Apr-2015 Hiroshi Yamauchi <yamauchi@google.com> Fix the read barrier builds.

A check failure (!UseJit() in ArtMethod::Invoke()) in forced interpret
only mode in the eng build with JIT enabled by default on target.

A build failure (inl header file issues) in the USE_BAKER_READ_BARRIER
build.

Change-Id: Ib13632b10864ad8b4691b66971c0ab5d2ae1e675
ca239af73e512df5eeb80fe6c09c2ca614649e06 30-Mar-2015 Mathieu Chartier <mathieuc@google.com> Fix some reflection errors

Fixed incorrectly using 2nd frame instead of 1st in VerifyAccess.
Added regression test to ART. Fixed broken setShort,
getDeclaredFieldInternal.

Change-Id: I4b21d52d998cb768fe9503b8bccec506b7b972e5
daaf3265806eb2eadb2e03302bd68022fab5ca28 24-Mar-2015 Mathieu Chartier <mathieuc@google.com> Add AccessibleObject and Field to mirror

Main motivation is to remove all the functionality / field access on
java side to ArtField. Also comes with some reflection speedups /
slowdowns.

Summary results:
getDeclaredField/getField are slower mostly due to JNI overhead.
However, there is a large speedup in getInt, setInt,
GetInstanceField, and GetStaticField.

Before timings (N5 --compiler-filter=everything):

benchmark ns linear runtime
Class_getDeclaredField 782.86 ===
Class_getField 832.77 ===
Field_getInt 160.17 =
Field_setInt 195.88 =
GetInstanceField 3214.38 ==============
GetStaticField 6809.49 ==============================

After:
Class_getDeclaredField 1068.15 ============
Class_getField 1180.00 ==============
Field_getInt 121.85 =
Field_setInt 139.98 =
GetInstanceField 1986.15 =======================
GetStaticField 2523.63 ==============================

Bug: 19264997

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

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

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

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

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

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

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

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

Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
c114b5fbc91e6d19ef430d9bc3468386ca61b324 21-Jul-2014 Ian Rogers <irogers@google.com> Fix erroneous behaviors with OOME present.

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

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

Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
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
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
eb8167a4f4d27fce0530f6724ab8032610cd146b 08-May-2014 Mathieu Chartier <mathieuc@google.com> Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
53b8b09fc80329539585dcf43657bc5f4ecefdff 14-Mar-2014 Ian Rogers <irogers@google.com> Refactor reflective method invocation.

Move invocation code out of JNI internal into reflection, including ArgArray
code. Make reflective invocation use the ArgArray to build arguments rather
than allocating a jvalue[] and unboxing arguments into that.
Move reflection part of jni_internal_test into reflection_test.
Make greater use of fast JNI.

Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
9837939678bb5dcba178e5fb00ed59b5d14c8d9b 25-Feb-2014 Ian Rogers <irogers@google.com> Avoid std::string allocations for finding an array class.

Introduce ClassLinker::FindArrayClass which performs an array class lookup
given the element/component class. This has a 16 element cache of recently
looked up arrays.
Pass the current thread to ClassLinker Find .. Class routines to avoid calls
to Thread::Current().
Avoid some uses of FindClass in the debugger where WellKnownClasses is a
faster and more compacting GC friendly alternative.

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

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

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

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

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

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

Bug: 11771255
Bug: 8499494
Bug: 10802951

Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
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
1eb512d33f94d1dd7ea38263307ba0f7a0dfa653 19-Oct-2013 Ian Rogers <irogers@google.com> Fast JNI support.

Use a modifier to signal a native method is a fast JNI method. If the
modifier is set then don't perform runnable transitions.

Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
ee39a10e45a6a0880e8b829525c40d6055818560 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

(cherry-picked from 8b2c0b9abc3f520495f4387ea040132ba85cae69)
Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
8b2c0b9abc3f520495f4387ea040132ba85cae69 19-Sep-2013 Ian Rogers <irogers@google.com> Use class def index from java.lang.Class.

Bug: 10244719
Depends on:
https://googleplex-android-review.git.corp.google.com/362363
This removes the computation of the dex file index, when necessary this is
computed by searching the dex file. Its only necessary in
dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the
latter not showing up significantly in profiling with this change.

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