summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
AgeCommit message (Collapse)Author
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-02-26ART: Fix underflow in codegenAndreas Gampe
Check for count == 0 first before accessing non-existent stack map. Test: m ART_TEST_JIT=true test-art-host Test: m ART_TEST_JIT=true test-art-host-run-test-913-heaps Change-Id: Id4cad8e791d731147860b8a9a0d90cc893cc6972
2017-02-15Add invoke infos to stack mapsMathieu Chartier
Invoke info records the invoke type and dex method index for invokes that may reach artQuickResolutionTrampoline. Having this information recorded allows the runtime to avoid reading the dex code and pulling in extra pages. Code size increase for a large app: 93886360 -> 95811480 (2.05% increase) 1/2 of the code size increase is from making less stack maps deduped. I suspect there is less deduping because of the invoke info method index. Merged disabled until we measure the RAM savings. Test: test-art-host, N6P boots Bug: 34109702 Change-Id: I6c5e4a60675a1d7c76dee0561a12909e4ab6d5d9
2017-02-14ART: Add operator == and != with nullptr to HandleAndreas Gampe
Get it in line with ObjPtr and prettify our code. Test: m Change-Id: I1322e2a9bc7a85d7f2441034a19bf4d807b81a0e
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-17Merge "Put inlined ArtMethod pointer in stack maps."Nicolas Geoffray
2017-01-16Put inlined ArtMethod pointer in stack maps.Nicolas Geoffray
Currently done for JIT. Can be extended for AOT and inlined boot image methods. Also refactor the lookup of a inlined method at runtime to not rely on the dex cache, but look at the class loader tables. bug: 30933338 test: test-art-host, test-art-target Change-Id: I58bd4d763b82ab8ca3023742835ac388671d1794
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-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-27Remove H[Reverse]PostOrderIterator and HInsertionOrderIterator.Vladimir Marko
Use range-based loops instead, introducing helper functions ReverseRange() for iteration in reverse order in containers. When the contents of the underlying container change inside the loop, use an index-based loop that better exposes the container data modifications, compared to the old iterator interface that's hiding it which may lead to subtle bugs. Test: m test-art-host Change-Id: I2a4e6c508b854c37a697fc4b1e8423a8c92c5ea0
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-22Revert "Revert "ARM: VIXL32: Add an initial code generator that passes ↵Scott Wakeling
codegen_tests."" This VIXL32-based code generator is not enabled in the optimizing compiler by default. Changes in codegen_test.cc test it in parallel with the existing ARM backend. This patch provides a base for further work, the new backend will not be enabled in the optimizing compiler until parity is proven with the current ARM backend and assembler. Test: gtest-codegen_test on host and target This reverts commit 7863a2152865a12ad9593d8caad32698264153c1. Change-Id: Ia09627bac22e78732ca982d207dc0b00bda435bb
2016-09-21Merge "Revert "ARM: VIXL32: Add an initial code generator that passes ↵Nicolas Geoffray
codegen_tests.""
2016-09-21Revert "ARM: VIXL32: Add an initial code generator that passes codegen_tests."Nicolas Geoffray
Failing with: art/compiler/optimizing/code_generator_arm_vixl.cc:396:47: error: too few arguments to function call, expected 3, have 2 ValidateInvokeRuntime(instruction, slow_path); This reverts commit b138dfbd76f9d8b64fb9dbaf1a7c25e2549b2a8c. Change-Id: Idccfe076f5905ea92ecbe3afbc7c8c64ecda94be
2016-09-21Merge "ARM: VIXL32: Add an initial code generator that passes codegen_tests."Roland Levillain
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-15ARM: VIXL32: Add an initial code generator that passes codegen_tests.Scott Wakeling
This VIXL32-based code generator is not enabled in the optimizing compiler by default. Changes in codegen_test.cc test it in parallel with the existing ARM backend. This patch provides a base for further work, the new backend will not be enabled in the optimizing compiler until parity is proven with the current ARM backend and assembler. Test: gtest-codegen_test on host and target Change-Id: Id556a975b2645bf1d98ab2984650e8435b2312c2
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-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-08-30MIPS32: Fill branch delay slotsAlexey Frunze
Test: booted MIPS32 in QEMU Test: test-art-host-gtest Test: test-art-target-gtest Test: test-art-target-run-test-optimizing on CI20 Change-Id: I727e80753395ab99fff004cb5d2e0a06409150d7
2016-08-25Re-enable the ArraySet fast path with Baker read barriers.Roland Levillain
Benchmarks (ARM64) score variations on Nexus 5X with CPU cores clamped at 960000 Hz (aosp_bullhead-userdebug build): - Ritzperf - average (lower is better): -0.95% (virtually unchanged) - CaffeineMark - average (higher is better): +2.50% (slightly better) - DeltaBlue (lower is better): -0.55% (virtually unchanged) - Richards - average (lower is better): +0.67% (virtually unchanged) - SciMark2 - average (higher is better): -0.10% (virtually unchanged) Details about Ritzperf benchmarks with meaningful variations (lower is better): - GenericCalcActions.MemAllocTest: -5.05% (better) Details about CaffeineMark benchmarks with meaningful variations (higher is better): - Method: +16.88% (better) Details about Richards benchmarks with meaningful variations (lower is better): - deutsch_acc_interface: +9.86% (worse) Boot image code size variation on Nexus 5X (aosp_bullhead-userdebug build): - total ARM64 framework Oat files size change: 105933472 bytes -> 106027680 bytes (+0.09%) - total ARM framework Oat files size change: 89157936 bytes -> 89239856 bytes (+0.09%) Test: ART host and target (ARM, ARM64) tests. Bug: 29516974 Bug: 29506760 Bug: 12687968 Change-Id: Ib9e9709712295e17804b8888ac10e3d518ff2e70
2016-08-19Add support for Baker read barriers in SystemArrayCopy intrinsics.Roland Levillain
Benchmarks (ARM64) score variations on Nexus 5X with CPU cores clamped at 960000 Hz (aosp_bullhead-userdebug build): - Ritzperf - average (lower is better): -3.03% (slightly better) - CaffeineMark - average (higher is better): +1.26% (slightly better) - DeltaBlue (lower is better): -10.50% (better) - Richards - average (lower is better): -3.36% (slightly better) - SciMark2 - average (higher is better): +0.26% (virtually unchanged) Details about Ritzperf benchmarks with meaningful variations (lower is better): - FormulaEvaluationActions.EvaluateAndApplyChanges: -13.26% (better) - FormulaEvaluationActions.EvaluateCascadingSums: -10.94% (better) - FormulaEvaluationActions.EvaluateComplexFormulas: -15.50% (better) - FormulaEvaluationActions.EvaluateFibonacci: -10.41% (better) - FormulaEvaluationActions.EvaluateLargeSums: +6.02% (worse) Boot image code size variation on Nexus 5X (aosp_bullhead-userdebug build): - total ARM64 framework Oat files size change: 107047632 bytes -> 107154128 bytes (+0.10%) - total ARM framework Oat files size change: 90932028 bytes -> 91009852 bytes (+0.09%) Test: ART host and target (ARM, ARM64) tests + Nexus 5X boot. Bug: 29516905 Bug: 29506760 Bug: 12687968 Change-Id: I85431368d09965687a0301ae2eb3c991f276ce5d
2016-08-04Merge "Add support for CallKind::kCallOnMainAndSlowPath"Treehugger Robot
2016-08-04Merge "Change suspend entrypoint to save all registers."Vladimir Marko
2016-08-04Change suspend entrypoint to save all registers.Vladimir Marko
We avoid the need to save/restore registers in slow paths and get significant code size savings. On Nexus 9, AOSP: - 32-bit boot.oat: -1.4MiB (-1.9%) - 64-bit boot.oat: -2.0MiB (-2.3%) - other 32-bit oat files in dalvik-cache: -200KiB (-1.7%) - other 64-bit oat files in dalvik-cache: -2.3MiB (-2.1%) Test: Run ART test suite on host and Nexus 9 with gc stress. Bug: 30212852 Change-Id: I7015afc1e7d30341618c9200a3dc9ae277afd134
2016-08-01ART: Convert pointer size to enumAndreas Gampe
Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
2016-07-25Add support for CallKind::kCallOnMainAndSlowPathSerban Constantinescu
Some of the intrinsics call on both the main and slowpath. This patch adds support for such a CallKind and marks the intrinsics accordingly. This will be exercised by a later patch that refactors all the runtime calls to use InvokeRuntime(). Please note that without this patch, the calls to ValidateInvokeRuntime() exercised by the following patches would fail. Change-Id: I450571b8b47280a004b714996189ba6db13fb57d
2016-07-22Do not emit stack maps for runtime calls to ReadBarrierMarkRegX.Roland Levillain
* Boot image code size variation on Nexus 5X (aosp_bullhead-userdebug build): - total ARM64 framework Oat files size change: 115584120 bytes -> 109124728 bytes (-5.59%) - total ARM framework Oat files size change: 97387728 bytes -> 92517584 (-5.00%) Test: ART host and target (ARM, ARM64) tests. Bug: 29506760 Bug: 12687968 Change-Id: I979d9fb2b4e09f4c0c7bf33af2cd91750a67f989
2016-07-18ARM64: Improve code generated to spill/restore for slow paths.Alexandre Rames
Aligning the accesses allows generating better code. Before: add x16, sp, #0x44 (68) stp x0, x1, [x16, #-16] After: stp x0, x1, [sp, #56] Change-Id: I3e20ad3fa59d00aee4b4d14ea9d59c7cd546509e
2016-07-11Rename kCall to kCallOnMainOnlySerban Constantinescu
This patch renames kCall to kCallOnMainOnly in preparation for the next patch in this series which will be adding kCallOnMainAndSlowPath. Note: With this patch there will be places where we use kCallOnMainOnly even though we call on the slow path too. The next patch in this series will fix that. Test: ART host tests. Change-Id: Iabfdb0901990d163be5d780f3bdd2fab6fa17b32
2016-07-01Create a typedef for HInstruction::GetInputs() return type.Vladimir Marko
And some other cleanup after https://android-review.googlesource.com/230742 Test: No new tests. ART test suite passed (tested on host). Change-Id: I4743bf17544d0234c6ccb46dd0c1b9aae5c93e17