From 5b6a8a3bdbea2df4d0e5e2e0cccfc74f2a1c23f0 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Mon, 1 Feb 2021 13:17:47 +0300 Subject: [PATCH] Make freezing stuff non-terminating TODO --- kotlin-native/runtime/src/main/cpp/Atomic.cpp | 4 ++++ kotlin-native/runtime/src/mm/cpp/Memory.cpp | 4 ++++ kotlin-native/runtime/src/mm/cpp/Stubs.cpp | 11 ++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/kotlin-native/runtime/src/main/cpp/Atomic.cpp b/kotlin-native/runtime/src/main/cpp/Atomic.cpp index 5f059b8a956..40058aeaed6 100644 --- a/kotlin-native/runtime/src/main/cpp/Atomic.cpp +++ b/kotlin-native/runtime/src/main/cpp/Atomic.cpp @@ -176,6 +176,10 @@ KNativePtr Kotlin_AtomicNativePtr_get(KRef thiz) { } void Kotlin_AtomicReference_checkIfFrozen(KRef value) { + if (CurrentMemoryModel == MemoryModel::kExperimental) { + // TODO: Remove when freezing is implemented. + return; + } if (value != nullptr && !isPermanentOrFrozen(value)) { ThrowInvalidMutabilityException(value); } diff --git a/kotlin-native/runtime/src/mm/cpp/Memory.cpp b/kotlin-native/runtime/src/mm/cpp/Memory.cpp index f07c9bead4c..b6e68d734f3 100644 --- a/kotlin-native/runtime/src/mm/cpp/Memory.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Memory.cpp @@ -95,6 +95,10 @@ void ObjHeader::destroyMetaObject(ObjHeader* object) { mm::ExtraObjectData::Uninstall(object); } +ALWAYS_INLINE bool isPermanentOrFrozen(const ObjHeader* obj) { + return obj->permanent() || isFrozen(obj); +} + ALWAYS_INLINE bool isShareable(const ObjHeader* obj) { // TODO: Remove when legacy MM is gone. return true; diff --git a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp index 31214be2e4f..6292c26201f 100644 --- a/kotlin-native/runtime/src/mm/cpp/Stubs.cpp +++ b/kotlin-native/runtime/src/mm/cpp/Stubs.cpp @@ -8,21 +8,18 @@ #include "KAssert.h" ALWAYS_INLINE bool isFrozen(const ObjHeader* obj) { - TODO(); -} - -ALWAYS_INLINE bool isPermanentOrFrozen(const ObjHeader* obj) { - TODO(); + // TODO: Unimplemented + return false; } extern "C" { void MutationCheck(ObjHeader* obj) { - TODO(); + // TODO: Unimplemented } void FreezeSubgraph(ObjHeader* obj) { - TODO(); + // TODO: Unimplemented } void EnsureNeverFrozen(ObjHeader* obj) {