summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.h
AgeCommit message (Collapse)Author
2017-09-25ART: Introduce compiler data type.Vladimir Marko
Replace most uses of the runtime's Primitive in compiler with a new class DataType. This prepares for introducing new types, such as Uint8, that the runtime does not need to know about. Test: m test-art-host-gtest Test: testrunner.py --host Bug: 23964345 Change-Id: Iec2ad82454eec678fffcd8279a9746b90feb9b0c
2017-09-20Refactor compiled_method.h .Vladimir Marko
Move LinkerPatch to compiler/linker/linker_patch.h . Move SrcMapElem to compiler/debug/src_map_elem.h . Introduce compiled_method-inl.h to reduce the number of `#include`s in compiled_method.h . Test: m test-art-host-gtest Test: testrunner.py --host Change-Id: Id211cdf94a63ad265bf4709f1a5e06dffbe30f64
2017-08-11optimizing: Refactor statistics to use OptimizingCompilerStats helperIgor Murashkin
Remove all copies of 'MaybeRecordStat', replacing them with a single OptimizingCompilerStats::MaybeRecordStat helper. Change-Id: I83b96b41439dccece3eee2e159b18c95336ea933
2017-07-24Fix x86 and x64 codegens for 8/16 stores.Nicolas Geoffray
Test: 660-store-8-16 Change-Id: I6124818894205ebeed83929f3ff00bf2733292bf
2017-07-11Introduce a Marking Register in ARM64 code generation.Roland Levillain
When generating code for ARM64, maintain the status of Thread::Current()->GetIsGcMarking() in register X20, dubbed MR (Marking Register), and check the value of that register (instead of loading and checking a read barrier marking entrypoint) in read barriers. Test: m test-art-target Test: m test-art-target with tree built with ART_USE_READ_BARRIER=false Test: ARM64 device boot test Bug: 37707231 Change-Id: Ibe9bc5c99a2176b0a0476e9e9ad7fcc9f745017b
2017-06-07Merge "Replace invoke kind kDexCacheViaMethod with kRuntimeCall."Vladimir Marko
2017-06-06Replace invoke kind kDexCacheViaMethod with kRuntimeCall.Vladimir Marko
In preparation for replacing the dex cache method array with a hash-based array, get rid of one unnecessary use. This method load kind is currently used only on mips for irreducible loops and OSR, so this should have no impact on x86/x86-64/arm/arm64. Test: m test-art-host-gtest Test: testrunner.py --host Test: Repeat the above tests with manually changing kDexCachePcRelative to kRuntimeCall in sharpening.cc. (Ignore failures in 552-checker-sharpening.) Bug: 30627598 Change-Id: Ifce42645f2dcc350bbb88c2f4642e88fc5f98152
2017-06-05Merge "Revert^3 "ART: Reference.getReferent intrinsic for x86 and x86_64""Vladimir Marko
2017-06-05Merge "Rename kDexCacheViaMethod to kRuntimeCall for HLoadClass/String."Vladimir Marko
2017-06-02Revert^3 "ART: Reference.getReferent intrinsic for x86 and x86_64"Vladimir Marko
Reverting because GenerateCalleeMethodStaticOrDirectCall() prevents replacing kDexCacheViaMethod with kRuntimeCall where we would not retrieve the target method at all and leave the runtime to retrieve and call it just like for unresolved methods. The intrinsic should be re-implemented by loading the flags through HLoadClass. Note that the intrinsic was unimplemented for CC. Test: Rely on TreeHugger. Bug: 32535355 Bug: 30627598 This reverts commit 288c7a8664e516d7486ab85267050e676e84cc39. Change-Id: Ia22864553ff55562897571e180b11926ccd51588
2017-06-02Rename kDexCacheViaMethod to kRuntimeCall for HLoadClass/String.Vladimir Marko
The old name does not reflect the actual code anymore. Test: testrunner.py --host Change-Id: I2e13cf727bba9d901c4d3fc821bb526d38a775b8
2017-06-01ART: Clean up thread.h and thread_list.hAndreas Gampe
Remove dependency on stack.h and gc_root.h. Remove unused object callbacks include. Factor out ManagedStack into its own set of files. Fix up users of transitive includes. Test: m test-art-host Change-Id: I01286c43d8c7710948c161b1348faabb05922e59
2017-05-25Refactor profiles to use TypeReference instead of ClassReferenceMathieu Chartier
Refactor type reference into runtime and use it for profiles. ClassReference was just duplicated code since it wasn't even using the class def indexes. Test: test-art-host Bug: 62040831 Change-Id: Ia92f21c0e85c00321f52c97bb7a90158d882849b
2017-05-11Clean up some uses of "auto".Vladimir Marko
Make actual types more explicit, either by replacing "auto" with actual type or by assigning std::pair<> elements of an "auto" variable to typed variables. Avoid binding const references to temporaries. Avoid copying a container. Test: m test-art-host-gtest Change-Id: I1a59f9ba1ee15950cacfc5853bd010c1726de603
2017-03-16Add method info to oat filesMathieu Chartier
The method info data is stored separately from the code info to reduce oat size by improving deduplication of stack maps. To reduce code size, this moves the invoke info and inline info method indices to this table. Oat size for a large app (arm64): 77746816 -> 74023552 (-4.8%) Average oat size reduction for golem (arm64): 2% Repurposed unused SrcMapElem deduping to be for MethodInfo. TODO: Delete SrcMapElem in a follow up CL. Bug: 36124906 Test: clean-oat-host && test-art-host-run-test Change-Id: I2241362e728389030b959f42161ce817cf6e2009
2017-01-26Add per array size allocation entrypoints.Nicolas Geoffray
- Update architectures that have fast paths for array allocation to use it. - Will add more fast paths in follow-up CLs. Test: test-art-target test-art-host. Change-Id: I138cccd16464a85de22a8ed31c915f876e78fb04
2017-01-20Compressed native PC for stack mapsMathieu Chartier
Compress native PC based on instruction alignment. This reduces the size of stack maps, boot.oat is 0.4% smaller for arm64. Test: test-art-host, test-art-target, N6P booting Change-Id: I2b70eecabda88b06fa80a85688fd992070d54278
2017-01-16Make runtime call on main for HLoadClass/kDexCacheViaMethod.Vladimir Marko
Remove dependency of the compiled code on types dex cache array in preparation for changing to a hash-based array. Test: m test-art-host Test: m test-art-target on Nexus 9 Bug: 30627598 Change-Id: I3c426ed762c12eb9eb4bb61ea9a23a0659abf0a2
2017-01-15Revert "Revert "ART: Compiler support for invoke-polymorphic.""Orion Hodson
This reverts commit 0fb5af1c8287b1ec85c55c306a1c43820c38a337. This takes us back to the original change and attempts to fix the issues encountered: - Adds transition record push/pop around artInvokePolymorphic. - Changes X86/X64 relocations for MacSDK. - Implements MIPS entrypoint for art_quick_invoke_polymorphic. - Corrects size of returned reference in art_quick_invoke_polymorphic on ARM. Bug: 30550796,33191393 Test: art/test/run-test 953 Test: m test-art-run-test Change-Id: Ib6b93e00b37b9d4ab743a3470ab3d77fe857cda8
2017-01-11Merge "Revert "ART: Compiler support for invoke-polymorphic.""Orion Hodson
2017-01-11Revert "ART: Compiler support for invoke-polymorphic."Orion Hodson
This reverts commit 02e3092f8d98f339588e48691db77f227b48ac1e. Reasons for revert: - Breaks MIPS/MIPS64 build. - Fails under GCStress test on x64. - Different x64 build configuration doesn't like relocation. Change-Id: I512555b38165d05f8a07e8aed528f00302061001
2017-01-11Merge "ART: Compiler support for invoke-polymorphic."Treehugger Robot
2017-01-11ART: Compiler support for invoke-polymorphic.Orion Hodson
Adds basic support to invoke method handles in compiled code. Enables method verification for methods containing invoke-polymorphic. Adds k45cc/k45rc output to Instruction::DumpString() which was found to be missing when enabling verification. Include stack traces in test 957-methodhandle-transforms for failures so they can be easily identified. Bug: 30550796,33191393 Test: art/test/run-test 953 Test: m test-art-run-test Change-Id: Ic9a96ea24906087597d96ad8159a5bc349d06950
2017-01-10Keep resolved String in HLoadString.Nicolas Geoffray
For the following reasons: - Avoids needing to do a lookup again in CodeGenerator::EmitJitRoots. - Fixes races where we the string was GC'ed before CodeGenerator::EmitJitRoots. - Makes it possible to do GVN on the same string but defined in different dex files. Test: test-art-host, test-art-target Change-Id: If2b5d3079f7555427b1b96ab04546b3373fcf921
2016-12-12Revert "Revert "Add kJitTableAddress for HLoadClass.""Nicolas Geoffray
This reverts commit d2d5262c8370309e1f2a009f00aafc24f1cf00a0. Change-Id: I6149d5c7d5df0b0fc5cb646a802a2eea8d01ac08
2016-12-12Revert "Add kJitTableAddress for HLoadClass."Nicolas Geoffray
One test failure after merge. This reverts commit 5b12f7973636bfea29da3956a9baa7a6bbe2b666. Change-Id: I120c49e53274471fc1c82a10d52e99c83f5f85cc
2016-12-12Add kJitTableAddress for HLoadClass.Nicolas Geoffray
This new kind loads classes from the root table associated with JIT compiled code. Also remove kDexCacheAddress, which is replaced by kJitTableAddress. test: ART_TEST_JIT=true test-art-host-jit test-art-target-jit Change-Id: Ia23029688d1a60c178bf2ffa7463927c5d5de4d0
2016-12-01Class Hierarchy Analysis (CHA)Mingyao Yang
The class linker now tracks whether a method has a single implementation and if so, the JIT compiler will try to devirtualize a virtual call for the method into a direct call. If the single-implementation assumption is violated due to additional class linking, compiled code that makes the assumption is invalidated. Deoptimization is triggered for compiled code live on stack. Instead of patching return pc's on stack, a CHA guard is added which checks a hidden should_deoptimize flag for deoptimization. This approach limits the number of deoptimization points. This CL does not devirtualize abstract/interface method invocation. Slides on CHA: https://docs.google.com/a/google.com/presentation/d/1Ax6cabP1vM44aLOaJU3B26n5fTE9w5YU-1CRevIDsBc/edit?usp=sharing Change-Id: I18bf716a601b6413b46312e925a6ad9e4008efa4 Test: ART_TEST_JIT=true m test-art-host/target-run-test test-art-host-gtest
2016-11-18Revert "Revert "Revert "Revert "JIT root tables.""""Nicolas Geoffray
Test: 626-set-resolved-string, test-art-host, test-art-target Test: run-libcore-tests.sh Test: phone boots and runs This reverts commit 3395fbc20bcd20948bec8958db91b304c17cacd8. Change-Id: I104b73d093e3eb6a271d564cfdb9ab09c1c8cf24
2016-11-14Revert "Revert "Revert "JIT root tables."""Nicolas Geoffray
libcore failures: dalvikvm32 F 11-14 03:04:06 14870 14870 jit_code_cache.cc:310] Check failed: new_string != nullptr This reverts commit 75afcdd3503a8a8518e5b23d21b6e73306ce39ce. Change-Id: I5a6b6b48aa79a763d1ff1ba4d85d63811254787d
2016-11-11Revert "Revert "JIT root tables.""Nicolas Geoffray
Also contains Revert "Support kJitTableAddress in x86/arm/arm64." This reverts commit 4acd03638fcdb4e5d1666f8eec7eb3bf6d6be035. This reverts commit 997d1217830c0a18b70faeabd53c04700a87d7d9. Test: ART_USE_READ_BARRIER=true/false test-art-host test-art-target Change-Id: I77cb1e9bf8f1b4c58b72d3cf5ca31ced2aaa1ea3
2016-11-10Use enum for read barrier options in compilerMathieu Chartier
Enums are just phenomenal. Also fixed a double load error in x86 interface check cast fast path. Test: test-art-host Change-Id: Iea403ce579145b6a294073f3900ad6921c1a0d53
2016-11-09Revert "JIT root tables."Nicolas Geoffray
May be the offender for jit-gcstress failure of 902. This reverts commit ac3ebc3150760425ed00abd56da48f9a6e0666bc. Change-Id: I9ea6c9236fd1729fed7d1868dd8a111172932308
2016-11-08JIT root tables.Nicolas Geoffray
Implement root tables for the JIT. Each JIT compiled method gets a table allocated before the stack maps. The table gets visited through Runtime::SweepSystemWeaks. Implement String roots for x86_64 as an example. Test: test-art-host test-art-target Change-Id: Id3d5bc67479e08b52dd4b253e970201203a0f0d2
2016-10-18Delete unused blocked_register_pairs_ in code generatorsMathieu Chartier
Legacy code for compatibility with quick? Test: test-art-host CC Change-Id: I9de261daea67dfd9bd3df89826ba9d10f135e29e
2016-10-04Revert "Revert "Store resolved Strings for AOT code in .bss.""Vladimir Marko
Fixed oat_test to keep dex files alive. Fixed mips build. Rewritten the .bss GC root visiting and added write barrier to the artResolveStringFromCode(). Test: build aosp_mips-eng Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test Test: Run ART test suite on host and Nexus 9. Bug: 20323084 Bug: 30627598 This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0. Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
2016-09-30Revert "Store resolved Strings for AOT code in .bss."Vladimir Marko
There are some issues with oat_test64 on host and aosp_mips-eng. Also reverts "compiler_driver: Fix build." Bug: 20323084 Bug: 30627598 This reverts commit 63dccbbefef3014c99c22748d18befcc7bcb3b41. This reverts commit 04a44135ace10123f059373691594ae0f270a8a4. Change-Id: I568ba3e58cf103987fdd63c8a21521010a9f27c4
2016-09-29Store resolved Strings for AOT code in .bss.Vladimir Marko
And do some related refactorings. Bug: 20323084 Bug: 30627598 Test: Run ART test suite including gcstress on host and Nexus 9. Test: Run ART test suite including gcstress with baker CC on host and Nexus 9. Test: Build aosp_mips64-eng. Change-Id: I1b12c1570fee8e5da490b47f231050142afcbd1e
2016-09-23Clean-up sharpening and compiler driver.Nicolas Geoffray
Remove dependency on compiler driver for sharpening and dex2dex (the methods called on the compiler driver were doing unnecessary work), and remove the now unused methods in compiler driver. Also remove test that is now invalid, as sharpening always succeeds. test: m test-art-host m test-art-target Change-Id: I54e91c6839bd5b0b86182f2f43ba5d2c112ef908
2016-09-20Change remaining slow path throw entrypoints to save everything.Vladimir Marko
Change DivZeroCheck, BoundsCheck and explicit NullCheck slow path entrypoints to conform to kSaveEverything. On Nexus 9, AOSP ToT, the boot.oat size reduction is prebuilt multi-part boot image: - 32-bit boot.oat: -12KiB (-0.04%) - 64-bit boot.oat: -24KiB (-0.06%) on-device built single boot image: - 32-bit boot.oat: -8KiB (-0.03%) - 64-bit boot.oat: -16KiB (-0.04%) Test: Run ART test suite including gcstress on host and Nexus 9. Test: Manually disable implicit null checks and test as above. Change-Id: If82a8082ea9ae571c5d03b5e545e67fcefafb163
2016-09-19Remove the `CanTriggerGC` side-effects on a few instructions.Alexandre Rames
The side-effect was specified for these instructions as they call runtime. We now have a list of entrypoints that we know cannot trigger GC. We can avoid requiring the side-effect for those. Test: Run ART test suite on Nexus 5X and host. Change-Id: I0e0e6a4d701ce6c75aff486cb0d1bc7fe2e8dda4
2016-09-14Revert "Revert "Use implicit null checks inside try blocks.""Vladimir Marko
Fix implicit checks in try blocks to emit stack maps. Fix arm64 null expection from signal entrypoint to call the runtime handler instead or simply jumping there. On Nexus 9, AOSP ToT, the boot.oat size reduction is prebuilt multi-part boot image: - 32-bit boot.oat: -448KiB (-1.3%) - 64-bit boot.oat: -528KiB (-1.2%) on-device built single boot image: - 32-bit boot.oat: -448KiB (-1.4%) - 64-bit boot.oat: -528KiB (-1.3%) Note that the oat files no longer contain dex files which have been moved to vdex, so the percentages are not directly comparable with the those reported in the original commit. Test: Run ART test suite including gc-stress on host and Nexus 9. Bug: 30212852 Bug: 31468464 This reverts commit 0719b5b9b458cb3eb9f0823f0dacdfe1a71214dd. Change-Id: If8a9da8c11adf2aad203e93b6684ce16ed776285
2016-09-12Revert "Use implicit null checks inside try blocks."Nicolas Geoffray
Fails gcstress tests. This reverts commit 7aa7560683626c7893011271c241b3265ded1dc3. Change-Id: I4f5c89048b9ffddbafa02f3001e329ff87058ca2
2016-09-12Use implicit null checks inside try blocks.Vladimir Marko
Make implicit null check entrypoint save all registers, use platform-specific approach to still pass the fault address. Allow implicit null checks in try blocks. On Nexus 9, AOSP ToT, the boot.oat size reduction is prebuilt multi-part boot image: - 32-bit boot.oat: -452KiB (-0.7%) - 64-bit boot.oat: -482KiB (-0.7%) on-device built single boot image: - 32-bit boot.oat: -444KiB (-0.7%) - 64-bit boot.oat: -488KiB (-0.7%) Test: Run ART test suite on host and Nexus 9. Test: Build aosp_mips64-eng. Change-Id: I279f3ab57e2e2f338131c5cac45c51b673bdca19
2016-09-06Merge "MIPS32: Ensure preservation of RA in leaf methods if it's clobbered"Treehugger Robot
2016-09-05Merge "Avoid excessive spill slots for slow paths."Treehugger Robot
2016-09-05Avoid excessive spill slots for slow paths.Vladimir Marko
Reducing the frame size makes stack maps smaller as we need fewer bits for stack masks and some dex register locations may use short location kind rather than long. On Nexus 9, AOSP ToT, the boot.oat size reduction is prebuilt multi-part boot image: - 32-bit boot.oat: -416KiB (-0.6%) - 64-bit boot.oat: -635KiB (-0.9%) prebuilt multi-part boot image with read barrier: - 32-bit boot.oat: -483KiB (-0.7%) - 64-bit boot.oat: -703KiB (-0.9%) on-device built single boot image: - 32-bit boot.oat: -380KiB (-0.6%) - 64-bit boot.oat: -632KiB (-0.9%) on-device built single boot image with read barrier: - 32-bit boot.oat: -448KiB (-0.6%) - 64-bit boot.oat: -692KiB (-0.9%) The other benefit is that at runtime, threads may need fewer pages for their stacks, reducing overall memory usage. We defer the calculation of the maximum spill size from the main register allocator (linear scan or graph coloring) to the RegisterAllocationResolver and do it based on the live registers at slow path safepoints. The old notion of an artificial slow path safepoint interval is removed as it is no longer needed. Test: Run ART test suite on host and Nexus 9. Bug: 30212852 Change-Id: I40b3d114e278e2c5807982904fa49bf6642c6275
2016-09-02Clean up some includes.Vladimir Marko
Remove some unnecessary includes from header files, replace others with forward references and add includes to source files as needed. Reduce dependency on stack.h by pulling StackReference<> out to its own file. Test: m test-art-host Change-Id: I0fb182145e328870cbd918b0ef6ae2950223c1b2
2016-09-01MIPS32: Ensure preservation of RA in leaf methods if it's clobberedAlexey Frunze
Test: booted MIPS32 in QEMU Test: test-art-host-gtest Test: test-art-target-gtest-codegen_test in QEMU Test: test-art-target-run-test-optimizing on CI20 Change-Id: Ia3da5902d967cd7af313f03ebf414320b0063619
2016-08-05Implement a graph coloring register allocatorMatthew Gharrity
Test: m test-art-host Change-Id: I8c0d77f339ab02b33588a54b96ecce5c8322cfce