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 16#ifndef NDEBUG 17 18#include "runtime/interpreter/interpreter_impl.h" 19 20#include "libpandabase/macros.h" 21#include "runtime/interpreter/interpreter-inl.h" 22#include "runtime/interpreter/runtime_interface.h" 23#include "irtoc_interpreter_utils.h" 24 25namespace ark::interpreter { 26 27// NOLINTBEGIN(readability-identifier-naming) 28// Tests functions for CSA. 29 30% Panda::instructions.each do |i| 31% namespace = i.namespace == 'core' ? '' : "#{i.namespace}::" 32% if i.namespace != 'core' 33#ifdef PANDA_WITH_<%= i.namespace.upcase %> 34 35% end 36% mnemonic = i.mnemonic.split('.').map { |p| p == '64' ? 'Wide' : p.capitalize }.join 37void CSA_BUILD_ANALYZE_ONLY_DO_NOT_CALL_DYNAMIC_<%= i.handler_name %>(ManagedThread *thread, const uint8_t *pc, Frame *frame, const void *const *dispatch_table) { 38 InstructionHandlerState state(thread, pc, frame, dispatch_table); 39 <%= namespace %>InstructionHandler<RuntimeInterface, true> handler(&state); 40 handler.template Handle<%= mnemonic %><BytecodeInstruction::Format::<%= i.format.pretty.upcase %>>(); 41} 42 43void CSA_BUILD_ANALYZE_ONLY_DO_NOT_CALL_STATIC_<%= i.handler_name %>(ManagedThread *thread, const uint8_t *pc, Frame *frame, const void *const *dispatch_table) { 44 InstructionHandlerState state(thread, pc, frame, dispatch_table); 45 <%= namespace %>InstructionHandler<RuntimeInterface, false> handler(&state); 46 handler.template Handle<%= mnemonic %><BytecodeInstruction::Format::<%= i.format.pretty.upcase %>>(); 47} 48% if i.namespace != 'core' 49 50#endif // PANDA_WITH_<%= i.namespace.upcase %> 51% end 52 53% end 54 55// NOLINTEND(readability-identifier-naming) 56 57} // namespace ark::interpreter 58 59#endif // NDEBUG 60 61