1 /** 2 * Copyright (c) 2025 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 PANDA_PLUGINS_ETS_RUNTIME_TYPES_ETS_ABC_RUNTIME_LINKER_H 17 #define PANDA_PLUGINS_ETS_RUNTIME_TYPES_ETS_ABC_RUNTIME_LINKER_H 18 19 #include "include/object_accessor.h" 20 #include "include/object_header.h" 21 #include "mem/object_pointer.h" 22 #include "plugins/ets/runtime/types/ets_array.h" 23 #include "plugins/ets/runtime/types/ets_object.h" 24 #include "plugins/ets/runtime/types/ets_runtime_linker.h" 25 26 namespace ark::ets { 27 28 namespace test { 29 class EtsAbcRuntimeLinkerTest; 30 } // namespace test 31 32 class EtsAbcRuntimeLinker : public EtsRuntimeLinker { 33 public: 34 EtsAbcRuntimeLinker() = delete; 35 ~EtsAbcRuntimeLinker() = delete; 36 37 NO_COPY_SEMANTIC(EtsAbcRuntimeLinker); 38 NO_MOVE_SEMANTIC(EtsAbcRuntimeLinker); 39 FromEtsObject(EtsObject * obj)40 static EtsAbcRuntimeLinker *FromEtsObject(EtsObject *obj) 41 { 42 return reinterpret_cast<EtsAbcRuntimeLinker *>(obj); 43 } 44 AsObject()45 EtsObject *AsObject() 46 { 47 return this; 48 } 49 GetAbcFiles()50 EtsObjectArray *GetAbcFiles() 51 { 52 return EtsObjectArray::FromCoreType( 53 ObjectAccessor::GetObject(this, MEMBER_OFFSET(EtsAbcRuntimeLinker, abcFiles_))); 54 } 55 SetAbcFiles(EtsObjectArray * abcFiles)56 void SetAbcFiles(EtsObjectArray *abcFiles) 57 { 58 ObjectAccessor::SetObject(this, MEMBER_OFFSET(EtsAbcRuntimeLinker, abcFiles_), abcFiles->GetCoreType()); 59 } 60 GetParentLinker()61 EtsRuntimeLinker *GetParentLinker() 62 { 63 return EtsRuntimeLinker::FromCoreType( 64 ObjectAccessor::GetObject(this, MEMBER_OFFSET(EtsAbcRuntimeLinker, parentLinker_))); 65 } 66 67 private: 68 // ets.AbcRuntimeLinker fields BEGIN 69 ObjectPointer<EtsObject> parentLinker_; 70 ObjectPointer<EtsObjectArray> abcFiles_; 71 // ets.AbcRuntimeLinker fields END 72 73 friend class test::EtsAbcRuntimeLinkerTest; 74 }; 75 76 } // namespace ark::ets 77 78 #endif // PANDA_PLUGINS_ETS_RUNTIME_TYPES_ETS_ABC_RUNTIME_LINKER_H 79