1 /** 2 * Copyright (c) 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 #ifndef PANDA_RUNTIME_VTABLE_BUILDER_STANDARD_H 16 #define PANDA_RUNTIME_VTABLE_BUILDER_STANDARD_H 17 18 #include "runtime/include/vtable_builder_base.h" 19 20 namespace ark { 21 22 struct VTableProtoIdentical { operatorVTableProtoIdentical23 bool operator()(const Method::ProtoId &base, const Method::ProtoId &derv) const 24 { 25 return base == derv; 26 } 27 }; 28 29 template <class OverridePred> 30 class StandardVTableBuilder final : public VTableBuilderBase<true> { 31 public: StandardVTableBuilder(ClassLinkerErrorHandler * errHandler)32 explicit StandardVTableBuilder(ClassLinkerErrorHandler *errHandler) : VTableBuilderBase(errHandler) {} 33 34 private: 35 [[nodiscard]] bool ProcessClassMethod(const MethodInfo *info) override; 36 [[nodiscard]] bool ProcessDefaultMethod(ITable itable, size_t itableIdx, MethodInfo *methodInfo) override; 37 38 std::optional<MethodInfo const *> ScanConflictingDefaultMethods(const MethodInfo *info); 39 40 static bool IsOverriddenBy(Method::ProtoId const &base, Method::ProtoId const &derv); 41 42 static bool IsMaxSpecificInterfaceMethod(const Class *iface, const Method &method, size_t startindex, 43 const ITable &itable); 44 }; 45 46 } // namespace ark 47 48 #endif // PANDA_RUNTIME_VTABLE_BUILDER_STANDARD_H 49