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) {