1 /**
2 * Copyright (c) 2023-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 "runtime/include/language_config.h"
17 #include "runtime/mem/gc/g1/ref_updater.h"
18 #include "runtime/mem/object_helpers-inl.h"
19 #include "runtime/mem/rem_set-inl.h"
20
21 namespace ark::mem {
22
23 template <class LanguageConfig>
UpdateRefToMovedObject(ObjectHeader * object,ObjectHeader * ref,uint32_t offset) const24 ObjectHeader *BaseRefUpdater<LanguageConfig>::UpdateRefToMovedObject(ObjectHeader *object, ObjectHeader *ref,
25 uint32_t offset) const
26 {
27 return ObjectHelpers<LanguageConfig::LANG_TYPE>::UpdateRefToMovedObject(object, ref, offset);
28 }
29
30 template <class LanguageConfig, bool NEED_LOCK>
Process(ObjectHeader * object,size_t offset,ObjectHeader * ref) const31 void UpdateRemsetRefUpdater<LanguageConfig, NEED_LOCK>::Process(ObjectHeader *object, size_t offset,
32 ObjectHeader *ref) const
33 {
34 if (!this->IsSameRegion(object, ref)) {
35 RemSet<>::AddRefWithAddr<NEED_LOCK>(object, offset, ref);
36 }
37 }
38
39 TEMPLATE_CLASS_LANGUAGE_CONFIG(BaseRefUpdater);
40 TEMPLATE_CLASS_LANGUAGE_CONFIG_AND_ARGS(UpdateRemsetRefUpdater, true);
41 TEMPLATE_CLASS_LANGUAGE_CONFIG_AND_ARGS(UpdateRemsetRefUpdater, false);
42
43 } // namespace ark::mem
44