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 #include "plugins/ets/runtime/types/ets_object.h" 17 #include "plugins/ets/runtime/ets_coroutine.h" 18 19 namespace ark::ets { 20 21 /* static */ Create(EtsCoroutine * etsCoroutine,EtsClass * klass)22EtsObject *EtsObject::Create(EtsCoroutine *etsCoroutine, EtsClass *klass) 23 { 24 ASSERT_HAVE_ACCESS_TO_MANAGED_OBJECTS(); 25 return static_cast<EtsObject *>(ObjectHeader::Create(etsCoroutine, klass->GetRuntimeClass())); 26 } 27 28 /* static */ Create(EtsClass * klass)29EtsObject *EtsObject::Create(EtsClass *klass) 30 { 31 return Create(EtsCoroutine::GetCurrent(), klass); 32 } 33 34 /* static */ CreateNonMovable(EtsClass * klass)35EtsObject *EtsObject::CreateNonMovable(EtsClass *klass) 36 { 37 return static_cast<EtsObject *>(ObjectHeader::CreateNonMovable(klass->GetRuntimeClass())); 38 } 39 40 } // namespace ark::ets 41