1 /* 2 * Copyright (c) 2021 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_RUNTIME_OBJECT_ACCESSOR_IMPL_CPP_ 17 #define PANDA_RUNTIME_OBJECT_ACCESSOR_IMPL_CPP_ 18 // This file is included by interpreter to inline methods that defined in it. 19 // We don't move them to object_accessor-inl.h because including runtime.h 20 // will lead to circular header dependencies. 21 22 #include "runtime/include/object_accessor-inl.h" 23 #include "runtime/include/runtime.h" 24 #include "runtime/include/panda_vm.h" 25 26 namespace panda { 27 28 /* static */ 29 #ifndef PANDA_RUNTIME_OBJECT_ACCESSOR_CPP_ 30 inline 31 #endif 32 // CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION__RETURNTYPE_QUALIFIER_NAME_ONELINE) 33 mem::GCBarrierSet * GetBarrierSet()34 ObjectAccessor::GetBarrierSet() 35 { 36 return Thread::GetCurrent()->GetVM()->GetGC()->GetBarrierSet(); 37 } 38 39 /* static */ 40 #ifndef PANDA_RUNTIME_OBJECT_ACCESSOR_CPP_ 41 inline 42 #endif 43 // CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION__RETURNTYPE_QUALIFIER_NAME_ONELINE) 44 mem::GCBarrierSet * GetBarrierSet(const ManagedThread * thread)45 ObjectAccessor::GetBarrierSet(const ManagedThread *thread) 46 { 47 return thread->GetVM()->GetGC()->GetBarrierSet(); 48 } 49 50 /* static */ 51 #ifndef PANDA_RUNTIME_OBJECT_ACCESSOR_CPP_ 52 inline 53 #endif 54 // CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION__RETURNTYPE_QUALIFIER_NAME_ONELINE) 55 mem::BarrierType GetPreBarrierType(const ManagedThread * thread)56 ObjectAccessor::GetPreBarrierType(const ManagedThread *thread) 57 { 58 return thread->GetPreBarrierType(); 59 } 60 61 /* static */ 62 #ifndef PANDA_RUNTIME_OBJECT_ACCESSOR_CPP_ 63 inline 64 #endif 65 // CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION__RETURNTYPE_QUALIFIER_NAME_ONELINE) 66 mem::BarrierType GetPostBarrierType(const ManagedThread * thread)67 ObjectAccessor::GetPostBarrierType(const ManagedThread *thread) 68 { 69 return thread->GetPostBarrierType(); 70 } 71 72 } // namespace panda 73 74 #endif // PANDA_RUNTIME_OBJECT_ACCESSOR_IMPL_CPP_ 75