/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ENTRYPOINTS_GEN_H_ #define ENTRYPOINTS_GEN_H_ // Autogenerated file -- DO NOT EDIT! #include "macros.h" #include #include namespace panda { class Frame; class Method; class Class; class ObjectHeader; class Frame; namespace coretypes { class Array; class String; } // namespace coretypes using FileEntityId = uint32_t; } // namespace panda % require 'set' % entrypoints_map = Set.new % Compiler::entrypoints.each do |entrypoint| % next if entrypoint.external? % prefix = '"C"' % if entrypoint.has_bridge? && !entrypoints_map.include?(entrypoint.bridge_name) // NOLINTNEXTLINE(readability-named-parameter) extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.bridge_name %>(<%= entrypoint.signature[1..-1].join(', ') %>); % entrypoints_map.add(entrypoint.bridge_name) % end % if !entrypoint.properties.include?("intrinsic") && !entrypoints_map.include?(entrypoint.entrypoint) % if entrypoint.properties.include?("irtoc") #if defined(PANDA_TARGET_AMD64) && !defined(PANDA_COMPILER_TARGET_X86_64) // NOLINTNEXTLINE(readability-named-parameter) static constexpr <%= entrypoint.signature[0] %> (*<%= entrypoint.entrypoint %>)(<%= entrypoint.signature[1.. - 1].join(', ') %>) = nullptr; #else // NOLINTNEXTLINE(readability-named-parameter) extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>); #endif % else // NOLINTNEXTLINE(readability-named-parameter) extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>); % end % entrypoints_map.add(entrypoint.entrypoint) % end % end namespace panda { enum class EntrypointId : uint8_t { % Compiler::entrypoints.each_with_index do |entrypoint, index| <%= entrypoint.enum_name %> = <%= index %>, % end COUNT }; struct EntrypointsTable { % Compiler::entrypoints.each do |entrypoint| % if !entrypoint.has_bridge? % initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.entrypoint % else % initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.bridge_name % end // <%= entrypoint.enum_name %> <%= entrypoint.signature[0] %> (*p<%= entrypoint.name %>)(<%= entrypoint.signature[1..-1].join(', ') %>){<%= initialize_value %>}; % end }; } // namespace panda #endif // ENTRYPOINTS_GEN_H_