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// Generate macro for each intrinsic - bridge name, function name, parameters count: 17// ENTRYPOINT PowF64Bridge, PowF64, 2 18 19% Compiler::intrinsics.select(&:has_impl?).uniq { |intrn| intrn.impl + ", " + intrn.impl_signature.args.count.to_s + ";;" + intrn.private.to_s} 20% .each do |intrn| 21% if intrn.private 22#ifndef PANDA_PRODUCT_BUILD 23% end 24% implementation = intrn.impl.rpartition("::").last 25// Default intrinsic implementation with runtime_call which is called by Codegen::CallIntrinsic 26ENTRYPOINT <%= implementation %>Bridge, <%= implementation %>, <%= intrn.impl_signature.args.count.to_s %>, <%= ((intrn.impl_signature.ret == "void") ? 1 : 0) %> 27// Default implementation for virtually called intrinsics from compiled frame 28ENTRYPOINT <%= implementation %>CompiledAbiBridge, <%= implementation %>CompiledAbi, <%= (intrn.impl_signature.args.count + 1).to_s %>, <%= ((intrn.impl_signature.ret == "void") ? 1 : 0) %> 29// Depending on frame kind choose either CompiledAbiBridge (for compiled frame) or CompiledAbi (for interpreted frame) for virtual intrinsic 30BRIDGE_SELECTOR <%= implementation %>BridgeSelectorEntryPoint, <%= implementation %>CompiledAbi, <%= implementation %>CompiledAbiBridge 31#ifndef NDEBUG 32% implementation = intrn.fast_path if intrn.respond_to?(:fast_path) 33% if intrn.respond_to?(:fast_path) 34#if defined(PANDA_TARGET_AMD64) && !defined(PANDA_COMPILER_TARGET_X86_64) 35RUNTIME_CALL_CHECKER <%= intrn.impl.rpartition("::").last %>RuntimeCallChecker, <%= intrn.impl.rpartition("::").last %> 36#else 37% end 38RUNTIME_CALL_CHECKER <%= implementation %>RuntimeCallChecker, <%= implementation %> 39% if intrn.respond_to?(:fast_path) 40#endif 41% end 42#endif 43 44% if intrn.private 45#endif // PANDA_PRODUCT_BUILD 46% end 47% end 48