Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_SHARPENING_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_SHARPENING_H_ |
| 19 | |
Nicolas Geoffray | 83c8e27 | 2017-01-31 14:36:37 +0000 | [diff] [blame] | 20 | #include "nodes.h" |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 21 | #include "optimization.h" |
| 22 | |
Vladimir Marko | 0a51605 | 2019-10-14 13:00:44 +0000 | [diff] [blame] | 23 | namespace art { |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 24 | |
| 25 | class CodeGenerator; |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 26 | class DexCompilationUnit; |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 27 | |
Nicolas Geoffray | bdb2ecc | 2018-09-18 14:33:55 +0100 | [diff] [blame] | 28 | // Utility methods that try to improve the way we dispatch methods, and access |
| 29 | // types and strings. |
| 30 | class HSharpening { |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 31 | public: |
Nicolas Geoffray | bdb2ecc | 2018-09-18 14:33:55 +0100 | [diff] [blame] | 32 | // Used by the builder and InstructionSimplifier. |
Nicolas Geoffray | 8d34a18 | 2020-09-16 09:46:58 +0100 | [diff] [blame] | 33 | static HInvokeStaticOrDirect::DispatchInfo SharpenLoadMethod( |
Nicolas Geoffray | d5a8695 | 2021-01-19 10:35:54 +0000 | [diff] [blame] | 34 | ArtMethod* callee, |
| 35 | bool has_method_id, |
| 36 | bool for_interface_call, |
| 37 | CodeGenerator* codegen); |
Vladimir Marko | 28e012a | 2017-12-07 11:22:59 +0000 | [diff] [blame] | 38 | |
Nicolas Geoffray | 83c8e27 | 2017-01-31 14:36:37 +0000 | [diff] [blame] | 39 | // Used by the builder and the inliner. |
Nicolas Geoffray | c4aa82c | 2017-03-06 14:38:52 +0000 | [diff] [blame] | 40 | static HLoadClass::LoadKind ComputeLoadClassKind(HLoadClass* load_class, |
| 41 | CodeGenerator* codegen, |
Nicolas Geoffray | c4aa82c | 2017-03-06 14:38:52 +0000 | [diff] [blame] | 42 | const DexCompilationUnit& dex_compilation_unit) |
Vladimir Marko | 28e012a | 2017-12-07 11:22:59 +0000 | [diff] [blame] | 43 | REQUIRES_SHARED(Locks::mutator_lock_); |
Nicolas Geoffray | 5687634 | 2016-12-16 16:09:08 +0000 | [diff] [blame] | 44 | |
Vladimir Marko | 175e786 | 2018-03-27 09:03:13 +0000 | [diff] [blame] | 45 | // Used by the builder. |
| 46 | static TypeCheckKind ComputeTypeCheckKind(ObjPtr<mirror::Class> klass, |
| 47 | CodeGenerator* codegen, |
Vladimir Marko | 175e786 | 2018-03-27 09:03:13 +0000 | [diff] [blame] | 48 | bool needs_access_check) |
| 49 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 50 | |
| 51 | // Used by the builder. |
| 52 | static void ProcessLoadString(HLoadString* load_string, |
| 53 | CodeGenerator* codegen, |
Vladimir Marko | 175e786 | 2018-03-27 09:03:13 +0000 | [diff] [blame] | 54 | const DexCompilationUnit& dex_compilation_unit, |
| 55 | VariableSizedHandleScope* handles); |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace art |
| 59 | |
| 60 | #endif // ART_COMPILER_OPTIMIZING_SHARPENING_H_ |