1 /** 2 * Copyright (c) 2021-2022 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_DEOPTIMIZATION_H 16 #define PANDA_DEOPTIMIZATION_H 17 18 #include "runtime/include/exceptions.h" 19 #include "runtime/include/stack_walker.h" 20 21 namespace panda { 22 23 /** 24 * \brief Deoptimize compiled frame 25 * @param stack Frame to be deoptimized. Must be CFrame (compiled frame). 26 * @param pc PC from which interpreter starts execution, if nullptr, pc is got from deoptimized CFrame. 27 * @param has_exception we use exception from current thread 28 */ 29 [[noreturn]] void Deoptimize(StackWalker *stack, const uint8_t *pc, bool has_exception = false, 30 bool destroy_compiled_code = false); 31 32 /** 33 * \brief Drop given CFrame and return to its caller. 34 * @param stack Frame to be dropped. Must be CFrame. 35 */ 36 [[noreturn]] void DropCompiledFrame(StackWalker *stack); 37 38 void InvalidateCompiledEntryPoint(const PandaSet<Method *> &methods, bool is_cha); 39 40 } // namespace panda 41 42 #endif // PANDA_DEOPTIMIZATION_H 43