1 /** 2 * Copyright (c) 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 #ifndef PANDA_RUNTIME_ETS_RUNTIME_INTERFACE_H 16 #define PANDA_RUNTIME_ETS_RUNTIME_INTERFACE_H 17 18 #include "runtime/compiler.h" 19 #include "cross_values.h" 20 #include "plugins/ets/runtime/ets_vm.h" 21 namespace panda::ets { 22 23 class EtsRuntimeInterface : public PandaRuntimeInterface { 24 public: 25 // Object information 26 ClassPtr GetClass(MethodPtr method, IdType id) const override; GetTlsPromiseClassPointerOffset(Arch arch)27 size_t GetTlsPromiseClassPointerOffset(Arch arch) const override 28 { 29 return panda::cross_values::GetEtsCoroutinePromiseClassOffset(arch); 30 } GetTlsUndefinedObjectOffset(Arch arch)31 size_t GetTlsUndefinedObjectOffset(Arch arch) const override 32 { 33 return panda::cross_values::GetEtsCoroutineUndefinedObjectOffset(arch); 34 } 35 uint64_t GetUndefinedObject() const override; 36 InteropCallKind GetInteropCallKind(MethodPtr methodPtr) const override; 37 char *GetFuncPropName(MethodPtr methodPtr, uint32_t strId) const override; 38 uint64_t GetFuncPropNameOffset(MethodPtr methodPtr, uint32_t strId) const override; 39 bool IsMethodStringBuilderConstructorWithStringArg(MethodPtr method) const override; 40 bool IsMethodStringBuilderToString(MethodPtr method) const override; 41 bool IsIntrinsicStringBuilderToString(IntrinsicId id) const override; 42 43 FieldPtr ResolveLookUpField(FieldPtr rawField, ClassPtr klass) override; 44 MethodPtr ResolveLookUpCall(FieldPtr rawField, ClassPtr klass, bool isSetter) override; 45 46 template <panda_file::Type::TypeId FIELD_TYPE> 47 compiler::RuntimeInterface::MethodPtr GetLookUpCall(FieldPtr rawField, ClassPtr klass, bool isSetter); 48 49 #ifdef PANDA_ETS_INTEROP_JS 50 #include "plugins/ets/runtime/interop_js/ets_interop_runtime_interface-inl.h" 51 #endif 52 }; 53 } // namespace panda::ets 54 55 #endif // PANDA_RUNTIME_ETS_RUNTIME_INTERFACE_H 56