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 16#ifndef ENTRYPOINTS_GEN_H_ 17#define ENTRYPOINTS_GEN_H_ 18 19// Autogenerated file -- DO NOT EDIT! 20 21#include "macros.h" 22#include <cstdint> 23#include <functional> 24 25namespace panda { 26 27class Frame; 28class Method; 29class Class; 30class ObjectHeader; 31class Frame; 32 33namespace coretypes { 34class Array; 35class String; 36} // namespace coretypes 37 38using FileEntityId = uint32_t; 39 40} // namespace panda 41 42% require 'set' 43% entrypoints_map = Set.new 44% Compiler::entrypoints.each do |entrypoint| 45% next if entrypoint.external? 46% prefix = '"C"' 47% if entrypoint.has_bridge? && !entrypoints_map.include?(entrypoint.bridge_name) 48// NOLINTNEXTLINE(readability-named-parameter) 49extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.bridge_name %>(<%= entrypoint.signature[1..-1].join(', ') %>); 50% entrypoints_map.add(entrypoint.bridge_name) 51% end 52% if !entrypoint.properties.include?("intrinsic") && !entrypoints_map.include?(entrypoint.entrypoint) 53% if entrypoint.properties.include?("irtoc") 54#if defined(PANDA_TARGET_AMD64) && !defined(PANDA_COMPILER_TARGET_X86_64) 55// NOLINTNEXTLINE(readability-named-parameter) 56static constexpr <%= entrypoint.signature[0] %> (*<%= entrypoint.entrypoint %>)(<%= entrypoint.signature[1.. - 1].join(', ') %>) = nullptr; 57#else 58// NOLINTNEXTLINE(readability-named-parameter) 59extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>); 60#endif 61% else 62// NOLINTNEXTLINE(readability-named-parameter) 63extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>); 64% end 65% entrypoints_map.add(entrypoint.entrypoint) 66% end 67% end 68 69namespace panda { 70 71enum class EntrypointId : uint8_t { 72% Compiler::entrypoints.each_with_index do |entrypoint, index| 73 <%= entrypoint.enum_name %> = <%= index %>, 74% end 75 COUNT 76}; 77 78struct EntrypointsTable { 79% Compiler::entrypoints.each do |entrypoint| 80% if !entrypoint.has_bridge? 81% initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.entrypoint 82% else 83% initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.bridge_name 84% end 85 // <%= entrypoint.enum_name %> 86 <%= entrypoint.signature[0] %> (*p<%= entrypoint.name %>)(<%= entrypoint.signature[1..-1].join(', ') %>){<%= initialize_value %>}; 87% end 88}; 89 90} // namespace panda 91 92#endif // ENTRYPOINTS_GEN_H_ 93