1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2023 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker #ifndef ART_COMPILER_OPTIMIZING_PROFILING_INFO_BUILDER_H_ 18*795d594fSAndroid Build Coastguard Worker #define ART_COMPILER_OPTIMIZING_PROFILING_INFO_BUILDER_H_ 19*795d594fSAndroid Build Coastguard Worker 20*795d594fSAndroid Build Coastguard Worker #include "base/macros.h" 21*795d594fSAndroid Build Coastguard Worker #include "nodes.h" 22*795d594fSAndroid Build Coastguard Worker 23*795d594fSAndroid Build Coastguard Worker namespace art HIDDEN { 24*795d594fSAndroid Build Coastguard Worker 25*795d594fSAndroid Build Coastguard Worker class CodeGenerator; 26*795d594fSAndroid Build Coastguard Worker class CompilerOptions; 27*795d594fSAndroid Build Coastguard Worker class HInliner; 28*795d594fSAndroid Build Coastguard Worker class InlineCache; 29*795d594fSAndroid Build Coastguard Worker class ProfilingInfo; 30*795d594fSAndroid Build Coastguard Worker 31*795d594fSAndroid Build Coastguard Worker class ProfilingInfoBuilder final : public HGraphDelegateVisitor { 32*795d594fSAndroid Build Coastguard Worker public: 33*795d594fSAndroid Build Coastguard Worker ProfilingInfoBuilder(HGraph* graph, 34*795d594fSAndroid Build Coastguard Worker const CompilerOptions& compiler_options, 35*795d594fSAndroid Build Coastguard Worker CodeGenerator* codegen, 36*795d594fSAndroid Build Coastguard Worker OptimizingCompilerStats* stats = nullptr) HGraphDelegateVisitor(graph,stats)37*795d594fSAndroid Build Coastguard Worker : HGraphDelegateVisitor(graph, stats), 38*795d594fSAndroid Build Coastguard Worker codegen_(codegen), 39*795d594fSAndroid Build Coastguard Worker compiler_options_(compiler_options) {} 40*795d594fSAndroid Build Coastguard Worker 41*795d594fSAndroid Build Coastguard Worker void Run(); 42*795d594fSAndroid Build Coastguard Worker 43*795d594fSAndroid Build Coastguard Worker static constexpr const char* kProfilingInfoBuilderPassName = 44*795d594fSAndroid Build Coastguard Worker "profiling_info_builder"; 45*795d594fSAndroid Build Coastguard Worker 46*795d594fSAndroid Build Coastguard Worker static InlineCache* GetInlineCache(ProfilingInfo* info, 47*795d594fSAndroid Build Coastguard Worker const CompilerOptions& compiler_options, 48*795d594fSAndroid Build Coastguard Worker HInvoke* invoke); 49*795d594fSAndroid Build Coastguard Worker static bool IsInlineCacheUseful(HInvoke* invoke, CodeGenerator* codegen); 50*795d594fSAndroid Build Coastguard Worker static uint32_t EncodeInlinedDexPc( 51*795d594fSAndroid Build Coastguard Worker const HInliner* inliner, const CompilerOptions& compiler_options, HInvoke* invoke) 52*795d594fSAndroid Build Coastguard Worker REQUIRES_SHARED(Locks::mutator_lock_); 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker private: 55*795d594fSAndroid Build Coastguard Worker void VisitInvokeVirtual(HInvokeVirtual* invoke) override; 56*795d594fSAndroid Build Coastguard Worker void VisitInvokeInterface(HInvokeInterface* invoke) override; 57*795d594fSAndroid Build Coastguard Worker 58*795d594fSAndroid Build Coastguard Worker void HandleInvoke(HInvoke* invoke); 59*795d594fSAndroid Build Coastguard Worker 60*795d594fSAndroid Build Coastguard Worker CodeGenerator* codegen_; 61*795d594fSAndroid Build Coastguard Worker const CompilerOptions& compiler_options_; 62*795d594fSAndroid Build Coastguard Worker std::vector<uint32_t> inline_caches_; 63*795d594fSAndroid Build Coastguard Worker 64*795d594fSAndroid Build Coastguard Worker DISALLOW_COPY_AND_ASSIGN(ProfilingInfoBuilder); 65*795d594fSAndroid Build Coastguard Worker }; 66*795d594fSAndroid Build Coastguard Worker 67*795d594fSAndroid Build Coastguard Worker } // namespace art 68*795d594fSAndroid Build Coastguard Worker 69*795d594fSAndroid Build Coastguard Worker 70*795d594fSAndroid Build Coastguard Worker #endif // ART_COMPILER_OPTIMIZING_PROFILING_INFO_BUILDER_H_ 71