1 /** 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef PANDA_RUNTIME_COMPILER_QUEUE_H_ 16 #define PANDA_RUNTIME_COMPILER_QUEUE_H_ 17 18 #include "runtime/include/compiler_interface-inl.h" 19 #include "runtime/include/method-inl.h" 20 #include "runtime/thread_pool_queue.h" 21 22 namespace ark { 23 24 class Method; 25 26 class CompilerQueueInterface : public TaskQueueInterface<CompilerTask> { 27 protected: GetTaskDescription(const CompilerTask & ctx)28 PandaString GetTaskDescription(const CompilerTask &ctx) 29 { 30 PandaOStringStream stream; 31 // Empty ctx element may only returned if the queue is empty, it must not be stored into the queue 32 ASSERT(ctx.GetMethod() != nullptr); 33 auto name = reinterpret_cast<const char *>(ctx.GetMethod()->GetName().data); 34 stream << "(method: " << name << ", is_osr: " << std::dec << ctx.IsOsr() 35 << ", hotness counter: " << ctx.GetMethod()->GetHotnessCounter() << ")"; 36 return stream.str(); 37 } 38 }; 39 40 } // namespace ark 41 42 #endif // PANDA_RUNTIME_COMPILER_QUEUE_H_ 43