summaryrefslogtreecommitdiff
path: root/compiler/dex/quick/quick_compiler.cc
AgeCommit message (Collapse)Author
2016-03-21Remove Quick from tree. Nicolas Geoffray
So long, old friend. Change-Id: I0241c798a34b92bf994fed83888da67d6e7f1891
2016-02-18Remove string init map. Nicolas Geoffray
Partial revert of the String init change. - Make Quick bailout in the presence of String allocation. - Rely on the compiler for knowing when dex registers alias. bug:27173201 Change-Id: I0bf58ba3825c71cef110b53f3a0a6f567cb2ef9a
2016-01-26Enable interface default methods by default. Neil Fuller
This also enables interface static methods. This removes the -Xexperimental:default-methods flag and all places where we explicitly check for its presence. Bug: 24618811 Change-Id: Icd91e377bd6e1a45a1645f810d15de1b0312e31d
2016-01-12Support directly invoking interface default methods Alex Light
With the Java 8 Language one is allowed to directly call default interface methods of interfaces one (directly) implements through the use of the super keyword. We support this behavior through the invoke-super opcode with the target being an interface. We add 3 tests for this behavior. Currently only supports slow-path interpreter. Invoke-super is currently extremely slow. Bug: 24618811 Change-Id: I7e06e17326f7dbae0116bd7dfefca151f0092bd2
2015-12-11Revert "Revert "Enable profiled guided compilation in dex2oat"" Calin Juravle
This reverts commit 2306ae0d412cc53cbf64877e4a8c37292dd907d8. Change-Id: I50640009c2fac88ea703812b76549a0e8a6d7584
2015-12-11Revert "Enable profiled guided compilation in dex2oat" Calin Juravle
The test still have some flakiness in it which didn't reproduce locally. This reverts commit 500c9be1f261a8a95ae7a25f4f8084f43207f313. Change-Id: I132aff62bf03c2f926aafde6869707573bae9b36
2015-12-10Enable profiled guided compilation in dex2oat Calin Juravle
- add parsing of the profile info saved during JIT. - don't compile methods which are not part of the profile info. - delete old profile hooks. - add test for reading/writing profile. The test is disable in: * interpreter modes: the test needs JIT. * no-dex2oat/no-prebuild: we only save profiling info for the primary oat file. In these modes we don't create oat files and thus nothing is saved. Bug:26080105 Change-Id: Ifdc63dc9d4b537fc79e54c3edc3ae3a462bc30fb
2015-12-02Revert "Enable profiled guided compilation in dex2oat" Nicolas Geoffray
Test has flakes: +art F 30865 30865 art/runtime/java_vm_ext.cc:466] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0x80 +art F 30865 30865 art/runtime/java_vm_ext.cc:466] string: '��gy�' +art F 30865 30865 art/runtime/java_vm_ext.cc:466] input: '<0x80> 0xd8 0x67 0x79 0x8e 0x7f' +art F 30865 30865 art/runtime/java_vm_ext.cc:466] in call to NewStringUTF +art F 30865 30865 art/runtime/java_vm_ext.cc:466] from java.lang.String Main.getProfileInfoDump(java.lang.String, java.lang.Class, java.lang.Class) This reverts commit 27e17fd81cc30e16e86c9c15498cae7f920c9dfe. Change-Id: Id224b5970c3620c4c71fc0d39ed4a2e4755e5f29
2015-12-02Enable profiled guided compilation in dex2oat Calin Juravle
- add parsing of the profile info saved during JIT - don't compile methods which are not part of the profile info. - delete old profile hooks Change-Id: I45a13c3aeb36265d335e57cd160b9ea0fab3cbb5
2015-11-15x86/x86-64 read barrier support for concurrent GC in Optimizing. Roland Levillain
This first implementation uses slow paths to instrument heap reference loads and GC root loads for the concurrent copying collector, respectively calling the artReadBarrierSlow and artReadBarrierForRootSlow (new) runtime entry points. Notes: - This implementation does not instrument HInvokeVirtual nor HInvokeInterface instructions (for class reference loads), as the corresponding read barriers are not stricly required with the current concurrent copying collector. - Intrinsics which may eventually call (on slow path) are disabled when read barriers are enabled, as the current slow path infrastructure does not support this case. - When read barriers are enabled, the code generated for a HArraySet instruction always go into the array set slow path for object arrays (delegating the operation to the runtime), as we are lacking a mechanism to keep a temporary register live accross a runtime call (needed for the instrumentation of type checking code, which requires two successive read barriers). Bug: 12687968 Change-Id: I14cd6107233c326389120336f93955b28ffbb329
2015-10-15Use ATTRIBUTE_UNUSED more. Roland Levillain
Use it in lieu of UNUSED(), which had some incorrect uses. Change-Id: If247dce58b72056f6eea84968e7196f0b5bef4da
2015-10-13Add initial default method support to Art Alex Light
This commit starts the process of adding default methods and their associated pieces to ART. This adds full support for calling default methods using invoke-interface and invoke-virtual on objects implementing the interfaces. Verifier is changed to allow this when the runtime is started with -Xexperimental:default-methods. This also adds support for defining and calling static methods on interface classes with invoke-static. Directly calling overridden default methods using invoke-super is not yet supported. This adds 5 new run-tests for this functionality. Bug: 24618811 Change-Id: I35ca800d99d3329348b277789b70ceeeba6e7f03
2015-09-27Revert "Revert "lambda: Experimental support for capture-variable and ↵ Igor Murashkin
liberate-variable"" This reverts commit 7bbb80ab52c203e44d2ded2c947b3b03b4b31ec4. Change-Id: If806ce5c6c5e96fdb2c3761dee096f74e7e5b001
2015-09-27Revert "lambda: Experimental support for capture-variable and liberate-variable" Nicolas Geoffray
Test fails. This reverts commit b72123440d8541362ebdb131436f9dbdda5fd329. Change-Id: Ic9ed92f8c826d8465eb36b746dc44af05caf041c
2015-09-25lambda: Experimental support for capture-variable and liberate-variable Igor Murashkin
Supports capturing/liberating any primitive variables. No support for capturing objects/lambdas yet since they would both need GC changes to track roots through closures. Change-Id: Ibfb68bfe4c579dbf93823aac4c0e6ac8f6360c5d
2015-09-03Reduce how often we call FindDexCache Mathieu Chartier
Before host boot.oat -j4 optimizing compile: real 1m17.792s user 3m26.140s sys 0m8.340s After: real 1m12.324s user 3m22.718s sys 0m8.320s Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
2015-08-26ART: Propagate verifier failure types to the compilers Andreas Gampe
Add a bit-set encoding of seen failure types to the verifier and make it available. Store this in VerifiedMethod, so that compilers can inspect it and make choices based on failures. Rewrite the current punting of runtime-throw errors to be at the compiler-driver level. Bug: 23502994 Change-Id: I1cfc7cbdf2aec1f14ba18f0169e432ba4ae16883
2015-08-18Svelter libart-compiler Alex Light
Added new environment variable ART_{TARGET,HOST}_CODEGEN_ARCHS which may be set to 'all', 'svelte' or a space separated list of architectures. When compiled with ART_{TARGET,HOST}_CODEGEN_ARCHS='all' (the default value) dex2oat will be able to generate output for all supported architectures. When compiled with ART_TARGET_CODEGEN_ARCHS='svelte' only the architectures of the TARGET will be included. When ART_HOST_CODEGEN_ARCHS='svelte' all architectures the target includes and the host architectures will be included on the host dex2oat. If a list of architectures is given only those will be included. Change-Id: I87f4ad0131ab1b37544d8799e947ce4733b6daec
2015-07-01Implement heap poisoning in ART's Optimizing compiler. Roland Levillain
- Instrument ARM, ARM64, x86 and x86-64 code generators. - Note: To turn heap poisoning on in Optimizing, set the environment variable `ART_HEAP_POISONING' to "true" before compiling ART. Bug: 12687968 Change-Id: Ib3120b38cf805a8a50207a314b9ccc90c8d93740
2015-06-24Use a flag from the verifier to know if we should compile. Nicolas Geoffray
Only used for the lack of bottom type in the aget-object case for now. Could be used for more. bug:21865466 Change-Id: I64c2c84dfa1c0d259631e65e5f44b94e4139e6a7
2015-06-22runtime: Partially implement box-lambda and unbox-lambda experimental opcodes Igor Murashkin
These opcodes are not yet fully specified, and *will* change before they become shippable. Do not write production code against experimental opcodes. -- Implement partial interpreter support for new dex instructions box/unbox-lambda. * box-lambda will take a closure and convert it into an Object * unbox-lambda will take an Object and convert it to a closure (Currently does not implement object identity or variable capture). All new opcodes are disabled by default, use runtime option -Xexperimental-lambdas to enable them. Change-Id: I3c15ccf8a26ccecd1d35808a8c1b4149220f6019
2015-06-18interpreter: Add experimental lambda opcodes for invoke/create-lambda Igor Murashkin
These opcodes are not yet fully specified, and *will* change before they become shippable. Do not write production code against experimental opcodes. -- Implement partial interpreter support for new dex instructions invoke/create-lambda, and a new opcode format 25x. * Does not verify, in fact verification will soft fail when we see those opcodes. * Compilers will punt to interpreter since they don't support new opcodes. * As there is no way to capture/liberate variables yet, the "closure" is just an ArtMethod for the time being. All new opcodes are disabled by default, use runtime option -Xexperimental-lambdas to enable them. For example: dalvikvm ... -Xexperimental-lambdas ... dex2oat --runtime-arg -Xexperimental-lambdas ... Change-Id: I6c996ca32a9b54ec45ec21d7a959b84dfb8a24eb
2015-05-29Move mirror::ArtMethod to native Mathieu Chartier
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
2015-05-07Quick: Abolish kMirOpCheckPart2. Vladimir Marko
The tricks played with kMirOpCheckPart2 are making the native GC map generation unnecessarily complex. They have caused problems in the past and now there is bad interaction with the DCE. Rather than fixing it time and again, remove the pseudo-insn. (The whole purpose of those tricks seems to be to allow the register tracking to be used for the throwing insn before resetting the tracking for the next block. However, it's questionable whether that's better than processing the throwing insn with the subsequent instructions.) Bug: 20736048 Change-Id: I4767e4609914d3b6990da4416e5093e4ca209780
2015-04-27Quick: Rely on inferred types in GVN/LVN/DCE. Vladimir Marko
Fix LVN::GetEndingVregValueNumberImpl() to check whether the requested wideness matches the SSA register type as recorded in MIRGraph::reg_location_. Add DCHECKs that the wideness matches when getting/setting sreg values, update Phi handling in LVN/DCE to use the type from MIRGraph::reg_location_ instead of determining it from the sreg value maps which would now trigger the DCHECKs. Update tests to initialize MIRGraph::reg_location_. Reenable DCE. Bug: 20572509 Change-Id: I1a4d4e32cd57807ca8b56d2f3ed5e1288660b82e
2015-04-25Disable Quick's GVN-based dead code elimination. Roland Levillain
Quick's GVN/DCE seems to trouble the builds. Bug: 20572509 Change-Id: I1e315b4eee4443f04c7cb2cef953d8e4eff619ce
2015-04-23Quick: Fix and enable DCE and improve GVN/DCE cleanup. Vladimir Marko
When eliminating a move by renaming its source register, check that it doesn't conflict with vreg usage by insns between the defining insn and the move. Improve the GVN/DCE cleanup so that it can handle cases where GVN or DCE is individually disabled in the pass driver but not in the disable_opt flags. Bug: 19419671 Change-Id: I49bb67b81509f51fbaf90c6016c509962be43736
2015-04-22Replace NULL with nullptr Mathieu Chartier
Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
2015-04-10ART: Remove WriteElf from Compiler Andreas Gampe
As Portable is gone, we only have one elf_writer left. It also allows to put the decision for 32b vs 64b ELF into a central point. Change-Id: Iae67d06df85268b3f0ee5725abc65edd23eb2499
2015-04-08Implement CFI for Quick. David Srbecky
CFI is necessary for stack unwinding in gdb, lldb, and libunwind. Change-Id: Ic3b84c9dc91c4bae80e27cda02190f3274e95ae8
2015-04-07ART: Fix 64-bit ELF file support Andreas Gampe
The API wasn't cross-compile-safe, 32-bit patchoat would fail for negative delta applied to a 64-bit ELF file. Add 64-bit ELF file output to the compilers, behind a flag, currently off by default (preserving current behavior). Bug: 20095017 Change-Id: I2cde7b4c7cc83413c76692d7b745868d644a604c
2015-03-31Merge "Fixed layout for dex caches in boot image." Vladimir Marko
2015-03-31Fixed layout for dex caches in boot image. Vladimir Marko
Define a fixed layout for dex cache arrays (type, method, string and field arrays) for dex caches in the boot image. This gives those arrays fixed offsets from the boot image code and allows PC-relative addressing of their elements. Use the PC-relative load on arm64 for relevant instructions, i.e. invoke-static, invoke-direct, const-string, const-class, check-cast and instance-of. This reduces the arm64 boot.oat on Nexus 9 by 1.1MiB. This CL provides the infrastructure and shows on the arm64 the gains that we can achieve by having fixed dex cache arrays' layout. To fully use this for the boot images, we need to implement the PC-relative addressing for other architectures. To achieve similar gains for apps, we need to move the dex cache arrays to a .bss section of the oat file. These changes will be implemented in subsequent CLs. (Also remove some compiler_driver.h dependencies to reduce incremental build times.) Change-Id: Ib1859fa4452d01d983fd92ae22b611f45a85d69b
2015-03-27[MIPS] Refactoring code for quick compiler Goran Jakovljevic
Code from compiler/dex/quick/mips64 is merged with code in mips folder. Change-Id: I785983c21549141306484647da86a0bb4815daaa
2015-03-19Change RETURN_VOID_BARRIER to RETURN_VOID_NO_BARRIER Mathieu Chartier
We want to default to having a barrier for the case where we don't dex to dex. Bug: 19762303 Change-Id: I60348d89eaf0b9e1e480298afcecbb5f52e8661b
2015-03-17Fall back to Quick when Optimizing cannot compile. Nicolas Geoffray
Currently applies when seeing unresolved types/methods/fields, and methods with try/catch. Change-Id: I93b12d440b39f0b9faf98f08f2bfddedfeff7182
2015-03-09Trim arenas for JIT Mathieu Chartier
Moved arena pool into the runtime. Added arena trimming to arena pool. When called, this madvises the used memory. Changed the JIT compiler to trim arenas after compilation. Changed the arena mmap name to dalvik-LinearAlloc. Native PSS before: 80353 kB: Native 80775 kB: Native 78116 kB: Native After: 73357 kB: Native 70181 kB: Native 70306 kB: Native Bug: 17950037 Bug: 17643507 Bug: 19264997 Change-Id: I63e7a898fd6e909c2c677fa57b5917a7b1398930
2015-03-06Initial support for quick compiler on MIPS64r6. Maja Gagic
Change-Id: I6f43027b84e4a98ea320cddb972d9cf39bf7c4f8
2015-02-24Revert "Revert "Add JIT"" Mathieu Chartier
Added missing EntryPointToCodePointer. This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399. Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
2015-02-24Revert "Add JIT" Nicolas Geoffray
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
2015-02-23Add JIT Mathieu Chartier
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
2015-02-18Quick: Disable DCE until we fix FP/Core reg mismatches. Vladimir Marko
GVN and TypeInference can miss some FP/Core register mismatch: const v0, #X ; marked as float invoke-virtual v0, void foo(float) const v0, #X ; marked as core aput v0, v1, v2 ; float[] not used The second const is eliminated by the DCE because it writes the same value to the same dalvik reg. We replace the SSA register name defined by the first const and used by the invoke-virtual with the one defined by the second const. When we generate code for the invoke-virtual, we get a core location and may need a temporary to set up the FP argument and we may not have an available temporary. This may affect the bug below (more investigation needed). Bug: 19419671 Change-Id: I44abd390706b980c346b36c9828a3bcb4e96726d
2015-02-17Dead code elimination based on GVN results. Vladimir Marko
Change-Id: I5b77411a8f088f0b561da14b123cf6b0501c9db5
2015-01-28Clean up pass driver Mathieu Chartier
Added pass manager to hold the state which used to be in global variables. Static variables caused issues with Runtime.exit since they are destroyed by the global destructors while threads are still executing. Bug: 17950037 Change-Id: Ie0e4546dc9e48909c8df996a5c135be682d50044
2015-01-27ART: Even more Quick cleanup Andreas Gampe
Remove Backend. Change-Id: I247cc65ccda6a362ba1a8f5e73e7f12ecd980a87
2015-01-26ART: More Quick cleanup Andreas Gampe
Remove frontend, move code to QuickCompiler. Fix some includes. Change-Id: Iedd8f339ec76635e48b166e285f7fc571fc948ac
2015-01-26ART: Some Quick cleanup Andreas Gampe
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
2014-12-17ART: Added Checker, a pattern matching test engine David Brazdil
This patch adds a Python script which implements a domain-specific mini-language similar to that of LLVM's FileCheck. It is primarily intended for writing tests for the optimizing compiler but could be configured for other use cases too. It is implemented from scratch in order to avoid dependency on LLVM. Checker tests are written in Java and dex2oat is invoked with a flag which dumps the CFG before and after each pass of the optimizing compiler. The output is then compared against assertions in the test's comments parsed by Checker. See comments in tools/checker.py for more details about the currently supported language features. This initial CL implements only one type of assertion - whether the output contains lines matching a desired pattern in the given order - but supports both plain text and regex matching and allows for equivalency testing by matching for the outcome of a previous match. See the tests in compiler/optimizing/test/ConstantFolding.java for examples. Change-Id: I1ad7431b399c38dc0391ccee74d2c643ba0b0675
2014-12-12Remove portable. Elliott Hughes
Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
2014-12-10Add missing iget quick for bool, byte, char, short Mathieu Chartier
Bug: 17791557 Bug: 17671806 Change-Id: Ifac4fbfba6c3a3f97131e85914b24756fb7f9722