summaryrefslogtreecommitdiff
path: root/compiler/optimizing
AgeCommit message (Collapse)Author
2022-12-07Allow inlining invokes that contain try catches into catch blocks Santiago Aboy Solanes
Since catch blocks are never considered try blocks, we can guarantee that its invokes are not inside a TryBoundary (which is the blocker for enabling inlining of try catch invokes inside try blocks). Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I747e2e8c2515e36041ad3966ca6a6388ef7d91df
2022-12-06Update domination chain and RPO manually in MaybeAddExtraGotoBlocks Santiago Aboy Solanes
There's no need to recompute the whole graph as we know what changed. As a drive-by, we now don't return false for graphs with irreducible loops so we can remove that restriction from the builder. However, if a graph with irreducible loops hits this path it means that: A) it's being inlined B) Has irreducible loops We don't inline graphs with irreducible loops, and after building for inline we don't remove them either because constant folding and instruction simplifier don't remove them, and DCE doesn't run for graphs with irreducible loops. So, in terms of dex2oat's outputs nothing should change. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I8cbf1b5f0518bb5dd14ffd751100ea81f5478863
2022-12-05Update CanTriggerGC flag for ArraySet Santiago Aboy Solanes
ArraySet instructions can trigger a GC only when perforing a type check. When clearing the needs type check flag, we should also clear the CanTriggerGC flag from the instruction's side effects. Note that once we clear the needs type check flag, we never set it again. Add check in graph checker that the needs type check and the can trigger GC flag are consistent. Add can_trigger_gc property to graph visualizer that reflects whether the ArraySet instruction can trigger a GC. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I4c74f902aabf2339bd292e9b24737f55d2737440
2022-11-30Change well known method `String.charAt()` to `ArtMethod*`. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Idb34c5de408b98db746d385ae6e012a8997fcc96
2022-11-29Move the try_start dump property to 'flags' Santiago Aboy Solanes
Fix our .cfgs crashing when being loaded in some visualizer tools. We can move try_start to the flags properties, since a block may be a catch block or a try block but never both. Test: Dump a cfg and load it with c1visualizer Change-Id: Ic3e025224087ce3d9180c169da8729a824b74d85
2022-11-29Update loop information correctly when removing tries Santiago Aboy Solanes
When removing tries we were relying on RemoveDeadBlocks to recompute the dominance and loop information. In some cases, the removed blocks are not part of the loop even though the removed try was part of a loop. In those cases, we have to update the loop information even when the deleted catch block is not part of a loop. In order to do that, we can add some parameters to RemoveDeadBlocks to force recomputation when we know it is needed. Bug: 252803203 Fixes: 252803203 Test: dex2oat compiling apps in the bug Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Id54edd0d16cedc6b95fc312e2018cd0dab82f0ae
2022-11-28Update domination tree when removing tries, if the catch doesn't exit Santiago Aboy Solanes
When eliminating the unnecessary try and its catch block we turn the TryBoundary instructions into Goto instructions. If one of these instructions is pointing to the exit block, we use its single predecessor instead. If this TryBoundary-turned-into-Goto instruction was the only one pointing to the Exit, we also have to update the dominators. Bug: 260387991 Fixes: 260387991 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: dex2oat compiling the app in the bug Change-Id: If05b60e81b2441c4c2235ffad7649813b98d3d69
2022-11-25Remove bogus check in CFRE. Nicolas Geoffray
An optimization pass could generate the pattern (NewInstance->NullCheck), for example dead block elimination. So remove the bogus check that this cannot be. Bug: 260336402 Test: 260336402 Change-Id: I5fd0a85477318eb17ee82e6ac922286df280231e
2022-11-23Mark TryBelongingInformation constructor as explicit Santiago Aboy Solanes
Single-parameter constructors should be marked explicit. Bug: 260204615 Fixes: 260204615 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I506df2295705b34b59361ec8ecc485a5f843596f
2022-11-23ART: Add two extra DCE passes Chris Jones
Add two DCE passes to eliminate dead instructions left by: - Loop optimization unrolling. After loop optimization, dead instructions are often left that, when removed can simplify the structure of the loop and remove basic blocks. This extra DCE pass creates an opportunity for the load store elimination pass to remove some loads/stores. - The last instruction simplification pass. Authors: Hari Limaye, Chris Jones Test: 458-checker-instruct-simplification Test: 530-checker-lse, 530-checker-lse-simd, 706-checker-scheduler Test: test-art-target, test-art-host Change-Id: I6e14cbfc3c320af5f507135a067bb7b5bc4df8f4
2022-11-23Remove tries which don't contain throwing instructions Santiago Aboy Solanes
If nothing can throw within a TryBoundary, we are safe to eliminate it. We were already doing this at the builder stage, but this CL takes care of subsequent passes (e.g. we might remove DivZeroCheck instructions which means that now we know we can't throw). Sometimes this means we are able to eliminate catch blocks which brings some code size improvements. Locally on a Pixel 5 compiling with `speed`: * AGSA -684K (0.2%) * services.jar -100K (0.2%) * SystemUIGoogle -88K (0.3%) Bug: 229249867 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I36d5880be99c1f1109c94266b1be583de8d6cf72
2022-11-21Accept comparison of instance-of with the constant 2 Santiago Aboy Solanes
We were assuming that the comparison of the result of an instance-of bytecode with an int constant would be only with 0 or 1. It potentially can be with any other int constant too. Bug: 252804549 Fixes: 252804549 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: dex2oatd compiling the apps in the bug Change-Id: Ia7d9352fb2074edfb2f74920f74a076f977e5dd4
2022-11-08Minor nterp improvements. Vladimir Marko
Do not resolve primitive field types for iput*, sput* before updating the interpreter cache. Introduce and use `ArtMethod::IsStringConstructor(), a convenience helper function where we avoid a read barrier for checking if the declaring class is the `String` class. Change one `CHECK_LE()` to `DCHECK_LE()`. Test: testrunner.py --host --interpreter Change-Id: I17b0409cee5321e0ca389f053da1f767d2913d08
2022-11-08Use ShouldDeoptimizeFlag to check if method exit hooks are needed Mythri Alle
When we want to execute a particular method in switch interrpeter we update the entry point of the method and we need to deopt any method invocations that are on the stack currently. All future invocations would use the correct entry point so we only need to check for a deopt for the methods that are currently on the stack. In the current implementation, we check a global flag to call method exit hooks (that checks if a deopt of caller is necessary) which means we call method exit hooks more often than necessary. This CL changes it so we use a bit on the ShouldDeoptimizeFlag and update the bit for all method invocations that are currently on the stack. We still have to call method exit hooks for any future invocations if method exit listeners are installed. So the JITed code is now updated to call method exit hooks if the stack slot indicates a deopt check is necessary or if method exit listeners are installed. This improves the performance of golem benchmarks by close to 8x bringing the performance close it what it was before adding a breakpoint. Bug: 253232638 Test: art/test.py Change-Id: Ic70a568c3099bc9df8d72f423b33b4f148209de9
2022-11-07Revert "Merge libart and libart-compiler into a single library" Dmitrii Ishcheikin
This reverts commit 2b7be1efa1ba363778057d4e42fccab8afe3046b. Reason for revert: broken build https://android-build.googleplex.com/builds/build-details/9263706/targets/full-eng Change-Id: I1afd96b314418bc435c029c764fd9e406d2ccefc
2022-11-07Merge libart and libart-compiler into a single library Dmitrii Ishcheikin
Rename old libart into libart-runtime Build libart-runtime and libart-compiler separately as static libraries This is required to support PGO (compiler) and AFDO (runtime) without mixing them Combine libart-runtime and libart-compiler into libart with whole-archive linking This change negates all size savings from libart-compiler version script, it will be restored in a follow-up CL Bug: 186902856 Test: m test-art-host-gtest Test: m libart libartd dex2oat dex2oatd oatdump oatdumps Test: art/build/apex/runtests.sh Test: art/tools/run-gtests.sh Test: art/test/testrunner/testrunner.py --target --64 Test: art/tools/run-libcore-tests.sh --mode=device --variant=X64 Test: art/tools/run-libjdwp-tests.sh --mode=device --variant=X64 Change-Id: I6b9717cf49007e77691d49a2dca18a8064749154
2022-11-07Reland "Make compiler/optimizing/ symbols hidden." VladimĂ­r Marko
This reverts commit 0a51605ddd81635135463dab08b6f7c21b58ffb0. Reason for revert: Reland after some of the required work was merged in other CLs. Also address a TODO from the original CL to mark required symbols with EXPORT in `intrinsic_objects.h`. Also mark symbols in new files as HIDDEN. Bug: 186902856 Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I936d448983928af23614ca82c2d0bf9a645e2c52
2022-11-04Cleanup: Use HBasicBlock's IsCatchBlock method Santiago Aboy Solanes
We were doing the same thing as that method does so just call it. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I5a80f0a8c536489f382b9149ccdc1b9f6b251ae3
2022-11-04Refine where stores are visible in LSE even more Santiago Aboy Solanes
In aosp/2219242 we allowed LSE to run in catch blocks but when setting the restrictions we were overly restrictive and we weren't allowing LSE to run in catches where we should have e.g. try { ... } catch (ArrayIndexOutOfBoundsException expected) { ... LSE can now run here for some instructions ... try { ... } catch (ArrayIndexOutOfBoundsException expectedToo) { ... } } If a catch block starts a try we would have something like Nop LoadException ClearException The `... LSE can now run here ...` instructions above TryBoundary kind:entry and it would have xhandlers. The instructions before the TryBoundary kind:entry are not considered to be part of a try and they behave like normal code would. As a note if code that looks like: try { try { ... } catch (ArrayIndexOutOfBoundsException expectedToo) { ... throwing instructions here ... } } catch (ArrayIndexOutOfBoundsException expected) { ... } the `throwing instructions here` will not be part of the catch block. Instead, we would have Nop LoadException ClearException TryBoundary kind:entry // Next block, within the TryBoundary and considered part of a try The `... throwing instructions here ...` instructions Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Bug: 227283233 Change-Id: I6b0cf66bc710a9009514f59076ae3ef0bbc287b7
2022-11-04Update method exit hooks from JITed code to not use Stack visitor Mythri Alle
Using NthCallerStackVisitor is expensive since that involves decoding method header and other tasks that are reasonably expensive especially when called on every method exit. When calling method exit hooks from JITed code a lot of this information like the frame_size, calling method are already known and can be directly passed to the method exit hook instead of computing them. Locally this change improves the performance by 70% on debuggable-cc config of golem benchmarks. Bug: 253232638 Test: art/test.py Change-Id: I3a1d80748c6d85e5fa1d3bd4aec0b29962ba0156
2022-11-02Don't inline methods whose basic blocks end with a throw Santiago Aboy Solanes
If the basic block will end up throwing, it is commonly not in the critical path. If we throw, we incur in a performance cost anyway so we can skip inlining those methods. Additionally, methods before a throw are sometimes construct information which is something we are not interested in inlining. Note that this CL doesn't stop inlining for methods that eventually always end with a throw. See the 2243- test for an example (testEndsWithThrowButNotDirectly). We could perform a more detailed analysis but that analysis will increase compile time so it is left as a further optimization if needed. Locally in a Pixel 5 with AOSP, code size improved: * AGSA: 15.3 MB (~4.6%) * System Server: 1.9 MB (~3.74%) * SysemUIGoogle: 0.88MB (~3.05%) Bug: 252884414 Bug: 256052088 Bug: 255984757 Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Id0b7894c0d63591e3b354520a47252bf8b91f44f
2022-10-27Revert old kMaximumNumberOfCumulatedDexRegisters heuristics Santiago Aboy Solanes
In aosp/2138475 we reduced kMaximumNumberOfCumulatedDexRegisters from 32 to 20. This CL reverts that as we had performance regressions. Bug: 227283224 Bug: 252884414 Bug: 252905038 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I0efa61c1c263101a0d3da3349a1c4c3d2508a52f
2022-10-24Allow LSA to run with acquire/release operations Santiago Aboy Solanes
LSA will run in graphs with acquire loads (i.e. monitor enter and volatile load) and release stores (i.e. monitor exit and volatile stores). Helps both LSE and the Scheduler, and brings code size and memory use reductions. For example, ~40KB (~0.1%) reduction in memory use when compiling android framework in armv8. Code size gains (locally run on Pixel 5 w/ AOSP): Android Google Search App (AGSA): 209KB System server: 44KB System UI: 20KB which is ~0.1% for each compile. Bug: 227283233 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I9ac79cf2324348414186f95e531c98b4215b28ea
2022-10-24Call method entry hooks only when we have method entry listeners Mythri Alle
We don't need to anything when there are no method entry listeners on method entry. So tighten the check so we call method entry hook only when method entry listeners are installed. Earlier, we used to call whenever the stack is instrumented or instrumentation stubs are installed. Drive by fix: remove unused constant from runtime.def Bug: 253232638 Test: art/test.py Change-Id: I6bdb4207804fd9c79fd7f21500c00b47e12beef3
2022-10-24Reland "Clean up `StackOverflowError` construction." Nicolas Geoffray
This reverts commit 3e1b1f8ff913d2fb811e3fe5714552fc98000d15. Bug: 253570082 Reason for revert: Not the culprit after all Change-Id: I5846fb3695880ffbf373858afae688c82f7a5c92
2022-10-21Revert "Clean up `StackOverflowError` construction." Nicolas Geoffray
This reverts commit 74d6f336810100563bc3b9e555dfd2aea1838b54. Bug: 253570082 Reason for revert: make those tests fail: test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-debuggable-redefine-stress-cdex-fast-1953-pop-frame64 test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-debuggable-redefine-stress-cdex-fast-1954-pop-frame-jit64 test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-debuggable-redefine-stress-cdex-fast-1955-pop-frame-jit-called64 test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-debuggable-redefine-stress-cdex-fast-1956-pop-frame-jit-calling64 test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-debuggable-redefine-stress-cdex-fast-1969-force-early-return-void64 Change-Id: Ie8d4d727119da531b9f802c6b29d4d101557f271
2022-10-21Clean up `StackOverflowError` construction. Vladimir Marko
Ensure that the required classes are initialized early. Also address a style issue - line too long. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --host --interpreter --no-image Bug: 253570082 Change-Id: I8f0c3db3eb1ffdc4fca5dd6467c293c9a0d71d4e
2022-10-21Change well known boxing methods to `ArtMethod*`. Vladimir Marko
And make `ClassLinker::RunRootClinits()` responsible for the initialization of primitive boxing classes. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --host --interpreter --no-image Bug: 253570082 Change-Id: Ia000113d53eb60518a137547684df28a0c788997
2022-10-18Remove unused codes in TryReplaceStringBuilderAppend Victor Chang
StringBuilder should no longer be inlined, and thus the codes looking for inlined StringBuilder codes can be removed. Bug: 247773125 Test: art/test/testrunner/testrunner.py --host -t 697 Change-Id: I67a9477b757aa2dac5dcefaf3668cf56bfebb0fb
2022-10-13Update MaybeAddExtraGotoBlocks to bail for irreducible loops Santiago Aboy Solanes
We may have graphs with irreducible loops at this point and recomputing the loop information is not supported. Bug: 253242440 Test: dex2oat compiling the apps in the bug Change-Id: I181b4fb9d9812ba2f14cd21602cf0e5a4e1fd18e
2022-10-10Don't mark speculatively failed inlines as always throws Santiago Aboy Solanes
If we don't inline an always throwing invoke through inline caches, don't mark it as 'always throwing' since it may not always throw in other instances. Bug: 241199625 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I4cb7edaa4716bd1722fba2bef39f31903bf9238e
2022-10-10Compiler implementation of try catch inlining Santiago Aboy Solanes
Notable changes: 1) Wiring of the graph now allows for inlinees graph ending in TryBoundary, or Goto in some special cases. 2) Building a graph with try catch for inlining may add an extra Goto block. 3) Oat version bump. 4) Reduced kMaximumNumberOfCumulatedDexRegisters from 32 to 20. Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ic2fd956de24b72d1de29b4cd3d0b2a1ddab231d8
2022-10-10ART: Move `CompiledMethod{,-Storage}` to dex2oat/. Vladimir Marko
Introduce a `CompiledCodeStorage` interface for callbacks to `dex2oat` for storing code produced by `libart-compiler`. Using this new interface, move `CompiledMethodStorage` (this is a misnomer as it's also storing non-method thunk code), `CompiledMethod` and `SwapSpace` to dex2oat/. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Change-Id: Icb7ffc134d00e53c25bd665d044dd1c98bd49a64
2022-10-07Runtime implementation of try catch inlining Santiago Aboy Solanes
The main differences in the runtime are: 1) We now use a list of dex_pcs to find the correct catch handler instead of a single dex pc 2) We now need to restore vregs of the whole frame, which may be an inline frame. Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I95d2f32088e1d420c83962a1693be18f3b63f8b4
2022-10-06Remove `CompiledCode::CodePointer()`. Vladimir Marko
And clean up some related test helpers in preparation for moving `CompiledMethod` to dex2oat/. Test: m test-art-host-gtest Test: run-gtests.sh Change-Id: I13b42bfb4f6ee3a7f7f22bbc8d22203c5d56e00b
2022-10-05Add compiler support for @NeverInline Santiago Aboy Solanes
This change sets methods as not inlineable if they are annotated with @NeverInline. This is done by adding a new method in dex_file_annotations.h that checks if a method is annotated, similar to @NeverCompile. Bug: 246530973 Change-Id: I5851fd85367f49d7af3201a7a3ef766f669401e9
2022-10-04Use ArtMethod::GetImtIndex to avoid recomputing the imt index. Nicolas Geoffray
Small inefficiency spotted when investigating b/249522283. Test: test.py Bug: 249522283 Change-Id: I96f7a141b2e3ad6669760e2f784a093ce58c277f
2022-10-03Refactor Thumb2 entrypoint adjustment handling. Vladimir Marko
Reduce dependencies on `compiled_method.h` in preparation for moving it to dex2oat/. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing Change-Id: I55ff807e0c7d729142b1a64a3a0b6c6267027dc3
2022-09-29Make callee-saved registers behave according to kReserveMarkingRegister Lokesh Gidra
We were mistakenly blocking the marking register and refreshing it, but didn't remove it from callee-saved registers list when CC GC is not being used, leading to crashes. Test: art/test/testrnunner/testrunner.py --target --32 --jit Change-Id: I33e18c900042fd1dfb1f75512868c895fd83c1e1
2022-09-29Refine where stores are visible in LSE Santiago Aboy Solanes
Code in catch blocks behaves as regular code, as long as it is not inside of an outer try. Bug: 227283233 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I8334a4716429bc743ae1c552f5d8d09b10d9e0e2
2022-09-26ART: Rename 'final' DCE pass to 'after_bce' Hari Limaye
This change renames the 'dead_code_elimination$final' pass of the OptimizingCompiler to 'dead_code_elimination$after_bce', as the addition of another DCE pass later in the pipeline will make 'final' an erroneous qualifier. Test: test_art_target, test_art_host Change-Id: I1379ba8219d7d677faba82a95d1a1c2ae5dbb832
2022-09-15Reserve marking register for all GCs Lokesh Gidra
Nterp relies on marking register to know if GC is happening. This is why from the beginning nterp was enabled only if kUseReadBarrier was true. Now, with userfaultfd GC merged in, this requirement hasn't changed. But since userfaultfd GC is able to run even when marking register is reserved, we allow nterp to be used with it. However, if at build time read-barrier was disabled (using ART_USE_READ_BARRIER=false), then there is no way to use nterp. This CL fixes this situation by reserving marking register (and refreshing it) for every GC configuration. This CL also puts back logic that was earlier taken away in the userfaultfd GC to allow SS and CMS GCs to be used. Test: ART_DEFAULT_GC_TYPE=SS ART_USE_READ_BARRIER=false art/test/testrunner/testrunner.py --host --debug -bv Test: Golem Bug: 244737154 Change-Id: Ief336b9f39156571b7cd98d3d7f997eb82cd14c3
2022-09-14Add a IsInitialized check in AOT code with clinit at entry checks. Nicolas Geoffray
The investigations behind https://android-review.googlesource.com/c/platform/art/+/2214701 showed that it can take some time for a class to become visibly initialized. To avoid a busy loop between the AOT code and the resolution trampoline, we also add a isInitialized check, which if true will be followed by a memory barrier and the execution of the compiled code. Test: test.py Bug: 162110941 Change-Id: I6c36cde6ebd12b1f81281eb8a684b496f266e3ea
2022-09-09Remove restriction of different Phi values in SelectGenerator Santiago Aboy Solanes
The restriction was blocking select generation and there's no good reason to have it. Also took the opportunity to create a robust test suite for select generation. Bug: 245535393 Test: dex2oat compiling the app in the bug Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I4d520a0210179ffa05c4536b3936bc3a67990935
2022-09-08Reland "Add an environment to the beginning of catch blocks" Santiago Aboy Solanes
This reverts commit 37fe26288aaacae0f26873131dd92704796e09ec. Reason for revert: Pattern match fix Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b --debuggable 565-checker-condition-liveness (also for --target) Change-Id: Iaf784c12fb6229df6cfbd9a1b43467f5ed43c4d4
2022-09-07Remove TryRemovingNullCheck from LSE Santiago Aboy Solanes
TryRemovingNullCheck would remove null checks right before eliminated loads. However, it was doing it without really checking if the object it was loading from was null or not. This has been there since the first iteration of LSE, and my guess why it was implemented it was to remove NullChecks with no uses (i.e. it was assuming that the NullCheck was only uses by the load which was being eliminated). Bug: 243136201 Test: Ran ART benchmark automator and saw no increase in code size Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I96be9650f8b16fee7fcca114b9b330d4f3b7e0b4
2022-09-06Revert "Add an environment to the beginning of catch blocks" Santiago Aboy Solanes
This reverts commit f976aa822dd35496e4e936b5802af0d53d39ac95. Reason for revert: breaking some tests https://ci.chromium.org/ui/p/art/builders/ci/angler-armv8-ndebug/3244/blamelist Change-Id: I5c2732e81bef8a7e83b661b1b947d7c079994c1b
2022-09-06Add an environment to the beginning of catch blocks Santiago Aboy Solanes
We can use the HNop to generate an environment for us and start using the existing environment infrastructure (e.g. EmitEnvironment) for recording the catch block's environment. This is done to provide support for try catch inlining since it requires several environments rather than just the one. When doing so, we now have a HNop at the beginning of each catch block. We have to modify code sinking to allow it to sink code past this HNop because if we don't we will sink code right before this instruction which will break the invariant of that HNop being the first instruction of a catch block. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I16e7b8cad499fd2d6f7415112b46206db8daf544
2022-09-06Correctly delete all uses when building up the domination graph Santiago Aboy Solanes
We now consider the edge case where the dead instruction we wanted to remove was used in a phi which is not directly following the block we are processing right now. To fix this, we process all blocks before trying to remove the instructions. As a note, we remove catch phi uses right before removing the instruction as they are related to the instruction itself and not the block hierarchy. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: dex2oat compiling locally the apps mentioned in the bug Bug: 239519319 Change-Id: I70d47891203ae118851a1f20a7cee21de305cd61
2022-09-02Remove instructions from dead blocks when building the dominator tree Santiago Aboy Solanes
We now remove the instructions to free up memory. We have to refactor methods a little bit to avoid removing instructions as users twice, since we do not support that. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ia34c4a6af204952d295e5a2cb534115ced97ab07