• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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 ark {
26
27class Frame;
28class Method;
29class Class;
30class ObjectHeader;
31class Frame;
32
33namespace coretypes {
34class Array;
35class String;
36}  // namespace coretypes
37
38namespace mem {
39class Reference;
40} // namespace mem
41
42using FileEntityId = uint32_t;
43
44}  // namespace ark
45
46% require 'set'
47% entrypoints_map = Set.new
48% Compiler::entrypoints.each do |entrypoint|
49%   next if entrypoint.external?
50%   prefix = '"C"'
51%   if entrypoint.has_bridge? && !entrypoints_map.include?(entrypoint.bridge_name)
52// NOLINTNEXTLINE(readability-named-parameter)
53extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.bridge_name %>(<%= entrypoint.signature[1..-1].join(', ') %>);
54%     entrypoints_map.add(entrypoint.bridge_name)
55%   end
56%   if !entrypoint.properties.include?("intrinsic") && !entrypoints_map.include?(entrypoint.entrypoint)
57%     if entrypoint.properties.include?("irtoc")
58#if !defined(PANDA_WITH_IRTOC) || defined(PANDA_TARGET_AMD64) && !defined(PANDA_COMPILER_TARGET_X86_64)
59// NOLINTNEXTLINE(readability-identifier-naming)
60static constexpr <%= entrypoint.signature[0] %> (*<%= entrypoint.entrypoint %>)(<%= entrypoint.signature[1.. - 1].join(', ') %>) = nullptr;
61#else
62// NOLINTNEXTLINE(readability-named-parameter)
63extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>);
64#endif
65%     else
66// NOLINTNEXTLINE(readability-named-parameter)
67extern <%= prefix %> <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint %>(<%= entrypoint.signature[1.. - 1].join(', ') %>);
68%     end
69%     entrypoints_map.add(entrypoint.entrypoint)
70%   end
71% end
72
73namespace ark {
74
75enum class EntrypointId : uint32_t {
76% Compiler::entrypoints.each_with_index do |entrypoint, index|
77    <%= entrypoint.enum_name %> = <%= index %>,
78% end
79    COUNT,
80    INVALID = COUNT
81};
82
83// NOLINTBEGIN(readability-identifier-naming)
84struct EntrypointsTable {
85% Compiler::entrypoints.each do |entrypoint|
86%   if !entrypoint.has_bridge?
87%     initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.entrypoint
88%   else
89%     initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.bridge_name
90%   end
91    // <%= entrypoint.enum_name %>
92    <%= entrypoint.signature[0] %> (*p<%= entrypoint.name %>)(<%= entrypoint.signature[1..-1].join(', ') %>){<%= initialize_value %>};
93% end
94};
95// NOLINTEND(readability-identifier-naming)
96
97}  // namespace ark
98
99#endif  // ENTRYPOINTS_GEN_H_
100