History log of /art/compiler/dex/quick/dex_file_method_inliner.cc
Revision Date Author Comments
3c94f0945ed596ceee39783fa075f013b65e80a1 21-Mar-2016 Nicolas Geoffray <ngeoffray@google.com> Remove Quick from tree.

So long, old friend.

Change-Id: I0241c798a34b92bf994fed83888da67d6e7f1891
f969a209c30e3af636342d2fb7851d82a2529bf7 09-Mar-2016 Roland Levillain <rpl@google.com> Fix and enable java.lang.StringFactory intrinsics.

The following intrinsics were not considered by the
intrinsics recognizer:
- StringNewStringFromBytes
- StringNewStringFromChars
- StringNewStringFromString
This CL enables them and add tests for them.

This CL also:
- Fixes the locations of the ARM64 & MIPS64
StringNewStringFromString intrinsics.
- Fixes the definitions of the FOUR_ARG_DOWNCALL macros on
ARM and x86, which are used to implement the
art_quick_alloc_string_from_bytes* runtime entry points.
- Fixes PC info (stack maps) recording in the
StringNewStringFromBytes, StringNewStringFromChars and
StringNewStringFromString ARM, ARM64 & MIPS64 intrinsics.

Bug: 27425743
Change-Id: I38c00d3f0b2e6b64f7d3fe9146743493bef9e45c
0e54c0160c84894696c05af6cad9eae3690f9496 04-Mar-2016 Aart Bik <ajcbik@google.com> Unsafe: Recognize intrinsics for 1.8 java.util.concurrent
With unit test.

Rationale:
Recognizing the 1.8 methods as intrinsics is the first step
towards providing efficient implementation on all architectures.
Where not implemented (everywhere for now), the methods fall back
to the JNI native or reference implementation.

NOTE: needs iam's CL first!

bug=26264765

Change-Id: Ife65e81689821a16cbcdd2bb2d35641c6de6aeb6
2a6aad9d388bd29bff04aeec3eb9429d436d1873 25-Feb-2016 Aart Bik <ajcbik@google.com> Implement fp to bits methods as intrinsics.

Rationale:
Better optimization, better performance.

Results on libcore benchmark:

Most gain is from moving the invariant call out of the loop
after we detect everything is a side-effect free intrinsic.
But generated code in general case is much cleaner too.

Before:
timeFloatToIntBits() in 181 ms.
timeFloatToRawIntBits() in 35 ms.
timeDoubleToLongBits() in 208 ms.
timeDoubleToRawLongBits() in 35 ms.

After:
timeFloatToIntBits() in 36 ms.
timeFloatToRawIntBits() in 35 ms.
timeDoubleToLongBits() in 35 ms.
timeDoubleToRawLongBits() in 34 ms.

bug=11548336

Change-Id: I6e001bd3708e800bd75a82b8950fb3a0fc01766e
f8b3b8bc37fb04d8ae113ae6bfcf4de2f5a700d4 04-Feb-2016 Vladimir Marko <vmarko@google.com> Try to substitute constructor chains for IPUTs.

Match a constructor chain where each constructor either
forwards some or all of its arguments to the next (i.e.
superclass constructor or a constructor in the same class)
and may pass extra zeros (of any type, including null),
followed by any number of IPUTs on "this", storing either
arguments or zeros, until we reach the contructor of
java.lang.Object.

When collecting IPUTs from the constructor chain, remove
any IPUTs that store the same field as an IPUT that comes
later. This is safe in this case even if those IPUTs store
volatile fields because the uninitialized object reference
wasn't allowed to escape yet. Also remove any IPUTs that
store zero values as the allocated object is already zero
initialized.

(cherry picked from commit 354efa6cdf558b2331e8fec539893fa51763806e)

Change-Id: I691e3b82e550e7a3272ce6a81647c7fcd02c01b1
354efa6cdf558b2331e8fec539893fa51763806e 04-Feb-2016 Vladimir Marko <vmarko@google.com> Try to substitute constructor chains for IPUTs.

Match a constructor chain where each constructor either
forwards some or all of its arguments to the next (i.e.
superclass constructor or a constructor in the same class)
and may pass extra zeros (of any type, including null),
followed by any number of IPUTs on "this", storing either
arguments or zeros, until we reach the contructor of
java.lang.Object.

When collecting IPUTs from the constructor chain, remove
any IPUTs that store the same field as an IPUT that comes
later. This is safe in this case even if those IPUTs store
volatile fields because the uninitialized object reference
wasn't allowed to escape yet. Also remove any IPUTs that
store zero values as the allocated object is already zero
initialized.

Change-Id: If93022310bf04fe38ee741665ac4a65d4c2bb25f
59c9454b92c2096a30a2bbdffb64edf33dbdd916 25-Jan-2016 Aart Bik <ajcbik@google.com> Recognize common utilities as intrinsics.

Rationale:
Recognizing these method calls as intrinsics already has
major advantages (compiler knows about no-side-effects/no-throw
properties). Next step is, of course, to implement these
with native instructions on each architecture.

Change-Id: I06fd12973238caec00d67b31b195d7f8807a538e
3f67e692860d281858485d48a4f1f81b907f1444 15-Jan-2016 Aart Bik <ajcbik@google.com> Implemented BitCount as an intrinsic. With unit test.

Rationale:
Recognizing this important operation as an intrinsic has
various advantages:
(1) having the no-side-effects/no-throw allows for
much more GVN/LICM/BCE.
(2) Some architectures, like x86_64, provide direct
support for this operation.

Performance improvements on X86_64:
CheckersEvalBench (32-bit bitboard): 27,210KNS -> 36,798KNS = + 35%
ReversiEvalBench (64-bit bitboard): 52,562KNS -> 89,086KNS = + 69%

Change-Id: I65d549b0469b7909b12c6611cdc34a8640a5751f
91d65e024846717fce3572106cffe9b957b8902c 19-Jan-2016 Roland Levillain <rpl@google.com> Fix various typos in ART's comments and string literals.

Change-Id: I85d628055b1a61647a77fef730c9631c234e22a2
dcdc85bbd569f0ee66c331b4219c19304a616214 04-Dec-2015 Jeff Hao <jeffhao@google.com> Dex2oat support for multiple oat file and image file outputs.

Multiple changes to dex2oat and the runtime to support a --multi-image
option. This generates a separate oat file and image file output for
each dex file input.

Change-Id: Ie1d6f0b8afa8aed5790065b8c2eb177990c60129
a4f1220c1518074db18ca1044e9201492975750b 06-Aug-2015 Mark Mendell <mark.p.mendell@intel.com> Optimizing: Add direct calls to math intrinsics

Support the double forms of:
cos, sin, acos, asin, atan, atan2, cbrt, cosh, exp, expm1,
hypot, log, log10, nextAfter, sinh, tan, tanh

Add these entries to the vector addressed off the thread pointer. Call
the libc routines directly, which means that we have to implement the
native ABI, not the ART one. For x86_64, that includes saving XMM12-15
as the native ABI considers them caller-save, while the ART ABI
considers them callee-save. We save them by marking them as used by the
call to the math function. For x86, this is not an issue, as all the XMM
registers are caller-save.

Other architectures will call Java as before until they are ready to
implement the new intrinsics.

Bump the OAT version since we are incompatible with old boot.oat files.

Change-Id: Ic6332c3555c09393a17d1ad4daf62932488722fb
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
3c183cec1fb337ed0247ba500c6949063072f565 31-Jul-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fix asm for String#indexOf/compareTo intrinsics

Fixed code for arm arch, it's still broken
on remaining architectures (will be done soon in
following CLs).

OpenJdk string lacks offset and length fields and requires
user to fetch the length from array object.

Change-Id: I682911e4ee72d9597e8a9735ac414c837569eb8e
13ceeb2b729646d2a6061b70ce91c3cab16f3d6b 30-Jul-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Re-add intrinsics for String#charAt/isEmpty/length

OpenJdk String lacks offset and length fields, intrinsics
had to be modified to set the offset to 0 and pull length
from the value array.

Change-Id: I1375b84ab4d2851af6743adf5b2bc76a982b68ee
44095a15349445e87942a728a825bd32ea11be1d 27-Apr-2015 Piotr Jastrzebski <haaawk@google.com> String: account for the hash32 field.

Also temporarily disable intrinsics for now.

Change-Id: I8158962efeba6e4ccb39cc147bff782aace3ffbc
9507fa2c9545156747a5eb248bc1af3159bfd8c8 29-Oct-2015 Mathieu Chartier <mathieuc@google.com> Change a few places to use string version of GetTypeId

GetTypeId is about 20% faster than GetStringId + integer GetTypeID
since it does less binary searches.

Change-Id: I876c4ac89ab206acca217b2287b0197ef2e408c2
ee3cf0731d0ef0787bc2947c8e3ca432b513956b 06-Oct-2015 Nicolas Geoffray <ngeoffray@google.com> Intrinsify System.arraycopy.

Currently on x64, will do the other architectures in
different changes.

Change-Id: I15fbbadb450dd21787809759a8b14b21b1e42624
9ee23f4273efed8d6378f6ad8e63c65e30a17139 23-Jul-2015 Scott Wakeling <scott.wakeling@linaro.org> ARM/ARM64: Intrinsics - numberOfTrailingZeros, rotateLeft, rotateRight

Change-Id: I2a07c279756ee804fb7c129416bdc4a3962e93ed
7da072feb160079734331e994ea52760cb2a3243 13-Aug-2015 agicsaki <agicsaki@google.com> Structure for String.Equals intrinsic

Added structure for implementing String.Equals intrinsics. There is no
functional change at this point- the intrinsic is marked as unimplemented
for all instruction sets and compilers.

Bug: 21481923
Change-Id: Ic2a1e22a113ff6091581126f12e926478c011340
611d3395e9efc0ab8dbfa4a197fa022fbd8c7204 10-Jul-2015 Scott Wakeling <scott.wakeling@linaro.org> ARM/ARM64: Implement numberOfLeadingZeros intrinsic.

Change-Id: I4042fb7a0b75140475dcfca23e8f79d310f5333b
aabdf8ad2e8d3de953dff5c7591e7b3df4d4f60b 03-Aug-2015 Roland Levillain <rpl@google.com> Revert "Optimizing String.Equals as an intrinsic (x86)"

Reverted as it breaks the compilation of boot.{oat,art} on x86 (although this CL may not be the culprit, as the issue seems to come from Optimizing's register allocator).

This reverts commit 8ab7bd6c8b10ad58758c33a1dc9326212bd200e9.

Change-Id: If7c8b6258d1e690f4d2a06bcc82c92563ac6cdef
8ab7bd6c8b10ad58758c33a1dc9326212bd200e9 27-Jul-2015 agicsaki <agicsaki@google.com> Optimizing String.Equals as an intrinsic (x86)

The third implementation of String.Equals. I added an intrinsic
in x86 which is similar to the original java implementation of
String.equals: an instanceof check, null check, length check, and
reference equality check followed by a loop comparing strings
character by character.

Interesting Benchmarking Values:

Optimizing Compiler on Nexus Player
Intrinsic 15-30 Character Strings: 177 ns
Original 15-30 Character Strings: 275 ns
Intrinsic Null Argument: 59 ns
Original Null Argument: 137 ns
Intrinsic 100-1000 Character Strings: 1812 ns
Original 100-1000 Character Strings: 6334 ns

Bug: 21481923
Change-Id: Ia386e19b9dbfe0dac688b20ec93d8f90f67af47e
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
c91df2d6339dd4adf2da582372451df19ce2ff44 23-Apr-2015 Vladimir Marko <vmarko@google.com> Revert "Revert "Quick: Rewrite type inference pass.""

Fix the type of the ArtMethod* SSA register.

Bug: 19419671
This reverts commit 1b717f63847de8762e7f7bdd6708fdfae9d24a67.

Change-Id: Ie4da3c03a0e0334a39a24718f6dc31f9255cfb53
1b717f63847de8762e7f7bdd6708fdfae9d24a67 23-Apr-2015 Andreas Gampe <agampe@google.com> Revert "Quick: Rewrite type inference pass."

Breaks arm64, as the method register is not correctly flagged
as ref and thus 32bit.

Bug: 19419671
This reverts commit e490b01c12d33f3bd5c247b55b47e507cc9c8fab.
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
e490b01c12d33f3bd5c247b55b47e507cc9c8fab 24-Feb-2015 Vladimir Marko <vmarko@google.com> Quick: Rewrite type inference pass.

Use method signatures, field types and types embedded in dex
insns for type inference. Perform the type inference in two
phases, first a simple pass that records all types implied
by individual insns, and then an iterative pass to propagate
those types further via phi, move, if-cc and aget/aput insns.

Bug: 19419671
Change-Id: Id38579d48a44fc5eadd13780afb6d370093056f9
fac10700fd99516e8a14f751fe35553021ce6982 22-Apr-2015 Vladimir Marko <vmarko@google.com> Quick: Remove broken Mir2Lir::LocToRegClass().

Its use in intrinsics has been bogus. In all other instances
it's been used under the assumption that the inferred type
matches the return type of associated calls. However, if the
type inference identifies a type mismatch, the assumption
doesn't hold and there isn't necessarily a valid value that
the function could reasonably return.

Bug: 19918641
Change-Id: I050934e6f9eb00427d0b888ee29ae9eeb509bb3f
87b7c52ac660119b8dea46967974b76c86d0750b 08-Apr-2015 Vladimir Marko <vmarko@google.com> Quick: Clean up temp use counting.

For the boot image on arm64 and x86-64 we're using true
PC-relative addressing, so pc_rel_temp_ is nullptr and
CanUsePcRelDexCacheArrayLoad() returns true, but we're not
actually using the ArtMethod* so fix the AnalyzeMIR() to
take it into account.

Also don't count intrinsic invokes towards ArtMethod* uses.
To avoid repeated method inliner inquiries about whether a
method is intrinsic or special (requiring lock acquisition),
cache that information in MirMethodLoweringInfo. As part of
that cleanup, take quickened invokes into account for
suspend check elimination.

Change-Id: I5b4ec124221c0db1314c8e72675976c110ebe7ca
71ef04481d1bc1b8381f8e997a0f0f9988419e34 26-Feb-2015 Mathieu Chartier <mathieuc@google.com> Change already inline error to warning

There is a race condition in the JIT where the JIT and another
running thread can both verify the same method at the same time.
This causes the inline method to be added twice and the LOG(ERROR)
was causing occasional test failures.

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

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

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

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

Bug: 17950037
This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.

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

Currently disabled by default unless -Xjit is passed in.

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

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

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

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

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

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

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

Bug: 17950037

Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
0b9203e7996ee1856f620f95d95d8a273c43a3df 23-Jan-2015 Andreas Gampe <agampe@google.com> ART: Some Quick cleanup

Make several fields const in CompilationUnit. May benefit some Mir2Lir
code that repeats tests, and in general immutability is good.

Remove compiler_internals.h and refactor some other headers to reduce
overly broad imports (and thus forced recompiles on changes).

Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
71fb52fee246b7d511f520febbd73dc7a9bbca79 30-Dec-2014 Andreas Gampe <agampe@google.com> ART: Optimizing compiler intrinsics

Add intrinsics infrastructure to the optimizing compiler.

Add almost all intrinsics supported by Quick to the x86-64 backend.
Further intrinsics require more assembler support.

Change-Id: I48de9b44c82886bb298d16e74e12a9506b8e8807
321b987ef037c44c0ed4e0e82661c88959a6239f 24-Nov-2014 Vladimir Marko <vmarko@google.com> Further cleanup using dex_instruction_utils.h.

Change-Id: I85aa9e7d744b37ee3d2531c50470cd3fa87dc864
785d2f2116bb57418d81bb55b55a087afee11053 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: Replace COMPILE_ASSERT with static_assert (compiler)

Replace all occurrences of COMPILE_ASSERT in the compiler tree.

Change-Id: Icc40a38c8bdeaaf7305ab3352a838a2cd7e7d840
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
ff0ac4772d489d8780bbb6bb271dc6d5333cca7c 02-Oct-2014 Vladimir Marko <vmarko@google.com> Remove all uses of MIR_INLINED.

They are not needed since
https://android-review.googlesource.com/103763

Change-Id: I1dffe5e219db615be9d9aaceb72ad9bd7c69b58e
4e67841e99e4a206133e7010653ccd132682296a 09-Sep-2014 Mathieu Chartier <mathieuc@google.com> Change Reference.get() intrinsic to Reference.getReferent().

The reference intrinsic was incorrectly inlining
PhantomReference.get(). We now get around this by adding a
layer of indirection. Reference.get() now calls getReferent()
which is intrinsified and inlined.

Requires:
https://android-review.googlesource.com/#/c/107100/

Bug: 17429865

(cherry picked from commit cd48f2d86197d4fe87cc88077bc4af5ba66e5295)

Change-Id: Ie91e70abf43cedf3c707c7bb8a5059e19d2a2577
cd48f2d86197d4fe87cc88077bc4af5ba66e5295 09-Sep-2014 Mathieu Chartier <mathieuc@google.com> Change Reference.get() intrinsic to Reference.getReferent().

The reference intrinsic was incorrectly inlining
PhantomReference.get(). We now get around this by adding a
layer of indirection. Reference.get() now calls getReferent()
which is intrinsified and inlined.

Requires:
https://android-review.googlesource.com/#/c/107100/

Bug: 17429865
Change-Id: Ie91e70abf43cedf3c707c7bb8a5059e19d2a2577
53c913bb71b218714823c8c87a1f92830c336f61 13-Aug-2014 Andreas Gampe <agampe@google.com> ART: Clean up compiler

Clean up the compiler: less extern functions, dis-entangle
compilers, hide some compiler specifics, lower global includes.

Change-Id: Ibaf88d02505d86994d7845cf0075be5041cc8438
7642324bc8a5c839c669aebbb1fba61c05418651 04-Aug-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> ART: Implement kMirOpNullCheck

The semantics of kMirOpNullCheck is to check object for null and
throw exception in that case. However, the implementation for it
is empty. This has been changed and appropriate dataflow have been
added to correctly reflect behavior.

In order to allow testing of implementation, the SpecialMethodInliner
has been updated to get rid of invoke and use this instead. This helps
all optimizations which do not check the MIR_INLINED flag because
when invoke is left in, they believe that invoke will still be done.

Change-Id: I62e425e42bdbc6357246fb949db5f79de73cf358
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
e7f82e2515f47f3c3292281312d7031a34a58ffc 06-Aug-2014 Fred Shih <ffred@google.com> Added support for patching classes from different dex files.

Added support for class patching from different dex files and moved
ScopedObjectAccess from the quick compiler to driver. Slight refactoring
for clarity.

Bug: 16656190
Change-Id: I107fcbce75db42ca61321ea1c5d5f236680a1b3d
2eba1fa7e9e5f91e18ae3778d529520bd2c78d55 31-Jul-2014 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add inlining support for ceil(), floor(), rint(), round()

This patch adds inlining support for the following Math, StrictMath
methods in the ARM64 backend:
* double ceil(double)
* double floor(double)
* double rint(double)
* long round(double)
* int round(float)

Also some cleanup.

Change-Id: I9f5a2f4065b1313649f4b0c4380b8176703c3fe1
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
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
a9b870b73a155ce70c867d5b3f9758fab0b45f07 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Add intrinsic for Reference.get()"

This reverts commit 460503b13bc894828a2d2d47d09e5534b3e91aa1.

Change-Id: Ie63f43049307e02e3b90f4e034abc9ea54ca4e24
d4415e8bd04c4a9367744ff0149597b4f37a0e0a 11-Jul-2014 Christopher Ferris <cferris@google.com> Revert "Revert "Add intrinsic for Reference.get()""

This reverts commit a9b870b73a155ce70c867d5b3f9758fab0b45f07.

Change-Id: Ic2a9b47f2b911bef4b764d10bc33cf000e4b4211
9e82bd3f0ce9e5f5777bea2f752ff3e251d32f9f 11-Jul-2014 Sebastien Hertz <shertz@google.com> Revert "Revert "Revert "Add intrinsic for Reference.get()"""

This reverts commit d4415e8bd04c4a9367744ff0149597b4f37a0e0a.

Change-Id: I34553ccbdcfea35c7742d21be2a74dc7085ab2a0
460503b13bc894828a2d2d47d09e5534b3e91aa1 18-Jun-2014 Fred Shih <ffred@google.com> Add intrinsic for Reference.get()

Added an intrinsic function for Reference.get(). Return immediately
without going through JNI if the slow path is not currently in use.
Otherwise, branch off to the the existing JNI function.

Approximately 47x speedup for cases where slow path is not enabled.

Change-Id: I13ad65a356fe4e104d8d83980694dc2740d7d039
2ab40eb3c23559205ac7b9b039bd749458e8a761 02-Jun-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: Add Invokes to DecodedInstruction

Add a method Invokes to test for the kInvoke flag.
Also moved IsPseudoMirOp to DecodedInstruction to use it for the various
querry methods.

Change-Id: I59a2056b7b802b8393fa2b0d977304d252b38c89
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
70c4f06f9965cdb9319a2c85f65acda20086d765 25-Jun-2014 DaniilSokolov <daniil.y.sokolov@intel.com> ART: Intrinsic implementation for java.lang.System.arraycopy.

Implements intrinsic for java.lang.System.arraycopy(char[], int, char[], int, int) -
this method is internal to android class libraries and used in such classes as StringBuffer and
StringBuilder. It is not possible to call it from application code. The intrinsic for
this method is implemented as inline method (assembly code is generated manually).

The intrinsic is x86 32 bit only.

Change-Id: Id1b1e0a20d5f6d5f5ebfe1fdc2447b6d8a515432
Signed-off-by: Daniil Sokolov <daniil.y.sokolov@intel.com>
460f4ef18761ad25f384172e45dff2ad0b60b7aa 08-Jul-2014 Vladimir Marko <vmarko@google.com> Add kIntrinsicIsStatic flag for System.arraycopy().

Change-Id: I40ffb07e62474f418eabb7361f129c633022666c
9c1bd6b8744920b62afcb08571ffcfba055c73a0 08-Jul-2014 Vladimir Marko <vmarko@google.com> Fix style issue.

Change-Id: Ifc73dd4331d91be8c6c5eed2159ec1733fa84995
724c0fe2b39578eafac027e5925f27e95d40e3ba 03-Jul-2014 Vladimir Marko <vmarko@google.com> Check invoke type for intrinsic method invokes.

Bug: 16017877
Change-Id: I931c0b19b500a042bc9235aa18212c4ab5240745
2aaed94965c2d483598660db11a1e7d608682516 08-Jul-2014 Vladimir Marko <vmarko@google.com> Fix a compile assert name with inverted meaning.

Change-Id: I50cc9a8b88c19e1ce7bc5b34cc4b7d650b2f052d
23abec955e2e733999a1e2c30e4e384e46e5dde4 02-Jul-2014 Serban Constantinescu <serban.constantinescu@arm.com> AArch64: Add few more inline functions

This patch adds inlining support for the following functions:
* Math.max/min(long, long)
* Math.max/min(float, float)
* Math.max/min(double, double)
* Integer.reverse(int)
* Long.reverse(long)

Change-Id: Ia2b1619fd052358b3a0d23e5fcbfdb823d2029b9
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
7071c8d5885175a746723a3b38a347855965be08 05-Mar-2014 Yixin Shou <yixin.shou@intel.com> Add x86 inlined abs method for float/double

Add the optimized implementation of inlined abs method for
float/double for X86 side.

Change-Id: I2f367542f321d88a976129f9f7156fd3c2965c8a
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
4c115b85cc48f4dfc8fc2b0484ddfeb29f02d658 17-Jun-2014 Vladimir Marko <vmarko@google.com> Revert "Add x86 inlined abs method for float/double"

This reverts commit e88b89ad1d1a583daf205c7a387ba13f549f95f1.

Change-Id: I2ba21b7442ba3696482d45001e6bd32e8baf9d1f
e88b89ad1d1a583daf205c7a387ba13f549f95f1 05-Mar-2014 Yixin Shou <yixin.shou@intel.com> Add x86 inlined abs method for float/double

Add the optimized implementation of inlined abs method for
float/double for X86 side.

Change-Id: I4e095644a90524354040174954c1e127c7bb4ee2
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
35ba7f3a78d38885ec54e61ed060d2771eeceea7 31-May-2014 buzbee <buzbee@google.com> Quick compiler: fix array overrun.

MIRGraph::InlineCalls() was using the MIR opcode to recover
Dalvik instruction flags - something that is only valid for
Dalvik opcodes and not the set of extended MIR opcodes.

This is probably the 3rd or 4th time we've had a bug using
the MIR opcode in situations that are only valid for the Dalvik
opcode subset. I took the opportunity to scan the code for
other cases of this (didn't find any), and did some cleanup while
I was in the neighborhood.

We should probably rework the DalvikOpcode/MirOpcode model whenver we
get around to removing DalvikInstruction from MIR.

Internal bug b/15352667: out-of-bound access in mir_optimization.cc

Change-Id: I75f06780468880892151e3cdd313e14bfbbaa489
3aa57730e2aec451bb836918d936c6862598d8d6 17-Apr-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: MIR, SSARepresentation, and BasicBlock Additional API

Adding the API calls to the MIR structure to help with higher level code.
Some code has been added to BasicBlock as well for the removal.
Some code has also been added to SSARepresentation.
A constructor has been added to DecodedInstruction.

Change-Id: Ie65948d53d83fd8250545c94c88b442a68d702c7
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
ef562fdef7e0071cae11e07a9e53fb152d0934b8 21-May-2014 buzbee <buzbee@google.com> Quick compiler: free up space in MIR.

The width field in MIR isn't especially useful - it could always
be recalculated from the Dalvik instruction. This CL eliminates
it to allow the 16 bits it occupied to be used for the ID of the
parent BasicBlock.

Change-Id: I75ab8562ca217f0f819ecfc417014dee74bc587e
695d13a82d6dd801aaa57a22a9d4b3f6db0d0fdb 19-Apr-2014 buzbee <buzbee@google.com> Update load/store utilities for 64-bit backends

This CL replaces the typical use of LoadWord/StoreWord
utilities (which, in practice, were 32-bit load/store) in
favor of a new set that make the size explicit. We now have:

LoadWordDisp/StoreWordDisp:
32 or 64 depending on target. Load or store the natural
word size. Expect this to be used infrequently - generally
when we know we're dealing with a native pointer or flushed
register not holding a Dalvik value (Dalvik values will flush
to home location sizes based on Dalvik, rather than the target).

Load32Disp/Store32Disp:
Load or store 32 bits, regardless of target.

Load64Disp/Store64Disp:
Load or store 64 bits, regardless of target.

LoadRefDisp:
Load a 32-bit compressed reference, and expand it to the
natural word size in the target register.

StoreRefDisp:
Compress a reference held in a register of the natural word
size and store it as a 32-bit compressed reference.

Change-Id: I50fcbc8684476abd9527777ee7c152c61ba41c6f
c8f60a69a9f2420fc1ecafec612a667be8dcd547 02-Apr-2014 Vladimir Marko <vmarko@google.com> Inlining synthetic accessors.

Bug: 11549140
Change-Id: I0d6a38c51887f55563414c240ac42ee64bdb5426
e1fced1d1805caec04b6e97d2b01a4977c6785c6 04-Apr-2014 Vladimir Marko <vmarko@google.com> Inlining setters that return one of their arguments.

Useful for builder classes and synthetic setters. The latter
are not inlined yet since they are static methods, i.e. they
don't use "this" as the object for IPUT.

Change-Id: I3d34156c3629b837a0a95ccc34a8aae3f4a636d5
73ed718e7b08d17fd2e4af9bceb5e74ac46db676 05-Apr-2014 Mathieu Chartier <mathieuc@google.com> Revert "Inlining setters that return one of their arguments."

Bug: 13817614

This reverts commit 8e40c3e662d852da87b6bcfe79355f96ab9e91c7.

Change-Id: Ia7ed2d933514781150b2e0b9855244e383c60187
389e11db6ef350b806f7a3f0d7b7df23b0ab6e0c 05-Apr-2014 Mathieu Chartier <mathieuc@google.com> Revert "Inlining synthetic accessors."

This reverts commit 505ebb0e7b42e7facc8354515b06333ee8b84b10.
505ebb0e7b42e7facc8354515b06333ee8b84b10 02-Apr-2014 Vladimir Marko <vmarko@google.com> Inlining synthetic accessors.

Bug: 11549140
Change-Id: Ie0034a6840b1beaa3df92f26bf9d315119c81e34
8e40c3e662d852da87b6bcfe79355f96ab9e91c7 04-Apr-2014 Vladimir Marko <vmarko@google.com> Inlining setters that return one of their arguments.

Useful for builder classes and synthetic setters. The latter
are not inlined yet since they are static methods, i.e. they
don't use "this" as the object for IPUT.

Change-Id: I946cf570195be83ecec5fb32851bcaefad45f8a5
b3e527b2a9ee28ecaba2045f4415b00c8b395039 04-Apr-2014 Vladimir Marko <vmarko@google.com> Clean up special method inlining.

Mark inlined getter/setter INVOKEs as NOP to allow implicit
null checks (SIGSEGV-based) rather than the explicit checks
in GenInvoke().

Avoid inlining wide setter and returning wide argument if
the wide source is not in consecutive dalvik registers in
INVOKE. This is valid dalvik bytecode and we should treat it
correctly even if we're currently unaware of any tools that
would generate such INVOKEs.

Remove bogus MIR_INLINED checks from LVN.

Change-Id: I7e75a832fcf9bd0550e21b1c8b3813c6166197dd
cdacac4a8196bdc620185079ec9e886329606f3d 13-Mar-2014 Jean Christophe Beyler <jean.christophe.beyler@intel.com> ART: API changes

- Moved AppendMIR to BasicBlock
- Moved PrependMIR to BasicBlock
- Moved InsertMIRAfter to BasicBlock
- Moved GetNextUnconditionalMir to BasicBlock

Change-Id: Id261434e9f7d5d93f1bce0c87c9276a20077c483
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
9820b7c1dc70e75ad405b9e6e63578fa9fe94e94 02-Jan-2014 Vladimir Marko <vmarko@google.com> Early inlining of simple methods.

Inlining "special" methods: empty methods, methods returning
constants or their arguments, simple getters and setters.

Bug: 8164439
Change-Id: I8c7fa9c14351fbb2470000b378a22974daaef236
e3e0260c23d8999b9433715ac7ee5296ee2fd633 12-Mar-2014 Vladimir Marko <vmarko@google.com> Move inline method detection to runtime.

The debugger needs this for selective deoptimization.

Change-Id: I8100000449b56e619288fb05d41ea6f02b53b334
719d1a33f6569864f529e5a3fff59e7bca97aad0 06-Mar-2014 Ian Rogers <irogers@google.com> Enable annotalysis on clang ART builds.

Fix clang build errors aswell as restructure locking/mutex code for correct
thread safety analysis support.
Reorder make dependencies so that host builds build first as they should
provide better compilation errors than target.
Remove host's use of -fno-omit-frame-pointer as it has no value with correct
use of CFI, which we should have.

Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
84c072c348006d87a370ad6e746e2d976cbe62f2 17-Feb-2014 Vladimir Marko <vmarko@google.com> Expose inline method identification for debugger.

Also, record only those getter/setter functions which
we really intend to inline in the short term (and which
actually have a special implementation emitted).

Change-Id: Icb8d71707a65cb6fabae5bc9118e5f3eaf7b63dd
3bc01748ef1c3e43361bdf520947a9d656658bf8 06-Feb-2014 Razvan A Lupusoru <razvan.a.lupusoru@intel.com> GenSpecialCase support for x86

Moved GenSpecialCase from being ARM specific to common code to allow
it to be used by x86 quick as well.

Change-Id: I728733e8f4c4da99af6091ef77e5c76ae0fee850
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
2bc47809febcf36369dd40877b8226318642b428 10-Feb-2014 Vladimir Marko <vmarko@google.com> Revert "Revert "Check FastInstance() early for special getters and setters.""

This reverts commit 632e458dc267fadfb8120be3ab02701e09e64875.

Change-Id: I5098c41ee84fbbb39397133a7ecfd367fecebe42
632e458dc267fadfb8120be3ab02701e09e64875 08-Feb-2014 Ian Rogers <irogers@google.com> Revert "Check FastInstance() early for special getters and setters."

This reverts commit 5dc5727261e87ba8a418e2d0e970c75f67e4ab79.

Change-Id: I3299c8ca5c3ce3f2de994bab61ea16a734f1de33
dbb17e378b538133750e56375bbdbb217db7b248 07-Feb-2014 Yixin Shou <yixin.shou@intel.com> Added inlined abs method with float and double type

This patch added the implementation for inlining java.lang.Math.abs()
method with float and double type.

Change-Id: Ic99471b4ab4176e4a0153bef383bb49944fb636f
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
5dc5727261e87ba8a418e2d0e970c75f67e4ab79 05-Feb-2014 Vladimir Marko <vmarko@google.com> Check FastInstance() early for special getters and setters.

Perform the FastInstance() check for getters and setters
when they are detected by the inliner. This will help avoid
the FastInstance() check for inlining.

We also record the field offset and whether the field is
volatile and whether the method is static for use when
inlining or generating the special accessors.

Change-Id: I3f832fc9ae263883b8a984be89a3b7793398b55a
dce164adfbf679d7ec9c9dc778fa3fb596011740 03-Jan-2014 Ian Rogers <irogers@google.com> Avoid inliner spam wrt String.length.

Also, remove a use of std::map for our preferred SafeMap and be more explicit
with types.

Change-Id: I7b9a4bb1f73c22490fe416503e050671e7c99fe0
778127aed722b9702a382f1276c0f05447c654be 18-Dec-2013 Vladimir Marko <vmarko@google.com> Fix build - style issues.

Change-Id: I40540dac2a51ef326e642116b5c64fb581c849f2
5816ed48bc339c983b40dc493e96b97821ce7966 27-Nov-2013 Vladimir Marko <vmarko@google.com> Detect special methods at the end of verification.

This moves special method handling to method inliner
and prepares for eventual inlining of these methods.

Change-Id: I51c51b940fb7bc714e33135cd61be69467861352
e13717e796d338b08ea66f6a7e3470ca44de707f 20-Nov-2013 Vladimir Marko <vmarko@google.com> Per-DexFile locking for inliner initialization.

And clean up lock and compiler driver naming.

Change-Id: I1562c7f55c4b0174a36007ba6199360da06169ff
45c1165558eb8f9c81843b63ed362079a60c8387 11-Dec-2013 Mark Mendell <mark.p.mendell@intel.com> Define missing static constexpr variables

This will prevent link errors when undefined symbols when compiling at
-O0. Normally, this isn't a problem, but causes failure when compiling
at -O0 to maximize debugability

Change-Id: Iafe187b6b9344fead1bbc73004e376fad821756b
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
867a2b35e67ddcbec089964e8f3cd9a827186e48 10-Dec-2013 Vladimir Marko <vmarko@google.com> Get rid of platform-specific method inliners.

The DexFileToMethodInlinerMap dependency on CompilerDriver
and its instruction set makes it impossible to implement
verification-time checking for methods we want to inline.
Therefore, we get rid of the platform-specific method
inliners and rely on the backend's existing ability to
recognize when it can actually emit an intrinsic function.

Change-Id: I57947db93f13a26c1c794cb3584130321106306f
1c282e2b9a9b432e132b2c332f861cad9feb4a73 21-Nov-2013 Vladimir Marko <vmarko@google.com> Refactor intrinsic CAS, prepare for 64-bit version.

Bug: 11391018
Change-Id: Ic0f740e0cd0eb47f2c915f81be02f52f7721f8a3
ba9ece9c58de90b39c39b29dbdaee54b1654c066 19-Nov-2013 Narayan Kamath <narayan@google.com> Fix inlining for String.indexOf / String.isEmpty.

Before vs After:

Equals URI 1544014.6 ==============================
Equals URI 992997.6 ========================

bug: 11551453

Change-Id: I41045fda59b4c69a209d6b895dc7c2bdd1fc4e89
e4a50ee34695a9d90cf03fbb1e8afd1e434f6ee1 18-Nov-2013 Mathieu Chartier <mathieuc@google.com> Fix build.

cpplint errors.

Change-Id: I11141f6e19b56a3f53d6e52f3013f4d20f33f102
5c96e6b4dc354a7439b211b93462fbe8edea5e57 14-Nov-2013 Vladimir Marko <vmarko@google.com> Rewrite intrinsics detection.

Intrinsic methods should be treated as a special case of
inline methods. They should be detected early and used to
guide other optimizations. This CL rewrites the intrinsics
detection so that it can be moved to any compilation phase.

Change-Id: I4424a6a869bd98b9c478953c9e3bcaf1c6de2b33