From aea8bac7d2953fb1fd26de09d143da0a1a416929 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Fri, 12 May 2023 16:02:48 +0200 Subject: [PATCH] [K/N] Do not compile for deprecated targets and legacy MM ^KT-56533 ^KT-58853 --- buildSrc/src/main/kotlin/nativeTest.kt | 2 - .../arguments/K2NativeCompilerArguments.kt | 2 +- .../jetbrains/kotlin/test/TargetBackend.kt | 1 - .../failInInitializer1.kt | 2 +- .../failInInitializer2.kt | 2 +- .../failInInitializer3.kt | 1 - .../failInInitializer4.kt | 1 - .../kotlin/backend/konan/KonanConfig.kt | 173 ++---- .../kotlin/backend/konan/KonanDriver.kt | 14 +- .../backend/konan/SetupConfiguration.kt | 9 +- .../backend.native/tests/build.gradle | 527 ++---------------- .../tests/interop/memory_leaks/lib.kt | 15 - .../tests/interop/memory_leaks/main.cpp | 17 - .../backend.native/tests/jsinterop/math.kt | 21 - .../backend.native/tests/jsinterop/math.out | 1 - .../tests/link/testLib_explicitly2.kt | 8 - .../tests/link/testLib_explicitly2.out | 4 - .../tests/runtime/freezing_control/basic.kt | 61 -- .../tests/runtime/memory/cycle_collector.kt | 194 ------- .../memory/cycle_collector_deadlock1.kt | 16 - .../tests/runtime/memory/cycle_detector.kt | 201 ------- .../tests/runtime/workers/freeze0.kt | 33 -- .../tests/runtime/workers/freeze0.out | 4 - .../tests/runtime/workers/freeze1.kt | 47 -- .../tests/runtime/workers/freeze1.out | 1 - .../tests/runtime/workers/freeze2.kt | 91 --- .../tests/runtime/workers/freeze2.out | 5 - .../tests/runtime/workers/freeze3.kt | 51 -- .../tests/runtime/workers/freeze3.out | 1 - .../tests/runtime/workers/freeze4.kt | 30 - .../tests/runtime/workers/freeze4.out | 1 - .../tests/runtime/workers/freeze5.kt | 48 -- .../tests/runtime/workers/freeze5.out | 1 - .../tests/runtime/workers/freeze6.kt | 160 ------ .../tests/runtime/workers/freeze6.out | 2 - .../tests/runtime/workers/freeze_stress.kt | 152 ----- .../tests/runtime/workers/freeze_stress.out | 1 - .../tests/runtime/workers/worker9.kt | 94 ---- .../tests/runtime/workers/worker9.out | 6 - .../tests/samples/build.gradle.kts | 1 - .../tests/samples/echoServer/build.gradle.kts | 9 +- .../samples/html5Canvas/build.gradle.kts | 92 --- .../samples/html5Canvas/gradle.properties | 2 - .../tests/samples/html5Canvas/index.html | 14 - .../src/html5CanvasMain/kotlin/main.kt | 53 -- .../src/httpServerMain/kotlin/HttpServer.kt | 59 -- .../tests/samples/watchos/build.gradle.kts | 8 +- .../konan/blackboxtest/CompilerOutputTest.kt | 7 +- .../support/ConfigurationProperties.kt | 1 - .../blackboxtest/support/NativeTestSupport.kt | 18 - .../NativeTestGroupingMessageCollector.kt | 5 - .../support/compilation/TestCompilation.kt | 5 - .../support/group/ExtTestCaseGroupProvider.kt | 28 - .../support/settings/TestProcessSettings.kt | 17 +- 54 files changed, 128 insertions(+), 2191 deletions(-) delete mode 100644 kotlin-native/backend.native/tests/interop/memory_leaks/lib.kt delete mode 100644 kotlin-native/backend.native/tests/interop/memory_leaks/main.cpp delete mode 100644 kotlin-native/backend.native/tests/jsinterop/math.kt delete mode 100644 kotlin-native/backend.native/tests/jsinterop/math.out delete mode 100644 kotlin-native/backend.native/tests/link/testLib_explicitly2.kt delete mode 100644 kotlin-native/backend.native/tests/link/testLib_explicitly2.out delete mode 100644 kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/memory/cycle_collector.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/memory/cycle_collector_deadlock1.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/memory/cycle_detector.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze0.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze0.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze1.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze1.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze2.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze2.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze3.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze3.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze4.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze4.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze5.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze5.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze6.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze6.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/freeze_stress.out delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/worker9.kt delete mode 100644 kotlin-native/backend.native/tests/runtime/workers/worker9.out delete mode 100644 kotlin-native/backend.native/tests/samples/html5Canvas/build.gradle.kts delete mode 100644 kotlin-native/backend.native/tests/samples/html5Canvas/gradle.properties delete mode 100644 kotlin-native/backend.native/tests/samples/html5Canvas/index.html delete mode 100644 kotlin-native/backend.native/tests/samples/html5Canvas/src/html5CanvasMain/kotlin/main.kt delete mode 100644 kotlin-native/backend.native/tests/samples/html5Canvas/src/httpServerMain/kotlin/HttpServer.kt diff --git a/buildSrc/src/main/kotlin/nativeTest.kt b/buildSrc/src/main/kotlin/nativeTest.kt index b9436ee7bc4..4d535986b31 100644 --- a/buildSrc/src/main/kotlin/nativeTest.kt +++ b/buildSrc/src/main/kotlin/nativeTest.kt @@ -18,7 +18,6 @@ private enum class TestProperty(shortName: String) { FORCE_STANDALONE("forceStandalone"), COMPILE_ONLY("compileOnly"), OPTIMIZATION_MODE("optimizationMode"), - MEMORY_MODEL("memoryModel"), USE_THREAD_STATE_CHECKER("useThreadStateChecker"), GC_TYPE("gcType"), GC_SCHEDULER("gcScheduler"), @@ -166,7 +165,6 @@ fun Project.nativeTest( compute(FORCE_STANDALONE) compute(COMPILE_ONLY) compute(OPTIMIZATION_MODE) - compute(MEMORY_MODEL) compute(USE_THREAD_STATE_CHECKER) compute(GC_TYPE) compute(GC_SCHEDULER) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt index 66a1e5bf9bc..c4ac86f6cbb 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2NativeCompilerArguments.kt @@ -393,7 +393,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() { var overrideKonanProperties: Array? = null @Argument(value="-Xdestroy-runtime-mode", valueDescription = "", description = "When to destroy runtime. 'legacy' and 'on-shutdown' are currently supported. NOTE: 'legacy' mode is deprecated and will be removed.") - var destroyRuntimeMode: String? = "on-shutdown" + var destroyRuntimeMode: String? = null @Argument(value="-Xgc", valueDescription = "", description = "GC to use, 'noop', 'stms' and 'cms' are currently supported. Works only with -memory-model experimental") var gc: String? = null diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/TargetBackend.kt b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/TargetBackend.kt index 427ea6d4510..1989b3c6206 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/TargetBackend.kt +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/TargetBackend.kt @@ -23,7 +23,6 @@ enum class TargetBackend( ANDROID(false, JVM), ANDROID_IR(true, JVM_IR), NATIVE(true), - NATIVE_WITH_LEGACY_MM(true, NATIVE), JVM_WITH_OLD_EVALUATOR(false), JVM_IR_WITH_OLD_EVALUATOR(true), JVM_WITH_IR_EVALUATOR(false), diff --git a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer1.kt b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer1.kt index b9087b00971..d5d2cad6174 100644 --- a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer1.kt +++ b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer1.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM, NATIVE_WITH_LEGACY_MM +// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM // FILE: lib.kt val x: String = computeX() diff --git a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer2.kt b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer2.kt index b27ead9719b..82db9cb8d54 100644 --- a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer2.kt +++ b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer2.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM, NATIVE_WITH_LEGACY_MM +// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM // FILE: lib.kt val x: String = computeX() diff --git a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer3.kt b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer3.kt index aa5ec819d9f..311a8aeebaa 100644 --- a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer3.kt +++ b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer3.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: NATIVE -// IGNORE_BACKEND: NATIVE_WITH_LEGACY_MM // FILE: lib.kt import kotlin.native.concurrent.* diff --git a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer4.kt b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer4.kt index 132bc6d3631..f1f4a76cc7e 100644 --- a/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer4.kt +++ b/compiler/testData/codegen/box/topLevelInitializtion/failInInitializer4.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: NATIVE -// IGNORE_BACKEND: NATIVE_WITH_LEGACY_MM // FILE: lib.kt import kotlin.native.concurrent.* diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt index 78748eba72b..7a30e81b539 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt @@ -48,7 +48,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration private val platformManager = PlatformManager(distribution) internal val targetManager = platformManager.targetManager(configuration.get(KonanConfigKeys.TARGET)) - internal val target = targetManager.target + internal val target = targetManager.target.also { target -> + require(target.supportsThreads()) { "All supported targets must have threads, but was given $target" } + } val targetHasAddressDependency get() = target.hasAddressDependencyInMemoryModel() internal val flexiblePhaseConfig = configuration.get(CLIConfigurationKeys.FLEXIBLE_PHASE_CONFIG)!! @@ -72,55 +74,23 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration return@takeIf true } - private val defaultMemoryModel get() = - if (target.supportsThreads()) { - MemoryModel.EXPERIMENTAL + val memoryModel: MemoryModel get() = configuration.get(BinaryOptions.memoryModel)?.also { + if (it != MemoryModel.EXPERIMENTAL) { + configuration.report(CompilerMessageSeverity.ERROR, "Legacy MM is deprecated and no longer works.") } else { - MemoryModel.STRICT + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "-memory-model and memoryModel switches are deprecated and will be removed in a future release.") } - - val memoryModel: MemoryModel by lazy { - when (configuration.get(BinaryOptions.memoryModel)) { - MemoryModel.STRICT -> { - configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Legacy MM is deprecated and will be removed in version 1.9.20") - MemoryModel.STRICT - } - MemoryModel.RELAXED -> { - configuration.report(CompilerMessageSeverity.ERROR, - "Relaxed MM is deprecated and isn't expected to work right way with current Kotlin version.") - MemoryModel.STRICT - } - MemoryModel.EXPERIMENTAL -> { - if (!target.supportsThreads()) { - configuration.report(CompilerMessageSeverity.STRONG_WARNING, - "New MM requires threads, which are not supported on a deprecated target ${target.name}. Using deprecated legacy MM.") - MemoryModel.STRICT - } else { - MemoryModel.EXPERIMENTAL - } - } - null -> defaultMemoryModel // If target does not support threads, it's deprecated, no need to spam with our own deprecation message. - }.also { - if (it == MemoryModel.EXPERIMENTAL && destroyRuntimeMode == DestroyRuntimeMode.LEGACY) { - configuration.report(CompilerMessageSeverity.ERROR, - "New MM is incompatible with 'legacy' destroy runtime mode.") - } + }.let { MemoryModel.EXPERIMENTAL } + val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)?.also { + if (it != DestroyRuntimeMode.ON_SHUTDOWN) { + configuration.report(CompilerMessageSeverity.ERROR, "New MM is incompatible with 'legacy' destroy runtime mode.") + } else { + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "-Xdestroy-runtime-mode switch is deprecated and will be removed in a future release.") } - } - val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!! - private val defaultGC get() = if (target.supportsThreads()) GC.CONCURRENT_MARK_AND_SWEEP else GC.SAME_THREAD_MARK_AND_SWEEP + }.let { DestroyRuntimeMode.ON_SHUTDOWN } + private val defaultGC get() = GC.CONCURRENT_MARK_AND_SWEEP val gc: GC by lazy { - val configGc = configuration.get(KonanConfigKeys.GARBAGE_COLLECTOR) - val (gcFallbackReason, realGc) = when { - configGc == GC.CONCURRENT_MARK_AND_SWEEP && !target.supportsThreads() -> - "Concurrent mark and sweep gc is not supported for this target. Fallback to Same thread mark and sweep is done" to GC.SAME_THREAD_MARK_AND_SWEEP - configGc == null -> null to defaultGC - else -> null to configGc - } - if (gcFallbackReason != null) { - configuration.report(CompilerMessageSeverity.STRONG_WARNING, gcFallbackReason) - } - realGc + configuration.get(KonanConfigKeys.GARBAGE_COLLECTOR) ?: defaultGC } val runtimeAssertsMode: RuntimeAssertsMode get() = configuration.get(BinaryOptions.runtimeAssertionsMode) ?: RuntimeAssertsMode.IGNORE private val defaultDisableMmap get() = target.family == Family.MINGW @@ -138,48 +108,29 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration } } } - val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING) ?: when (memoryModel) { - MemoryModel.EXPERIMENTAL -> WorkerExceptionHandling.USE_HOOK - else -> WorkerExceptionHandling.LEGACY + val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)?.also { + if (it != WorkerExceptionHandling.USE_HOOK) { + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Legacy exception handling in workers is deprecated") } + } ?: WorkerExceptionHandling.USE_HOOK val runtimeLogs: String? get() = configuration.get(KonanConfigKeys.RUNTIME_LOGS) val suspendFunctionsFromAnyThreadFromObjC: Boolean by lazy { configuration.get(BinaryOptions.objcExportSuspendFunctionLaunchThreadRestriction) == ObjCExportSuspendFunctionLaunchThreadRestriction.NONE } - private val defaultFreezing get() = when (memoryModel) { - MemoryModel.EXPERIMENTAL -> Freezing.Disabled - else -> Freezing.Full - } - val freezing: Freezing by lazy { - val freezingMode = configuration.get(BinaryOptions.freezing) - when { - freezingMode == null -> defaultFreezing - memoryModel != MemoryModel.EXPERIMENTAL && freezingMode != Freezing.Full -> { - configuration.report( - CompilerMessageSeverity.ERROR, - "`freezing` can only be adjusted with new MM. Falling back to default behavior.") - Freezing.Full - } - memoryModel == MemoryModel.EXPERIMENTAL && freezingMode != Freezing.Disabled -> { - // INFO because deprecation is currently ignorable via OptIn. Using WARNING will require silencing (for warnings-as-errors) - // by some compiler flag. - // TODO: When moving into proper deprecation cycle replace with WARNING. - configuration.report( - CompilerMessageSeverity.INFO, - "`freezing` should not be enabled with the new MM. Freezing API is deprecated since 1.7.20. See https://kotlinlang.org/docs/native-migration-guide.html for details" - ) - freezingMode - } - else -> freezingMode + val freezing: Freezing get() = configuration.get(BinaryOptions.freezing)?.also { + if (it != Freezing.Disabled) { + configuration.report( + CompilerMessageSeverity.ERROR, + "`freezing` is not supported with the new MM. Freezing API is deprecated since 1.7.20. See https://kotlinlang.org/docs/native-migration-guide.html for details" + ) + } else { + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "freezing switch is deprecated and will be removed in a future release.") } - } + }.let { Freezing.Disabled } val sourceInfoType: SourceInfoType get() = configuration.get(BinaryOptions.sourceInfoType) ?: SourceInfoType.CORESYMBOLICATION.takeIf { debug && target.supportsCoreSymbolication() } ?: SourceInfoType.NOOP - val defaultGCSchedulerType get() = when { - !target.supportsThreads() -> GCSchedulerType.ON_SAFE_POINTS - else -> GCSchedulerType.WITH_TIMER - } + val defaultGCSchedulerType get() = GCSchedulerType.WITH_TIMER val gcSchedulerType: GCSchedulerType by lazy { configuration.get(BinaryOptions.gcSchedulerType) ?: defaultGCSchedulerType @@ -272,7 +223,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration private val shouldCoverLibraries = !configuration.getList(KonanConfigKeys.LIBRARIES_TO_COVER).isNullOrEmpty() private val defaultAllocationMode get() = when { - memoryModel == MemoryModel.EXPERIMENTAL && target.supportsMimallocAllocator() && sanitizer == null -> { + target.supportsMimallocAllocator() && sanitizer == null -> { AllocationMode.MIMALLOC } else -> AllocationMode.STD @@ -305,33 +256,21 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration internal val runtimeNativeLibraries: List = mutableListOf().apply { if (debug) add("debug.bc") - when (memoryModel) { - MemoryModel.STRICT -> { - add("strict.bc") - add("legacy_memory_manager.bc") - } - MemoryModel.RELAXED -> { - add("relaxed.bc") - add("legacy_memory_manager.bc") - } - MemoryModel.EXPERIMENTAL -> { - add("common_gc.bc") - if (allocationMode == AllocationMode.CUSTOM) { - add("experimental_memory_manager_custom.bc") - add("concurrent_ms_gc_custom.bc") - } else { - add("experimental_memory_manager.bc") - when (gc) { - GC.SAME_THREAD_MARK_AND_SWEEP -> { - add("same_thread_ms_gc.bc") - } - GC.NOOP -> { - add("noop_gc.bc") - } - GC.CONCURRENT_MARK_AND_SWEEP -> { - add("concurrent_ms_gc.bc") - } - } + add("common_gc.bc") + if (allocationMode == AllocationMode.CUSTOM) { + add("experimental_memory_manager_custom.bc") + add("concurrent_ms_gc_custom.bc") + } else { + add("experimental_memory_manager.bc") + when (gc) { + GC.SAME_THREAD_MARK_AND_SWEEP -> { + add("same_thread_ms_gc.bc") + } + GC.NOOP -> { + add("noop_gc.bc") + } + GC.CONCURRENT_MARK_AND_SWEEP -> { + add("concurrent_ms_gc.bc") } } } @@ -390,12 +329,12 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration internal val isInteropStubs: Boolean get() = manifestProperties?.getProperty("interop") == "true" - private val defaultPropertyLazyInitialization get() = when (memoryModel) { - MemoryModel.EXPERIMENTAL -> true - else -> false - } - internal val propertyLazyInitialization: Boolean get() = configuration.get(KonanConfigKeys.PROPERTY_LAZY_INITIALIZATION) ?: - defaultPropertyLazyInitialization + private val defaultPropertyLazyInitialization = true + internal val propertyLazyInitialization: Boolean get() = configuration.get(KonanConfigKeys.PROPERTY_LAZY_INITIALIZATION)?.also { + if (!it) { + configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Eager property initialization is deprecated") + } + } ?: defaultPropertyLazyInitialization internal val lazyIrForCaches: Boolean get() = configuration.get(KonanConfigKeys.LAZY_IR_FOR_CACHES)!! @@ -428,10 +367,6 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration if (debug) append("-g") append("STATIC") - if (memoryModel != defaultMemoryModel) - append("-mm=$memoryModel") - if (freezing != defaultFreezing) - append("-freezing=${freezing.name}") if (propertyLazyInitialization != defaultPropertyLazyInitialization) append("-lazy_init=${if (propertyLazyInitialization) "enable" else "disable"}") } @@ -443,9 +378,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration append("-runtime_debug") if (allocationMode != defaultAllocationMode) append("-allocator=${allocationMode.name}") - if (memoryModel == MemoryModel.EXPERIMENTAL && gc != defaultGC) + if (gc != defaultGC) append("-gc=${gc.name}") - if (memoryModel == MemoryModel.EXPERIMENTAL && gcSchedulerType != defaultGCSchedulerType) + if (gcSchedulerType != defaultGCSchedulerType) append("-gc-scheduler=${gcSchedulerType.name}") if (runtimeAssertsMode != RuntimeAssertsMode.IGNORE) append("-runtime_asserts=${runtimeAssertsMode.name}") diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt index 72d134205b6..5fed239c69f 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt @@ -23,13 +23,16 @@ import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite private val deprecatedTargets = setOf( KonanTarget.WATCHOS_X86, KonanTarget.IOS_ARM32, - KonanTarget.LINUX_ARM32_HFP, KonanTarget.MINGW_X86, KonanTarget.LINUX_MIPS32, KonanTarget.LINUX_MIPSEL32, KonanTarget.WASM32 ) +private val softDeprecatedTargets = setOf( + KonanTarget.LINUX_ARM32_HFP, +) + private const val DEPRECATION_LINK = "https://kotl.in/native-targets-tiers" class KonanDriver( @@ -64,8 +67,13 @@ class KonanDriver( } if (konanConfig.infoArgsOnly) return + if (konanConfig.target in deprecatedTargets || konanConfig.target is KonanTarget.ZEPHYR) { + configuration.report(CompilerMessageSeverity.ERROR, + "target ${konanConfig.target} is no longer available. See: $DEPRECATION_LINK") + } + // Avoid showing warning twice in 2-phase compilation. - if (konanConfig.produce != CompilerOutputKind.LIBRARY && konanConfig.target in deprecatedTargets) { + if (konanConfig.produce != CompilerOutputKind.LIBRARY && konanConfig.target in softDeprecatedTargets) { configuration.report(CompilerMessageSeverity.STRONG_WARNING, "target ${konanConfig.target} is deprecated and will be removed soon. See: $DEPRECATION_LINK") } @@ -94,4 +102,4 @@ class KonanDriver( } } } -} \ No newline at end of file +} diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt index 3694bf5718b..da2b506de7c 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/SetupConfiguration.kt @@ -201,12 +201,13 @@ fun CompilerConfiguration.setupFromArguments(arguments: K2NativeCompilerArgument put(FAKE_OVERRIDE_VALIDATOR, arguments.fakeOverrideValidator) putIfNotNull(PRE_LINK_CACHES, parsePreLinkCachesValue(this@setupFromArguments, arguments.preLinkCaches)) putIfNotNull(OVERRIDE_KONAN_PROPERTIES, parseOverrideKonanProperties(arguments, this@setupFromArguments)) - put(DESTROY_RUNTIME_MODE, when (arguments.destroyRuntimeMode) { + putIfNotNull(DESTROY_RUNTIME_MODE, when (arguments.destroyRuntimeMode) { + null -> null "legacy" -> DestroyRuntimeMode.LEGACY "on-shutdown" -> DestroyRuntimeMode.ON_SHUTDOWN else -> { report(ERROR, "Unsupported destroy runtime mode ${arguments.destroyRuntimeMode}") - DestroyRuntimeMode.ON_SHUTDOWN + null } }) putIfNotNull(GARBAGE_COLLECTOR, when (arguments.gc) { @@ -298,13 +299,11 @@ internal fun CompilerConfiguration.setupCommonOptionsForCaches(konanConfig: Kona put(DEBUG, konanConfig.debug) setupPartialLinkageConfig(konanConfig.partialLinkageConfig) putIfNotNull(EXTERNAL_DEPENDENCIES, konanConfig.externalDependenciesFile?.absolutePath) - put(BinaryOptions.memoryModel, konanConfig.memoryModel) put(PROPERTY_LAZY_INITIALIZATION, konanConfig.propertyLazyInitialization) put(BinaryOptions.stripDebugInfoFromNativeLibs, !konanConfig.useDebugInfoInNativeLibs) put(ALLOCATION_MODE, konanConfig.allocationMode) put(GARBAGE_COLLECTOR, konanConfig.gc) put(BinaryOptions.gcSchedulerType, konanConfig.gcSchedulerType) - put(BinaryOptions.freezing, konanConfig.freezing) put(BinaryOptions.runtimeAssertionsMode, konanConfig.runtimeAssertsMode) put(LAZY_IR_FOR_CACHES, konanConfig.lazyIrForCaches) put(CommonConfigurationKeys.PARALLEL_BACKEND_THREADS, konanConfig.threadsCount) @@ -562,4 +561,4 @@ private fun parseCompileFromBitcode( "Compilation from bitcode is not available when producing ${outputKind.visibleName}") } return arguments.compileFromBitcode -} \ No newline at end of file +} diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 630f2195cb8..d97ccb9f941 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -92,9 +92,6 @@ tasks.withType(KonanCompileNativeBinary.class).configureEach { enableTwoStageCompilation = twoStageEnabled } -ext.isExperimentalMM = !(project.globalTestArgs.contains("-memory-model") && - project.globalTestArgs.contains("strict")) && - project.testTarget != 'wasm32' ext.isNoopGC = project.globalTestArgs.contains("-Xgc=noop") ext.isAggressiveGC = project.globalTestArgs.contains("-Xbinary=gcSchedulerType=aggressive") ext.isCmsGC = project.globalTestArgs.contains("-Xgc=cms") || !project.globalTestArgs.any { it.startsWith("-Xgc=") } @@ -108,12 +105,6 @@ if (project.globalTestArgs.contains("-g") && (cacheTesting == null)) { ext.runtimeAssertionsPanic = true } -if (!isExperimentalMM) { - tasks.withType(KonanCompileNativeBinary.class).configureEach { - extraOpts "-opt-in=kotlin.native.FreezingIsDeprecated" - } -} - tasks.withType(KonanCompileNativeBinary).configureEach { extraOpts "-XXLanguage:+ImplicitSignedToUnsignedIntegerConversion" extraOpts "-opt-in=kotlinx.cinterop.ExperimentalForeignApi" @@ -199,8 +190,7 @@ run { task sanity { def platformLibsTasks =":distPlatformLibs" + ":kotlin-native:platformLibs" dependsOn(tasksOf(KonanTest) { task -> - !UtilsKt.isDependsOnPlatformLibs(task) && - task.name != "library_mismatch" // This test requires the wasm32 stdlib which is unavailable during a sanity run. + !UtilsKt.isDependsOnPlatformLibs(task) }) // Add framework tests dependsOn(tasksOf(FrameworkTest) { task -> @@ -503,7 +493,6 @@ task codegen_controlflow_for_loops_overflow(type: KonanLocalTest) { } task codegen_controlflow_for_loops_errors(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. source = "codegen/controlflow/for_loops_errors.kt" useGoldenData = true } @@ -582,7 +571,6 @@ task cast_simple(type: KonanLocalTest) { } task cast_null(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/basics/cast_null.kt" } @@ -599,13 +587,11 @@ task unchecked_cast2(type: KonanLocalTest) { } task unchecked_cast3(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/basics/unchecked_cast3.kt" } task unchecked_cast4(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/basics/unchecked_cast4.kt" } @@ -633,13 +619,10 @@ task runtime_random(type: KonanLocalTest) { } task runtime_basic_simd(type: KonanLocalTest) { - disabled = (project.testTarget == 'linux_mips32') - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. source = "runtime/basic/simd.kt" } task runtime_worker_random(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Uses workers. source = "runtime/basic/worker_random.kt" } @@ -665,14 +648,12 @@ standaloneTest("hello2") { } standaloneTest("readlnOrNull_empty") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readlnOrNull_empty.kt" } standaloneTest("readln_empty") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useTestData = true outputChecker = { s -> s.contains("ReadAfterEOFException") } expectedExitStatusChecker = { it != 0 } @@ -680,49 +661,42 @@ standaloneTest("readln_empty") { } standaloneTest("readln_alone_CR") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_alone_CR.kt" } standaloneTest("readln_empty_new_line") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_empty_new_line.kt" } standaloneTest("readln_multiline") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_multiline.kt" } standaloneTest("readln_CR_and_CRLF") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_CR_and_CRLF.kt" } standaloneTest("readln_long_line") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_long_line.kt" } standaloneTest("readln_cyrillic") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_cyrillic.kt" } standaloneTest("readln_multiple_empty_new_lines") { - enabled = (project.testTarget != 'wasm32') // KT-48738 useGoldenData = true useTestData = true source = "runtime/basic/readln_multiple_empty_new_lines.kt" @@ -816,75 +790,64 @@ task empty_substring(type: KonanLocalTest) { } standaloneTest("cleaner_basic") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_basic.kt" flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative'] } standaloneTest("collect_reference_field_values") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/collectReferenceFieldValues.kt" flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative'] } standaloneTest("cleaner_workers") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_workers.kt" flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative'] } standaloneTest("cleaner_in_main_with_checker") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_in_main_with_checker.kt" useGoldenData = true } standaloneTest("cleaner_in_main_without_checker") { - enabled = (project.testTarget != 'wasm32') // Cleaners need workers source = "runtime/basic/cleaner_in_main_without_checker.kt" useGoldenData = true } standaloneTest("cleaner_leak_without_checker") { - enabled = (project.testTarget != 'wasm32') // Cleaners need workers source = "runtime/basic/cleaner_leak_without_checker.kt" useGoldenData = true } standaloneTest("cleaner_leak_with_checker") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_leak_with_checker.kt" expectedExitStatusChecker = { it != 0 } outputChecker = { s -> (s =~ /Cleaner (0x)?[0-9a-fA-F]+ was disposed during program exit/).find() } } standaloneTest("cleaner_in_tls_main_without_checker") { - enabled = (project.testTarget != 'wasm32') // Cleaners need workers source = "runtime/basic/cleaner_in_tls_main_without_checker.kt" } standaloneTest("cleaner_in_tls_main_with_checker") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_in_tls_main_with_checker.kt" expectedExitStatusChecker = { it != 0 } outputChecker = { s -> (s =~ /Cleaner (0x)?[0-9a-fA-F]+ was disposed during program exit/).find() } } standaloneTest("cleaner_in_tls_worker") { - enabled = (project.testTarget != 'wasm32') && // Cleaners need workers - !isNoopGC + enabled = !isNoopGC source = "runtime/basic/cleaner_in_tls_worker.kt" flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative'] } standaloneTest("worker_bound_reference0") { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. source = "runtime/concurrent/worker_bound_reference0.kt" flags = ['-tr'] @@ -902,96 +865,74 @@ standaloneTest("worker_bound_reference0") { } task worker0(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker0.kt" } task worker1(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker1.kt" } task worker2(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker2.kt" } task worker3(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker3.kt" } task worker4(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker4.kt" } // This tests changes main thread worker queue state, so better be executed alone. standaloneTest("worker5") { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker5.kt" } task worker6(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker6.kt" } task worker7(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker7.kt" } task worker8(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/worker8.kt" } -task worker9(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') && // Workers need pthreads. - !isExperimentalMM - useGoldenData = true - source = "runtime/workers/worker9.kt" -} - task worker9_experimentalMM(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') && // Workers need pthreads. - isExperimentalMM useGoldenData = true source = "runtime/workers/worker9_experimentalMM.kt" } task worker10(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') && // Workers need pthreads. - !isNoopGC + enabled = !isNoopGC useGoldenData = true source = "runtime/workers/worker10.kt" } task worker11(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. - && !isAggressiveGC // TODO: Investigate why too slow + enabled = !isAggressiveGC // TODO: Investigate why too slow useGoldenData = true source = "runtime/workers/worker11.kt" } task worker_exception_messages(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. source = "runtime/workers/worker_exception_messages.kt" } standaloneTest("worker_exceptions") { flags = ["-tr", "-Xworker-exception-handling=use-hook"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { !it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error") } @@ -1000,7 +941,6 @@ standaloneTest("worker_exceptions") { standaloneTest("worker_exceptions_legacy") { flags = ["-tr", "-Xworker-exception-handling=legacy"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { it.contains("testExecuteAfterStartLegacy error") && it.contains("testExecuteStartLegacy error") } @@ -1009,7 +949,6 @@ standaloneTest("worker_exceptions_legacy") { standaloneTest("worker_exceptions_terminate") { flags = ["-Xworker-exception-handling=use-hook"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. expectedExitStatusChecker = { it != 0 } outputChecker = { it.contains("some error") && !it.contains("Will not happen") @@ -1019,7 +958,6 @@ standaloneTest("worker_exceptions_terminate") { standaloneTest("worker_exceptions_terminate_legacy") { flags = ["-Xworker-exception-handling=legacy"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { it.contains("some error") && it.contains("Will not happen") } @@ -1028,7 +966,6 @@ standaloneTest("worker_exceptions_terminate_legacy") { standaloneTest("worker_exceptions_terminate_hook") { flags = ["-Xworker-exception-handling=use-hook"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { it.contains("hook called") && !it.contains("some error") && it.contains("Will happen") } @@ -1037,7 +974,6 @@ standaloneTest("worker_exceptions_terminate_hook") { standaloneTest("worker_exceptions_terminate_hook_legacy") { flags = ["-Xworker-exception-handling=legacy"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { !it.contains("hook called") && it.contains("some error") && it.contains("Will happen") } @@ -1046,7 +982,6 @@ standaloneTest("worker_exceptions_terminate_hook_legacy") { standaloneTest("worker_exceptions_terminate_current") { flags = ["-Xworker-exception-handling=use-hook"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. expectedExitStatusChecker = { it != 0 } outputChecker = { it.contains("some error") && !it.contains("Will not happen") @@ -1056,7 +991,6 @@ standaloneTest("worker_exceptions_terminate_current") { standaloneTest("worker_exceptions_terminate_current_legacy") { flags = ["-Xworker-exception-handling=legacy"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { it.contains("some error") && it.contains("Will not happen") } @@ -1065,7 +999,6 @@ standaloneTest("worker_exceptions_terminate_current_legacy") { standaloneTest("worker_exceptions_terminate_hook_current") { flags = ["-Xworker-exception-handling=use-hook"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { it.contains("hook called") && !it.contains("some error") && it.contains("Will happen") } @@ -1074,7 +1007,6 @@ standaloneTest("worker_exceptions_terminate_hook_current") { standaloneTest("worker_exceptions_terminate_hook_current_legacy") { flags = ["-Xworker-exception-handling=legacy"] - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. outputChecker = { !it.contains("hook called") && it.contains("some error") && it.contains("Will happen") } @@ -1082,101 +1014,29 @@ standaloneTest("worker_exceptions_terminate_hook_current_legacy") { } standaloneTest("worker_threadlocal_no_leak") { - disabled = (project.testTarget == 'wasm32') // Needs pthreads. source = "runtime/workers/worker_threadlocal_no_leak.kt" } task worker_list_workers(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Needs pthreads. source = "runtime/workers/worker_list_workers.kt" } -standaloneTest("freeze0") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No workers on WASM. - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze0.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze1") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze1.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze_stress") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - && !isAggressiveGC // TODO: Investigate why too slow - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze_stress.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze2") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze2.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze3") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze3.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze4") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze4.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze5") { - enabled = cacheTesting == null - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze5.kt" - testLogger = KonanTest.Logger.SILENT -} - -standaloneTest("freeze6") { - enabled = (project.testTarget != 'wasm32') && (cacheTesting == null) // No exceptions on WASM. - && !isNoopGC - useGoldenData = true - flags = ["-Xbinary=freezing=full", "-tr"] - source = "runtime/workers/freeze6.kt" - testLogger = KonanTest.Logger.SILENT -} - standaloneTest("freeze_disabled") { - enabled = (project.testTarget != 'wasm32') && // No exceptions on WASM. - !isNoopGC && isExperimentalMM + enabled = !isNoopGC flags = ["-tr"] source = "runtime/workers/freeze_disabled.kt" testLogger = KonanTest.Logger.SILENT } task atomicSmokeTest(type: KonanLocalTest) { - enabled = isExperimentalMM // do not run the test on the legacy MM source = "runtime/atomics/atomic_smoke.kt" } task atomicStressTest(type: KonanLocalTest) { - enabled = isExperimentalMM // do not run the test on the legacy MM source = "runtime/atomics/atomic_stress.kt" } task atomic0(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/atomics/atomic0.kt" } @@ -1188,13 +1048,11 @@ standaloneTest("atomic1") { } task lazy0(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/lazy0.kt" } task lazy1(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Need exceptions. useGoldenData = true source = "runtime/workers/lazy1.kt" } @@ -1210,37 +1068,27 @@ standaloneTest("lazy3") { } task lazy4(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. Need exceptions - && !isAggressiveGC // TODO: Investigate why too slow + enabled = !isAggressiveGC // TODO: Investigate why too slow source = "runtime/workers/lazy4.kt" } task mutableData1(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. Need exceptions source = "runtime/workers/mutableData1.kt" } task enumIdentity(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Workers need pthreads. useGoldenData = true source = "runtime/workers/enum_identity.kt" } standaloneTest("leakWorker") { - disabled = (project.testTarget == 'wasm32') // Needs pthreads. source = "runtime/workers/leak_worker.kt" expectedExitStatusChecker = { it != 0 } outputChecker = { s -> s.contains("Unfinished workers detected, 1 workers leaked!") } } standaloneTest("leakMemoryWithWorkerTermination") { - disabled = (project.testTarget == 'wasm32') // Needs pthreads. source = "runtime/workers/leak_memory_with_worker_termination.kt" - - if (!isExperimentalMM) { // Experimental MM will not report memory leaks. - expectedExitStatusChecker = { it != 0 } - outputChecker = { s -> s.contains("Memory leaks detected, 1 objects leaked!") } - } } task superFunCall(type: KonanLocalTest) { @@ -1326,7 +1174,6 @@ task enum_nested(type: KonanLocalTest) { } task enum_isFrozen(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/enum/isFrozen.kt" } @@ -1431,7 +1278,6 @@ standaloneTest("objectDeclaration_globalConstants") { } task object_isFrozen(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/objectDeclaration/isFrozen.kt" } @@ -1515,7 +1361,6 @@ standaloneTest("initializers_globalInitedAfterAccessingFile") { } standaloneTest("initializers_globalNotInitedAfterAccessingClassInternals") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/globalNotInitedAfterAccessingClassInternals.kt" } @@ -1524,39 +1369,32 @@ standaloneTest("initializers_globalInitedBeforeThreadLocal") { } standaloneTest("initializers_eagerInitializationGlobal1") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/eagerInitializationGlobal1.kt" } standaloneTest("initializers_eagerInitializationGlobal2") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/eagerInitializationGlobal2.kt" } standaloneTest("initializers_eagerInitializationThreadLocal1") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/eagerInitializationThreadLocal1.kt" } standaloneTest("initializers_eagerInitializationThreadLocal2") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/eagerInitializationThreadLocal2.kt" } standaloneTest("initializers_testInfrastructure") { - enabled = project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM source = "codegen/initializers/testInfrastructure.kt" flags = ["-tr"] } standaloneTest("initializers_workers1") { - expectedFail = (project.testTarget == 'wasm32') // Workers are not supported source = "codegen/initializers/workers1.kt" useGoldenData = true } standaloneTest("initializers_workers2") { - expectedFail = (project.testTarget == 'wasm32') // Workers are not supported source = "codegen/initializers/workers2.kt" useGoldenData = true } @@ -1572,13 +1410,11 @@ standaloneTest("initializers_when2") { } standaloneTest("initializers_throw1") { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/initializers/throw1.kt" useGoldenData = true } standaloneTest("initializers_throw2") { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/initializers/throw2.kt" useGoldenData = true } @@ -1640,7 +1476,6 @@ task arithmetic_basic(type: KonanLocalTest) { } task arithmetic_division(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/arithmetic/division.kt" } @@ -1897,7 +1732,6 @@ task lateinit_initialized(type: KonanLocalTest) { } task lateinit_notInitialized(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/lateinit/notInitialized.kt" } @@ -1913,7 +1747,6 @@ task lateinit_localInitialized(type: KonanLocalTest) { } task lateinit_localNotInitialized(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/lateinit/localNotInitialized.kt" } @@ -1924,7 +1757,6 @@ task lateinit_localCapturedInitialized(type: KonanLocalTest) { } task lateinit_localCapturedNotInitialized(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/lateinit/localCapturedNotInitialized.kt" } @@ -2034,19 +1866,16 @@ task coroutines_controlFlow_finally4(type: KonanLocalTest) { } task coroutines_controlFlow_finally5(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_finally5.kt" } task coroutines_controlFlow_finally6(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_finally6.kt" } task coroutines_controlFlow_finally7(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_finally7.kt" } @@ -2077,19 +1906,16 @@ task coroutines_controlFlow_tryCatch2(type: KonanLocalTest) { } task coroutines_controlFlow_tryCatch3(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_tryCatch3.kt" } task coroutines_controlFlow_tryCatch4(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_tryCatch4.kt" } task coroutines_controlFlow_tryCatch5(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/coroutines/controlFlow_tryCatch5.kt" } @@ -2171,7 +1997,6 @@ task AbstractMutableCollection(type: KonanLocalTest) { } task BitSet(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. expectedExitStatus = 0 source = "runtime/collections/BitSet.kt" } @@ -2202,13 +2027,11 @@ task array3(type: KonanLocalTest) { } task array4(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/collections/array4.kt" } task array5(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "runtime/collections/array5.kt" } @@ -2218,7 +2041,6 @@ task typed_array0(type: KonanLocalTest) { } task typed_array1(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // No exceptions on WASM. useGoldenData = true source = "runtime/collections/typed_array1.kt" } @@ -2291,7 +2113,6 @@ task when_with_try1(type: KonanLocalTest) { } task arraysForLoops(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "codegen/bce/arraysForLoops.kt" } @@ -2385,7 +2206,6 @@ linkTest("link_omit_unused") { } standaloneTest("link_default_libs") { - enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm useGoldenData = true source = "link/default/default.kt" UtilsKt.dependsOnPlatformLibs(it) @@ -2393,8 +2213,7 @@ standaloneTest("link_default_libs") { standaloneTest("link_testLib_explicitly1") { // there is no testLibrary for cross targets yet. - enabled = project.target.name == project.hostName && - (project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM) + enabled = project.target.name == project.hostName dependsOn installTestLib useGoldenData = true source = "link/testLib_explicitly1.kt" @@ -2406,23 +2225,7 @@ standaloneTest("link_testLib_explicitly1") { } } -standaloneTest("link_testLib_explicitly2") { - // there is no testLibrary for cross targets yet. - enabled = project.target.name == project.hostName && - !(project.globalTestArgs.contains('-Xir-property-lazy-initialization=enable') || isExperimentalMM) - dependsOn installTestLib - useGoldenData = true - source = "link/testLib_explicitly2.kt" - // We force library inclusion, so need to see the warning banner. - flags = ['-l', 'testLibrary', '-r', testLibraryDir] - doLast { - def file = new File("$testLibraryDir/testLibrary") - file.deleteDir() - } -} - linkTest("no_purge_for_dependencies") { - enabled = (project.testTarget != 'wasm32') // there will be no posix.klib for wasm useGoldenData = true source = "link/purge1/prog.kt" lib = "link/purge1/lib.kt" @@ -2491,7 +2294,6 @@ task boxing6(type: KonanLocalTest) { } task boxing7(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/boxing/boxing7.kt" } @@ -2571,7 +2373,6 @@ task array_list1(type: KonanLocalTest) { } task array_list2(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // uses exceptions useGoldenData = true source = "runtime/collections/array_list2.kt" } @@ -2615,7 +2416,6 @@ task moderately_large_array1(type: KonanLocalTest) { } task string_builder0(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/text/string_builder0.kt" } @@ -2640,14 +2440,12 @@ task to_string0(type: KonanLocalTest) { } task trim(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions useGoldenData = true source = "runtime/text/trim.kt" } task chars0(type: KonanLocalTest) { disabled = isAggressiveGC // TODO: Investigate why too slow - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. source = "runtime/text/chars0.kt" expectedExitStatus = 0 } @@ -2657,27 +2455,22 @@ task indexof(type: KonanLocalTest) { } task utf8(type: KonanLocalTest) { - // Uses exceptions so cannot run on wasm. - enabled = project.testTarget != 'wasm32' - && !isAggressiveGC // TODO: Investigate why too slow + enabled = !isAggressiveGC // TODO: Investigate why too slow useGoldenData = true source = "runtime/text/utf8.kt" } task catch1(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/exceptions/catch1.kt" } task catch2(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/exceptions/catch2.kt" } task catch7(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/exceptions/catch7.kt" } @@ -2702,8 +2495,7 @@ standaloneTest("stack_trace_inline") { } standaloneTest("kt-49240-stack-trace-completeness") { - disabled = !supportsExceptions(project) || project.globalTestArgs.contains('-opt') || - project.testTarget == 'linux_mips32' // https://youtrack.jetbrains.com/issue/KT-48949/Linux-MIPS32-libbacktrace-stacktrace-has-no-lines + disabled = !supportsExceptions(project) || project.globalTestArgs.contains('-opt') source = "runtime/exceptions/kt-49240-stack-trace-completeness.kt" } @@ -2748,7 +2540,6 @@ standaloneTest("throw_from_except_constr") { } standaloneTest("custom_hook") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("value 42: Error. Runnable state: true") && it.contains("Uncaught Kotlin exception: kotlin.Error: an error") } @@ -2758,7 +2549,6 @@ standaloneTest("custom_hook") { } standaloneTest("custom_hook_memory_leak") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Hook 42") && it.contains("Uncaught Kotlin exception: kotlin.Error: an error") } @@ -2771,7 +2561,6 @@ standaloneTest("custom_hook_get") { } standaloneTest("custom_hook_no_reset") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Hook called") && it.contains("Uncaught Kotlin exception: kotlin.Error: some error") } @@ -2780,7 +2569,6 @@ standaloneTest("custom_hook_no_reset") { } standaloneTest("custom_hook_throws") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Hook called") && it.contains("Uncaught Kotlin exception: kotlin.Error: another error") && !it.contains("some error") } @@ -2789,13 +2577,11 @@ standaloneTest("custom_hook_throws") { } standaloneTest("custom_hook_unhandled_exception") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/exceptions/custom_hook_unhandled_exception.kt" } standaloneTest("custom_hook_terminate") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Hook called") } @@ -2804,7 +2590,6 @@ standaloneTest("custom_hook_terminate") { } standaloneTest("custom_hook_terminate_unhandled_exception") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Hook called") && it.contains("Uncaught Kotlin exception: kotlin.Error: some error") && !it.contains("Not going to happen") } @@ -2813,30 +2598,25 @@ standaloneTest("custom_hook_terminate_unhandled_exception") { } standaloneTest("exception_in_global_init") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. source = "runtime/exceptions/exception_in_global_init.kt" expectedExitStatusChecker = { it != 0 } outputChecker = { s -> s.contains("Uncaught Kotlin exception:") && s.contains("FAIL") && !s.contains("in kotlin main") } } task rethrow_exception(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. source = "runtime/exceptions/rethrow.kt" } task throw_from_catch(type: KonanLocalTest) { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. source = "runtime/exceptions/throw_from_catch.kt" } standaloneTest("terminate") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. expectedExitStatusChecker = { it != 0 } source = "runtime/exceptions/terminate.kt" } standaloneTest("unhandled_exception") { - enabled = (project.testTarget != 'wasm32') // Uses exceptions. outputChecker = { it.contains("Uncaught Kotlin exception: kotlin.Error: some error") } @@ -2845,7 +2625,6 @@ standaloneTest("unhandled_exception") { } standaloneTest("runtime_math_exceptions") { - enabled = (project.testTarget != 'wasm32') source = "stdlib_external/numbers/MathExceptionTest.kt" flags = ['-tr'] } @@ -2871,13 +2650,11 @@ task catch4(type: KonanLocalTest) { } task catch5(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/try/catch5.kt" } task catch6(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/try/catch6.kt" } @@ -3230,7 +3007,6 @@ task initializers5(type: KonanLocalTest) { } task initializers6(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Needs workers. source = "runtime/basic/initializers6.kt" } @@ -3243,7 +3019,6 @@ task initializers8(type: KonanLocalTest) { } task expression_as_statement(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // uses exceptions. useGoldenData = true source = "codegen/basics/expression_as_statement.kt" } @@ -3265,8 +3040,7 @@ standaloneTest("codegen_escapeAnalysis_stackAllocated") { standaloneTest("codegen_escapeAnalysis_string") { disabled = (cacheTesting != null) || // Cache is not compatible with -opt. - project.globalTestArgs.contains('-g') || // -g and -opt are incompatible - !isExperimentalMM // strings are frozen in legacy GC + project.globalTestArgs.contains('-g') // -g and -opt are incompatible flags = ['-opt', '-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative'] source = "codegen/escapeAnalysis/string.kt" } @@ -3288,7 +3062,6 @@ task memory_var4(type: KonanLocalTest) { } task memory_throw_cleanup(type: KonanLocalTest) { - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "runtime/memory/throw_cleanup.kt" } @@ -3337,54 +3110,27 @@ standaloneTest("memory_only_gc") { } task memory_stable_ref_cross_thread_check(type: KonanLocalTest) { - disabled = (project.testTarget == 'wasm32') // Needs workers. source = "runtime/memory/stable_ref_cross_thread_check.kt" } -standaloneTest("cycle_detector") { - disabled = project.globalTestArgs.contains('-opt') || // Needs debug build. - (project.testTarget == 'wasm32') || // CycleDetector is disabled on WASM. - isExperimentalMM // Experimental MM will not support CycleDetector. - flags = ['-tr', '-g'] - source = "runtime/memory/cycle_detector.kt" -} - -standaloneTest("cycle_collector") { - disabled = true // Needs USE_CYCLIC_GC, which is disabled. - source = "runtime/memory/cycle_collector.kt" -} - -standaloneTest("cycle_collector_deadlock1") { - disabled = true // Needs USE_CYCLIC_GC, which is disabled. - source = "runtime/memory/cycle_collector_deadlock1.kt" -} - standaloneTest("leakMemory") { source = "runtime/memory/leak_memory.kt" - if (!isExperimentalMM) { // Experimental MM will not report memory leaks. - expectedExitStatusChecker = { it != 0 } - outputChecker = { s -> s.contains("Memory leaks detected, 1 objects leaked!") } - } } standaloneTest("leakMemoryWithTestRunner") { source = "runtime/memory/leak_memory_test_runner.kt" flags = ['-tr'] - if (!isExperimentalMM) { // Experimental MM will not report memory leaks. - expectedExitStatusChecker = { it != 0 } - outputChecker = { s -> s.contains("Memory leaks detected, 1 objects leaked!") } - } } standaloneTest("gcStats") { source = "runtime/memory/gcStats.kt" flags = ['-tr', "-Xbinary=gcSchedulerType=disabled"] - enabled = isExperimentalMM && !isNoopGC && !isAggressiveGC + enabled = !isNoopGC && !isAggressiveGC } standaloneTest("stress_gc_allocations") { // TODO: Support obtaining peak RSS on more platforms. - enabled = (project.testTarget != "wasm32") && + enabled = (project.testTarget != "watchos_arm32") && (project.testTarget != "watchos_arm64") && (project.testTarget != "watchos_x86") && @@ -3415,36 +3161,6 @@ standaloneTest("array_out_of_memory") { } } -standaloneTest("freezing_control_basic_full") { - enabled = isExperimentalMM && cacheTesting == null - source = "runtime/freezing_control/basic.kt" - flags = [ - '-Xbinary=freezing=full', - '-friend-modules', project.rootProject.file("${UtilsKt.getKotlinNativeDist(project)}/klib/common/stdlib").absolutePath - ] - arguments = ['full'] -} - -standaloneTest("freezing_control_basic_disabled") { - enabled = isExperimentalMM - source = "runtime/freezing_control/basic.kt" - flags = [ - '-Xbinary=freezing=disabled', - '-friend-modules', project.rootProject.file("${UtilsKt.getKotlinNativeDist(project)}/klib/common/stdlib").absolutePath - ] - arguments = ['disabled'] -} - -standaloneTest("freezing_control_basic_explicitOnly") { - enabled = isExperimentalMM && cacheTesting == null - source = "runtime/freezing_control/basic.kt" - flags = [ - '-Xbinary=freezing=explicitOnly', - '-friend-modules', project.rootProject.file("${UtilsKt.getKotlinNativeDist(project)}/klib/common/stdlib").absolutePath - ] - arguments = ['explicitOnly'] -} - task unit1(type: KonanLocalTest) { useGoldenData = true source = "codegen/basics/unit1.kt" @@ -3816,7 +3532,6 @@ standaloneTest("testing_annotations") { standaloneTest("testing_assertions") { source = "testing/assertions.kt" flags = ['-tr'] - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. expectedExitStatus = 0 } @@ -3974,7 +3689,6 @@ standaloneTest("testing_stacktrace") { source = "testing/stacktrace.kt" flags = ['-tr', '-ea'] arguments = ["--ktest_logger=TEAMCITY", "--ktest_no_exit_code"] - expectedFail = (project.testTarget == 'wasm32') // Uses exceptions. // This test prints TeamCity service messages about failed test causing false negative failure at CI. // So we need to suppress printing these messages to stdout. // printOutput = false @@ -4025,7 +3739,6 @@ linkTest("inline_sharedVar_linkTest") { } linkTest("inline_lateinitProperty_linkTest") { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. useGoldenData = true source = "codegen/inline/lateinitProperty_linkTest_main.kt" lib = "codegen/inline/lateinitProperty_linkTest_lib.kt" @@ -4496,157 +4209,122 @@ standaloneTest("interop_objc_allocException") { } interopTest("interop_available_processors") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = 'interop/basics/available_processors.kt' arguments = [Runtime.getRuntime().availableProcessors().toString()] interop = 'cstdlib' } interopTest("interop0") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - (project.testTarget == 'linux_mips32') || // st_uid of '/' is not equal to 0 when using qemu - (project.testTarget == 'linux_mipsel32') || - (project.testTarget == 'linux_arm32_hfp') || - (project.testTarget == 'linux_arm64') + disabled = (project.testTarget == 'linux_arm64') useGoldenData = true source = "interop/basics/0.kt" interop = 'sysstat' } interopTest("interop1") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/1.kt" interop = 'cstdlib' } interopTest("interop2") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/2.kt" interop = 'cstdio' } interopTest("interop3") { - // We disable this test on Raspberry Pi because - // qsort accepts size_t args. So the .kt file - // should be different depending on the bitness of the target. - // There are plans to provide a solution and turn this - // test back on. - disabled = (project.testTarget == 'raspberrypi') || - (project.testTarget == 'linux_mips32') || - (project.testTarget == 'linux_mipsel32') || - (project.testTarget == 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/3.kt" interop = 'cstdlib' } interopTest("interop4") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/4.kt" interop = 'cstdio' } standaloneTest("interop5") { - enabled = (project.testTarget != 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/5.kt" UtilsKt.dependsOnPlatformLibs(it) } interopTest("interop_bitfields") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. - || isAggressiveGC // TODO: Investigate why too slow - expectedFail = (project.testTarget == 'linux_mips32') // fails because of big-endiannes + disabled = isAggressiveGC // TODO: Investigate why too slow source = "interop/basics/bf.kt" interop = 'bitfields' } interopTest("interop_funptr") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. useGoldenData = true source = "interop/basics/funptr.kt" interop = 'cfunptr' } interopTest("interop_globals") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/globals.kt" interop = 'cglobals' } interopTest("interop_macros") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - isK2(project) // KT-56041 + disabled = isK2(project) // KT-56041 source = "interop/basics/macros.kt" interop = 'cmacros' } interopTest("interop_unsupported") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/unsupported.kt" interop = 'cunsupported' } interopTest("interop_toKString") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/toKString.kt" interop = 'ctoKString' } interopTest("interop_types") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/types.kt" interop = 'ctypes' } interopTest("interop_structAnonym") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - (project.testTarget == 'mingw_x86') source = "interop/basics/structAnonym.kt" interop = 'structAnonym' } interopTest("interop_vectors") { - disabled = (project.testTarget == 'wasm32') || (project.testTarget == 'linux_mips32') // No interop for wasm yet. source = "interop/basics/vectors.kt" interop = 'cvectors' } interopTest("interop_mangling") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/mangling.kt" interop = 'cmangling' } interopTest("interop_mangling2") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/mangling2.kt" interop = 'cmangling2' } interopTest("interop_mangling_keywords") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/mangling_keywords.kt" interop = 'cmangling_keywords' } interopTest("interop_mangling_keywords2") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/mangling_keywords2.kt" interop = 'cmangling_keywords2' } interopTest("interop_auxiliarySources") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/auxiliary_sources/main.kt" interop = 'auxiliaryCppSources' } interopTest("interop_concurrentTerminate") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/concurrentTerminate/main.kt" interop = 'concurrentTerminate' outputChecker = { str -> str.endsWith("Reporting error!\n") } @@ -4654,54 +4332,43 @@ interopTest("interop_concurrentTerminate") { } interopTest("interop_incompleteTypes") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/incomplete_types/main.kt" interop = 'incomplete_types' } interopTest("interop_embedStaticLibraries") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/embedStaticLibraries/main.kt" interop = 'embedStaticLibraries' } interopTest("interop_values") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/values.kt" interop = 'cvalues' } interopTest("interop_structs") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/structs.kt" interop = 'cstructs' } interopTest("interop_callbacksAndVarargs") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/basics/callbacksAndVarargs.kt" interop = 'ccallbacksAndVarargs' } interopTest("interop_threadStates") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - !isExperimentalMM // No thread state switching in the legacy MM. source = "interop/threadStates/threadStates.kt" flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative'] interop = "threadStates" } interopTest("interop_threadStates_callbacksWithExceptions") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - !isExperimentalMM // No thread state switching in the legacy MM. source = "interop/threadStates/callbacksWithExceptions.kt" interop = "threadStates" flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative'] } interopTest("interop_threadStates_unhandledException") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - !isExperimentalMM // No thread state switching in the legacy MM. source = "interop/threadStates/unhandledException.kt" interop = "threadStates" outputChecker = { it.contains("Error. Runnable state: true") } @@ -4710,8 +4377,6 @@ interopTest("interop_threadStates_unhandledException") { } interopTest("interop_threadStates_unhandledExceptionInForeignThread") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - !isExperimentalMM // No thread state switching in the legacy MM. source = "interop/threadStates/unhandledExceptionInForeignThread.kt" interop = "threadStates" outputChecker = { it.contains("Error. Runnable state: true") } @@ -4720,7 +4385,6 @@ interopTest("interop_threadStates_unhandledExceptionInForeignThread") { } interopTest("interop_withSpaces") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop ='withSpaces' source = "interop/basics/withSpaces.kt" @@ -4730,53 +4394,45 @@ interopTest("interop_withSpaces") { } interopTest("interop_union") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'cunion' source = "interop/basics/union.kt" } interopTest("interop_enums") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'cenums' flags = ['-XXLanguage:+EnumEntries'] source = "interop/basics/enums.kt" } interopTest("interop_array_pointers") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'carrayPointers' source = "interop/basics/arrayPointers.kt" } interopTest("interop_kt43265") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'kt43265' source = "interop/kt43265/usage.kt" } interopTest("interop_kt44283") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - project.globalTestArgs.contains('-opt') // Incompatible with -g. + disabled = project.globalTestArgs.contains('-opt') // Incompatible with -g. flags = ['-g'] interop = 'kt44283' source = "interop/kt44283/main.kt" } interopTest("interop_kt54284") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'kt54284' source = "interop/kt54284/main.kt" } interopTest("interop_kt54284_fmodules") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'kt54284_fmodules' source = "interop/kt54284/main.kt" } // TODO: This test should be run with caches on. interopTest("interop_kt51925") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'kt51925' lib = 'interop/kt51925/kt51925_lib.kt' source = 'interop/kt51925/kt51925_main.kt' @@ -4784,7 +4440,6 @@ interopTest("interop_kt51925") { } dynamicTest("interop_kt43502") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic interop = "kt43502" source = "interop/kt43502/main.kt" cSource = "$projectDir/interop/kt43502/main.c" @@ -4792,13 +4447,11 @@ dynamicTest("interop_kt43502") { } interopTest("interop_leakMemoryWithRunningThreadUnchecked") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'leakMemoryWithRunningThread' source = "interop/leakMemoryWithRunningThread/unchecked.kt" } interopTest("interop_leakMemoryWithRunningThreadChecked") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. interop = 'leakMemoryWithRunningThread' source = "interop/leakMemoryWithRunningThread/checked.kt" expectedExitStatusChecker = { it != 0 } @@ -4806,7 +4459,6 @@ interopTest("interop_leakMemoryWithRunningThreadChecked") { } standaloneTest("interop_pinning") { - disabled = (project.testTarget == 'wasm32') // Uses exceptions. source = "interop/basics/pinning.kt" flags = [ "-tr" ] } @@ -4829,23 +4481,19 @@ standaloneTest("isExperimentalMM") { } interopTest("interop_cppClass") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - isAppleTarget(project) // KT-58422 + disabled = isAppleTarget(project) // KT-58422 source = "interop/cpp/cppClass.kt" interop = 'cppClass' } interopTest("interop_cppTypes") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - isAppleTarget(project) // KT-58422 + disabled = isAppleTarget(project) // KT-58422 source = "interop/cpp/types.kt" interop = 'cppTypes' } interopTest("interop_cppSkia") { - disabled = (project.testTarget == 'wasm32' || // No interop for wasm yet. - isExperimentalMM) || - isAppleTarget(project) // KT-58422 + disabled = true // KT-58422 source = "interop/cpp/skia.kt" interop = 'cppSkia' useGoldenData = true @@ -4853,8 +4501,7 @@ interopTest("interop_cppSkia") { } interopTest("interop_cppSkiaSignature") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - isAppleTarget(project) // KT-58422 + disabled = isAppleTarget(project) // KT-58422 source = "interop/cpp/skiaSignature.kt" interop = "cppSkiaSignature" useGoldenData = true @@ -4862,20 +4509,17 @@ interopTest("interop_cppSkiaSignature") { } interopTest("interop_workerSignals") { - disabled = (project.testTarget == 'wasm32') || // No interop for wasm yet. - (project.testTarget == 'mingw_x86' || project.testTarget == 'mingw_x64') // cross-thread signalling does not work on Windows + disabled = project.testTarget == 'mingw_x64' // cross-thread signalling does not work on Windows source = "interop/workerSignals/workerSignals.kt" interop = "workerSignals" } interopTest("interop_forwardDeclarations") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/forwardDeclarations/forwardDeclarations.kt" interop = "cForwardDeclarations" } interopTest("interop_forwardDeclarationsTwoLibs") { - disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/forwardDeclarationsTwoLibs/forwardDeclarationsTwoLibs.kt" interop = "cForwardDeclarationsTwoLibs1" interop2 = "cForwardDeclarationsTwoLibs2" @@ -4989,7 +4633,6 @@ if (PlatformInfo.isAppleTarget(project)) { // KT-49034 tests don't need whole compilation pipeline (only frontend) or platform libraries. Consider simplifying them when porting // to the new test infra. interopTest("interop_kt49034_struct") { - disabled = (project.testTarget == 'wasm32') interop = 'kt49034_struct' source = 'interop/objc/kt49034/struct/main.kt' @@ -4998,7 +4641,6 @@ if (PlatformInfo.isAppleTarget(project)) { } interopTest("interop_kt49034_objcclass") { - disabled = (project.testTarget == 'wasm32') interop = 'kt49034_objcclass' source = 'interop/objc/kt49034/objcclass/main.kt' @@ -5007,7 +4649,7 @@ if (PlatformInfo.isAppleTarget(project)) { } interopTest("interop_kt49034_objcprotocol") { - disabled = (project.testTarget == 'wasm32') || isK2(project) // KT-56028 + disabled = isK2(project) // KT-56028 interop = 'kt49034_objcprotocol' source = 'interop/objc/kt49034/objcprotocol/main.kt' @@ -5120,18 +4762,8 @@ if (PlatformInfo.isAppleTarget(project)) { interopTest("interop_objc_illegal_sharing_with_weak") { source = "interop/objc/illegal_sharing_with_weak/main.kt" interop = 'objc_illegal_sharing_with_weak' - - if (isExperimentalMM) { - // Experimental MM supports arbitrary object sharing. - outputChecker = { it == "Before\nAfter true\n" } - } else { - expectedExitStatusChecker = { it != 0 } - outputChecker = { - it.startsWith("Before") && // Should crash after "Before" - !it.contains("After") && // But before "After" - it.contains("isObjectAliveShouldCrash") // And should contain stack trace. - } - } + // Experimental MM supports arbitrary object sharing. + outputChecker = { it == "Before\nAfter true\n" } } interopTest("interop_objc_kt42172") { @@ -5268,7 +4900,6 @@ if (PlatformInfo.isAppleTarget(project)) { interopTest("interop_objc_kt56402") { // Test depends on macOS-specific AppKit enabled = (project.testTarget == 'macos_x64' || project.testTarget == 'macos_arm64' || project.testTarget == null) - && isExperimentalMM && !isNoopGC // requires some GC source = 'interop/objc/kt56402/main.kt' interop = "objc_kt56402" @@ -5322,23 +4953,6 @@ tasks.register("KT-50983", KonanDriverTest) { flags = ['-linker-option', "$buildDir/File.res"] } -standaloneTest("jsinterop_math") { - doBeforeBuild { - def jsinteropScript = isWindows() ? "jsinterop.bat" : "jsinterop" - def jsinterop = "$kotlinNativeDist/bin/$jsinteropScript" - // TODO: We probably need a NativeInteropPlugin for jsinterop? - exec { - commandLine jsinterop, "-pkg", "kotlinx.interop.wasm.math", "-o", "$buildDir/jsmath", "-target", "wasm32" - } - - } - dependsOn ':kotlin-native:wasm32PlatformLibs' - enabled = (project.testTarget == 'wasm32') - useGoldenData = true - source = "jsinterop/math.kt" - flags = ["-r", "$buildDir", "-l", "jsmath"] -} - standaloneTest("interop_libiconv") { enabled = (project.testTarget == null) source = "interop/libiconv.kt" @@ -5357,55 +4971,42 @@ standaloneTest("interop_objc_illegal_sharing") { disabled = !isAppleTarget(project) source = "interop/objc/illegal_sharing.kt" UtilsKt.dependsOnPlatformLibs(it) - if (isExperimentalMM) { - outputChecker = { - it.startsWith("Before") && it.contains("After") - } - } else { - expectedExitStatusChecker = { it != 0 } - outputChecker = { - it.startsWith("Before") && !it.contains("After") - } + outputChecker = { + it.startsWith("Before") && it.contains("After") } } dynamicTest("produce_dynamic") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/simple/hello.kt" cSource = "$projectDir/produce_dynamic/simple/main.c" useGoldenData = true } dynamicTest("kt36639") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-36639/main.kt" cSource = "$projectDir/produce_dynamic/kt-36639/main.c" useGoldenData = true } dynamicTest("kt36878") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-36878/hello.kt" cSource = "$projectDir/produce_dynamic/kt-36878/main.c" useGoldenData = true } dynamicTest("kt39015") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-39015/hello.kt" cSource = "$projectDir/produce_dynamic/kt-39015/main.c" useGoldenData = true } dynamicTest("kt39496") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-39496/hello.kt" cSource = "$projectDir/produce_dynamic/kt-39496/main.c" useGoldenData = true } dynamicTest("kt41904") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-41904/hello.kt" cSource = "$projectDir/produce_dynamic/kt-41904/main.c" useGoldenData = true @@ -5414,7 +5015,6 @@ dynamicTest("kt41904") { for (i in 0..2) { dynamicTest("kt42796_$i") { clangTool = "clang++" - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-42796/main-${i}.kt" cSource = "$projectDir/produce_dynamic/kt-42796/main.cpp" useGoldenData = true @@ -5423,15 +5023,13 @@ for (i in 0..2) { } dynamicTest("kt42830") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "produce_dynamic/kt-42830/box_unbox.kt" cSource = "$projectDir/produce_dynamic/kt-42830/main.c" useGoldenData = true } dynamicTest("produce_dynamic_unhandledException") { - disabled = (project.testTarget == 'wasm32') || // Uses exceptions + dynamic is unsupported for wasm. - (cacheTesting != null) // Disabled due to KT-47828. + disabled = (cacheTesting != null) // Disabled due to KT-47828. source = "produce_dynamic/unhandledException/unhandled.kt" cSource = "$projectDir/produce_dynamic/unhandledException/main.cpp" clangTool = "clang++" @@ -5441,7 +5039,6 @@ dynamicTest("produce_dynamic_unhandledException") { } dynamicTest("interop_concurrentRuntime") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic disabled = true // KT-43180 source = "interop/concurrentTerminate/reverseInterop.kt" cSource = "$projectDir/interop/concurrentTerminate/main.cpp" @@ -5455,7 +5052,6 @@ for (i in ["kt42397", "kt56182_root", "kt56182_package1lvl", "kt56182_subpackage // note: kt56182_root_package1lvl is similar as kt41904 // note: kt56182_subpackage2lvl is similar as kt42796_1 dynamicTest("interop_$i") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "interop/$i/knlibrary.kt" cSource = "$projectDir/interop/$i/test.cpp" clangTool = "clang++" @@ -5463,7 +5059,7 @@ for (i in ["kt42397", "kt56182_root", "kt56182_package1lvl", "kt56182_subpackage } dynamicTest("interop_cleaners_main_thread") { - disabled = (project.testTarget == 'wasm32') || isNoopGC // wasm doesn't support -produce dynamic + disabled = isNoopGC source = "interop/cleaners/cleaners.kt" cSource = "$projectDir/interop/cleaners/main_thread.cpp" clangTool = "clang++" @@ -5472,7 +5068,7 @@ dynamicTest("interop_cleaners_main_thread") { } dynamicTest("interop_cleaners_second_thread") { - disabled = (project.testTarget == 'wasm32') || isNoopGC // wasm doesn't support -produce dynamic + disabled = isNoopGC source = "interop/cleaners/cleaners.kt" cSource = "$projectDir/interop/cleaners/second_thread.cpp" clangTool = "clang++" @@ -5481,7 +5077,6 @@ dynamicTest("interop_cleaners_second_thread") { } dynamicTest("interop_cleaners_leak") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "interop/cleaners/cleaners.kt" cSource = "$projectDir/interop/cleaners/leak.cpp" clangTool = "clang++" @@ -5489,40 +5084,14 @@ dynamicTest("interop_cleaners_leak") { flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative'] } -dynamicTest("interop_migrating_main_thread_legacy") { - disabled = (project.testTarget == 'wasm32') || // wasm doesn't support -produce dynamic - isExperimentalMM // Experimental MM will not support legacy destroy runtime mode. - source = "interop/migrating_main_thread/lib.kt" - flags = ['-Xdestroy-runtime-mode=legacy'] - clangFlags = ['-DIS_LEGACY'] - cSource = "$projectDir/interop/migrating_main_thread/main.cpp" - clangTool = "clang++" -} - dynamicTest("interop_migrating_main_thread") { - disabled = (project.testTarget == 'wasm32') // wasm doesn't support -produce dynamic source = "interop/migrating_main_thread/lib.kt" - flags = ['-Xdestroy-runtime-mode=on-shutdown'] - if (isExperimentalMM) { - clangFlags = ['-DEXPERIMENTAL_MM'] - } + clangFlags = ['-DEXPERIMENTAL_MM'] cSource = "$projectDir/interop/migrating_main_thread/main.cpp" clangTool = "clang++" } -dynamicTest("interop_memory_leaks") { - disabled = (project.testTarget == 'wasm32') || // wasm doesn't support -produce dynamic - isExperimentalMM // Experimental MM will not support legacy destroy runtime mode. - source = "interop/memory_leaks/lib.kt" - cSource = "$projectDir/interop/memory_leaks/main.cpp" - clangTool = "clang++" - flags = ['-Xdestroy-runtime-mode=legacy'] // Runtime cannot be destroyed with interop with on-shutdown. - expectedExitStatusChecker = { it != 0 } - outputChecker = { s -> s.contains("Memory leaks detected, 1 objects leaked!") } -} - dynamicTest("interop_exceptions_throwThroughBridge") { - disabled = (project.testTarget == 'wasm32') // Uses exceptions + dynamic is unsupported for wasm. source = "interop/exceptions/throwThroughBridge.kt" cSource = "$projectDir/interop/exceptions/throwThroughBridge.cpp" clangTool = "clang++" @@ -5532,7 +5101,6 @@ dynamicTest("interop_exceptions_throwThroughBridge") { } dynamicTest("interop_kotlin_exception_hook") { - disabled = (project.testTarget == 'wasm32') // Uses exceptions + dynamic is unsupported for wasm. source = "interop/exceptions/exceptionHook.kt" cSource = "$projectDir/interop/exceptions/exceptionHook.cpp" clangTool = "clang++" @@ -5541,7 +5109,6 @@ dynamicTest("interop_kotlin_exception_hook") { } interopTest("interop_exceptions_cCallback") { - disabled = (project.testTarget == 'wasm32') // Uses exceptions source = "interop/exceptions/cCallback.kt" outputChecker = { s -> s.contains("CATCH IN C++") } interop = "exceptions_cCallback" @@ -5853,8 +5420,8 @@ if (isAppleTarget(project)) { } frameworkTest("testMultipleFrameworksStatic") { - // this test doesn't work with caches. For now caches are enabled only if isExperimentalMM is true, even if cacheTesting is passed - if (cacheTesting != null && isExperimentalMM && !runtimeAssertionsPanic) { + // this test doesn't work with caches. + if (cacheTesting != null && !runtimeAssertionsPanic) { // See https://youtrack.jetbrains.com/issue/KT-34261. expectedExitStatus = 134 } @@ -5989,7 +5556,6 @@ if (isAppleTarget(project)) { } frameworkTest("testKt56233Framework") { - enabled = isExperimentalMM // Fails with legacy MM. It's deprecated, so won't fix. framework("Kt56233") { sources = ['framework/kt56233'] } @@ -6004,7 +5570,7 @@ if (isAppleTarget(project)) { } frameworkTest("testPermanentObjectsFramework") { - enabled = isExperimentalMM && !isNoopGC // Requires gc to actually happen. + enabled = !isNoopGC // Requires gc to actually happen. framework("PermanentObjects") { sources = ['framework/permanentObjects'] opts = ['-opt-in=kotlin.native.internal.InternalForKotlinNative'] @@ -6017,8 +5583,7 @@ if (isAppleTarget(project)) { * Creates tasks to build and execute Harmony regex tests with GTEST logger. */ KotlinNativeTestKt.createTest(project, 'harmonyRegexTest', KonanGTest) { task -> - task.enabled = (project.testTarget != 'wasm32') // Uses exceptions. - && !isAggressiveGC // TODO: Investigate why too slow + task.enabled = !isAggressiveGC // TODO: Investigate why too slow task.useFilter = false task.testLogger = KonanTest.Logger.GTEST @@ -6267,7 +5832,6 @@ Task pluginTest(String name, String pluginName, Closure configureClosure) { } pluginTest("runtime_basic_init", "nopPlugin") { - disabled = (project.testTarget == 'wasm32') source = "runtime/basic/runtime_basic_init.kt" flags = ["-tr"] } @@ -6283,7 +5847,7 @@ Task fileCheckTest(String name, Closure configureClosure) { // Bitcode that is generated in presence of caches or two-stage compilation differs from the "closed world"-generated, // so disable these tests for now. - if (task.enabled && (twoStageEnabled || target.name == 'linux_mips32')) + if (task.enabled && twoStageEnabled) task.enabled = false if (task.enabled) { @@ -6355,18 +5919,18 @@ if (HostManager.@Companion.hostIsMac) { } fileCheckTest("filecheck_redundant_safepoints_removal_smallbinary") { - enabled = isExperimentalMM && project.globalTestArgs.contains("-opt") + enabled = project.globalTestArgs.contains("-opt") annotatedSource = project.file('filecheck/redundant_safepoints.kt') targetName = "watchos_arm32" checkPrefix = "CHECK-SMALLBINARY" - extraOpts = ["-Xbinary=memoryModel=experimental", "-opt"] + extraOpts = ["-opt"] phaseToCheck = "RemoveRedundantSafepoints" } } fileCheckTest("filecheck_redundant_safepoints_removal") { - enabled = isExperimentalMM && isCmsGC && + enabled = isCmsGC && project.globalTestArgs.contains("-opt") && !needSmallBinary(project) annotatedSource = project.file('filecheck/redundant_safepoints.kt') @@ -6595,7 +6159,7 @@ fileCheckTest("filecheck_adopted_function_reference") { } fileCheckTest("filecheck_single_tls_load") { - enabled = isExperimentalMM && project.globalTestArgs.contains("-opt") + enabled = project.globalTestArgs.contains("-opt") annotatedSource = project.file('filecheck/single_tls_load.kt') phaseToCheck = "OptimizeTLSDataLoads" } @@ -6631,7 +6195,6 @@ fileCheckTest("filecheck_signext_zeroext_objc_export") { } fileCheckTest("filecheck_function_attributes_at_callsite") { - enabled = (project.testTarget != 'wasm32') // KT-49739 // attributes for caller and callee might be the same so we allow overlapping. additionalFileCheckFlags = ["--allow-deprecated-dag-overlap"] annotatedSource = project.file('filecheck/function_attributes_at_callsite.kt') diff --git a/kotlin-native/backend.native/tests/interop/memory_leaks/lib.kt b/kotlin-native/backend.native/tests/interop/memory_leaks/lib.kt deleted file mode 100644 index f02b04d9368..00000000000 --- a/kotlin-native/backend.native/tests/interop/memory_leaks/lib.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import kotlinx.cinterop.* -import kotlin.native.Platform - -fun enableMemoryChecker() { - Platform.isMemoryLeakCheckerActive = true -} - -fun leakMemory() { - StableRef.create(Any()) -} diff --git a/kotlin-native/backend.native/tests/interop/memory_leaks/main.cpp b/kotlin-native/backend.native/tests/interop/memory_leaks/main.cpp deleted file mode 100644 index e2fb6c8358f..00000000000 --- a/kotlin-native/backend.native/tests/interop/memory_leaks/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -#include "testlib_api.h" - -#include - -int main() { - std::thread t([]() { - testlib_symbols()->kotlin.root.enableMemoryChecker(); - testlib_symbols()->kotlin.root.leakMemory(); - }); - t.join(); - return 0; -} diff --git a/kotlin-native/backend.native/tests/jsinterop/math.kt b/kotlin-native/backend.native/tests/jsinterop/math.kt deleted file mode 100644 index e337c1b4749..00000000000 --- a/kotlin-native/backend.native/tests/jsinterop/math.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -import kotlinx.interop.wasm.math.* -import kotlinx.wasm.jsinterop.* - -fun main(args: Array) { - - val e = Math.E - val pi = Math.PI - - val sin_pi = Math.sin(pi) - val sin_pi_2 = Math.sin(pi/2) - val ln_1 = Math.log(1.0) - val ln_e = Math.log(e) - - println("e = $e, pi = $pi, sin(pi) = $sin_pi, sin(pi/2) = $sin_pi_2, ln(1) = $ln_1, ln(e) = $ln_e") -} - diff --git a/kotlin-native/backend.native/tests/jsinterop/math.out b/kotlin-native/backend.native/tests/jsinterop/math.out deleted file mode 100644 index 54ecd4c0b51..00000000000 --- a/kotlin-native/backend.native/tests/jsinterop/math.out +++ /dev/null @@ -1 +0,0 @@ -e = 2.718281828459045, pi = 3.141592653589793, sin(pi) = 1.2246467991473532E-16, sin(pi/2) = 1.0, ln(1) = 0.0, ln(e) = 1.0 diff --git a/kotlin-native/backend.native/tests/link/testLib_explicitly2.kt b/kotlin-native/backend.native/tests/link/testLib_explicitly2.kt deleted file mode 100644 index 32d0b4ceb4d..00000000000 --- a/kotlin-native/backend.native/tests/link/testLib_explicitly2.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -fun main(args: Array) { - println("Hello") -} diff --git a/kotlin-native/backend.native/tests/link/testLib_explicitly2.out b/kotlin-native/backend.native/tests/link/testLib_explicitly2.out deleted file mode 100644 index 075c8a88318..00000000000 --- a/kotlin-native/backend.native/tests/link/testLib_explicitly2.out +++ /dev/null @@ -1,4 +0,0 @@ -This is a side effect of a test library linked into the binary. -You should not be seeing this. - -Hello diff --git a/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt b/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt deleted file mode 100644 index fe66843e6a8..00000000000 --- a/kotlin-native/backend.native/tests/runtime/freezing_control/basic.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -@file:OptIn(FreezingIsDeprecated::class) - -import kotlin.test.* -import kotlin.native.concurrent.* -import kotlin.native.internal.Frozen - -class NonFrozenClass - -@Frozen -class FrozenClass - -val globalNonFrozen = NonFrozenClass() -@SharedImmutable -val sharedImmutableNonFrozen = NonFrozenClass() - -val globalFrozen = FrozenClass() -@SharedImmutable -val sharedImmutableFrozen = FrozenClass() - -fun main(args: Array) { - val mode = args.first() - val localNonFrozen = NonFrozenClass() - val localFrozen = FrozenClass() - - when (mode) { - "full" -> { - checkFreezeCheck(localNonFrozen, false, true) - checkFreezeCheck(localFrozen, true, true) - checkFreezeCheck(globalNonFrozen, false, true) - checkFreezeCheck(sharedImmutableNonFrozen, true, true) - checkFreezeCheck(globalFrozen, true, true) - checkFreezeCheck(sharedImmutableFrozen, true, true) - } - "disabled" -> { - checkFreezeCheck(localNonFrozen, false, false) - checkFreezeCheck(localFrozen, false, false) - checkFreezeCheck(globalNonFrozen, false, false) - checkFreezeCheck(sharedImmutableNonFrozen, false, false) - checkFreezeCheck(globalFrozen, false, false) - checkFreezeCheck(sharedImmutableFrozen, false, false) - } - "explicitOnly" -> { - checkFreezeCheck(localNonFrozen, false, true) - checkFreezeCheck(localFrozen, false, true) - checkFreezeCheck(globalNonFrozen, false, true) - checkFreezeCheck(sharedImmutableNonFrozen, false, true) - checkFreezeCheck(globalFrozen, false, true) - checkFreezeCheck(sharedImmutableFrozen, false, true) - } - } -} - -private fun checkFreezeCheck(arg: Any, isFrozenBefore: Boolean, isFrozenAfter: Boolean) { - assertEquals(isFrozenBefore, arg.isFrozen) - arg.freeze() - assertEquals(isFrozenAfter, arg.isFrozen) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/memory/cycle_collector.kt b/kotlin-native/backend.native/tests/runtime/memory/cycle_collector.kt deleted file mode 100644 index 4b06cff68cf..00000000000 --- a/kotlin-native/backend.native/tests/runtime/memory/cycle_collector.kt +++ /dev/null @@ -1,194 +0,0 @@ -@file:OptIn(kotlin.native.runtime.NativeRuntimeApi::class) - -import kotlin.native.concurrent.* -import kotlin.native.runtime.GC -import kotlin.native.Platform -import kotlin.test.* - -fun test1() { - val a = AtomicReference(null) - val b = AtomicReference(null) - a.value = b - b.value = a -} - -class Holder(var other: Any?) - -fun test2() { - val array = arrayOf(AtomicReference(null), AtomicReference(null)) - val obj1 = Holder(array).freeze() - array[0].value = obj1 -} - -fun test3() { - val a1 = FreezableAtomicReference(null) - val head = Holder(null) - var current = head - repeat(30) { - val next = Holder(null) - current.other = next - current = next - } - a1.value = head - current.other = a1 - current.freeze() -} - - -fun makeIt(): Holder { - val atomic = AtomicReference(null) - val holder = Holder(atomic).freeze() - atomic.value = holder - return holder -} - - -fun test4() { - val holder = makeIt() - // To clean rc count coming from rememberNewContainer(). - kotlin.native.runtime.GC.collect() - // Request cyclic collection. - kotlin.native.runtime.GC.collectCyclic() - // Ensure we processed delayed release. - repeat(10) { - // Wait a bit and process queue. - Worker.current.park(10) - Worker.current.processQueue() - kotlin.native.runtime.GC.collect() - } - val value = @Suppress("UNCHECKED_CAST") (holder.other as? AtomicReference?) - assertTrue(value != null) - assertTrue(value.value == holder) -} - -fun createRef(): AtomicReference { - val atomic1 = AtomicReference(null) - val atomic2 = AtomicReference(null) - atomic1.value = atomic2 - atomic2.value = atomic1 - return atomic1 -} - -class Holder2(var value: AtomicReference) { - fun switch() { - value = value.value as AtomicReference - } -} - -fun createHolder2() = Holder2(createRef()) - -fun test5() { - val holder = createHolder2() - kotlin.native.runtime.GC.collect() - kotlin.native.runtime.GC.collectCyclic() - Worker.current.park(100 * 1000) - holder.switch() - kotlin.native.runtime.GC.collect() - Worker.current.park(100 * 1000) - withWorker { - executeAfter(0L, { - kotlin.native.runtime.GC.collect() - }.freeze()) - } - Worker.current.park(1000) - assertTrue(holder.value.value != null) -} - -fun test6() { - val atomic = AtomicReference(null) - atomic.value = Pair(atomic, Holder(atomic)).freeze() -} - -fun createRoot(): AtomicReference { - val ref1 = AtomicReference(null) - val ref2 = AtomicReference(null) - - ref1.value = Holder(ref2).freeze() - ref2.value = Any().freeze() - - return ref1 -} - -fun test7() { - val ref1 = createRoot() - kotlin.native.runtime.GC.collect() - - kotlin.native.runtime.GC.collectCyclic() - Worker.current.park(500 * 1000L) - - withWorker { - executeAfter(0L, {}.freeze()) - Worker.current.park(500 * 1000L) - - val node = ref1.value as Holder - val ref2 = node.other as AtomicReference - assertTrue(ref2.value != null) - } -} - -fun array(size: Int) = Array(size, { null }) - -fun test8() { - val ref = AtomicReference(null) - val obj1 = array(2) - val obj2 = array(1) - val obj3 = array(2) - - obj1[0] = obj2 - obj1[1] = obj3 - - obj2[0] = obj3 - - obj3[0] = obj2 - obj3[1] = ref - - ref.value = obj1.freeze() -} - -fun createNode1(): Holder { - val ref = AtomicReference(null) - val node2 = Holder(ref) - val node1 = Holder(node2) - ref.value = node1.freeze() - - return node1 -} - -fun getNode2(): Holder { - val node1 = createNode1() - GC.collect() - - return node1.other as Holder -} - -fun test9() { - withWorker { - val node2 = getNode2() - executeAfter(10 * 1000L, { GC.collectCyclic() }.freeze()) - - GC.collect() - - Worker.current.park(50 * 1000L) - - execute(TransferMode.SAFE, {}, {}).result - - val ref = node2.other as AtomicReference - assertTrue(ref.value != null) - } -} - -fun main() { - Platform.isMemoryLeakCheckerActive = true - kotlin.native.runtime.GC.cyclicCollectorEnabled = true - test1() - test2() - test3() - test4() - repeat(10) { - test5() - } - test6() - test7() - test8() - test9() -} diff --git a/kotlin-native/backend.native/tests/runtime/memory/cycle_collector_deadlock1.kt b/kotlin-native/backend.native/tests/runtime/memory/cycle_collector_deadlock1.kt deleted file mode 100644 index 21610113993..00000000000 --- a/kotlin-native/backend.native/tests/runtime/memory/cycle_collector_deadlock1.kt +++ /dev/null @@ -1,16 +0,0 @@ -import kotlin.native.concurrent.* -import kotlin.test.* - -@OptIn(kotlin.native.runtime.NativeRuntimeApi::class) -fun main() { - kotlin.native.runtime.GC.cyclicCollectorEnabled = true - - repeat(10000) { - // Create atomic cyclic garbage: - val ref = AtomicReference(null) - ref.value = ref - } - - // main thread will then run cycle collector termination, which involves running it and cleaning everything up. - // 10000 references should hit [kGcThreshold] then. -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/memory/cycle_detector.kt b/kotlin-native/backend.native/tests/runtime/memory/cycle_detector.kt deleted file mode 100644 index 52cb14c2ca5..00000000000 --- a/kotlin-native/backend.native/tests/runtime/memory/cycle_detector.kt +++ /dev/null @@ -1,201 +0,0 @@ -@file:OptIn(kotlin.native.runtime.NativeRuntimeApi::class) - -import kotlin.native.concurrent.* -import kotlin.native.runtime.GC -import kotlin.native.Platform -import kotlin.test.* - -class Holder(var other: Any?) - -class Holder2(var field1: Any?, var field2: Any?) - -val Array.description: String - get() { - val result = StringBuilder() - result.append('[') - for (elem in this) { - result.append(elem.toString()) - result.append(',') - } - result.append(']') - return result.toString() - } - -fun assertArrayEquals( - expected: Array, - actual: Array -): Unit { - val lazyMessage: () -> String? = { - "Expected <${expected.description}>, actual <${actual.description}>." - } - - asserter.assertTrue(lazyMessage, expected.size == actual.size) - for (i in expected.indices) { - asserter.assertTrue(lazyMessage, expected[i] == actual[i]) - } -} - -@BeforeTest -fun enableMemoryChecker() { - Platform.isMemoryLeakCheckerActive = true -} - -@Test -fun noCycles() { - val atomic1 = AtomicReference(null) - val atomic2 = AtomicReference(null) - try { - atomic1.value = atomic2 - val cycles = GC.detectCycles()!! - assertEquals(0, cycles.size) - assertNull(GC.findCycle(atomic1)); - assertNull(GC.findCycle(atomic2)); - } finally { - atomic1.value = null - atomic2.value = null - } -} - -@Test -fun oneCycle() { - val atomic = AtomicReference(null) - try { - atomic.value = atomic - val cycles = GC.detectCycles()!! - assertEquals(1, cycles.size) - assertArrayEquals(arrayOf(atomic, atomic), GC.findCycle(cycles[0])!!) - } finally { - atomic.value = null - } -} - -@Test -fun oneCycleWithHolder() { - val atomic = AtomicReference(null) - try { - atomic.value = Holder(atomic).freeze() - val cycles = GC.detectCycles()!! - assertEquals(1, cycles.size) - assertArrayEquals(arrayOf(atomic, atomic.value!!, atomic), GC.findCycle(cycles[0])!!) - assertArrayEquals(arrayOf(atomic.value!!, atomic, atomic.value!!), GC.findCycle(atomic.value!!)!!) - } finally { - atomic.value = null - } -} - -@Test -fun oneCycleWithArray() { - val array = arrayOf(AtomicReference(null), AtomicReference(null)) - try { - array[0].value = Holder(array).freeze() - val cycles = GC.detectCycles()!! - assertEquals(1, cycles.size) - assertArrayEquals(arrayOf(array[0], array[0].value!!, array, array[0]), GC.findCycle(cycles[0])!!) - } finally { - array[0].value = null - array[1].value = null - } -} - -@Test -fun oneCycleWithLongChain() { - val atomic = AtomicReference(null) - try { - val head = Holder(null) - var current = head - repeat(30) { - val next = Holder(null) - current.other = next - current = next - } - current.other = atomic - atomic.value = head.freeze() - val cycles = GC.detectCycles()!! - assertEquals(1, cycles.size) - val cycle = GC.findCycle(cycles[0])!! - assertEquals(33, cycle.size) - } finally { - atomic.value = null - } -} - -@Test -fun twoCycles() { - val atomic1 = AtomicReference(null) - val atomic2 = AtomicReference(null) - try { - atomic1.value = atomic2 - atomic2.value = atomic1 - val cycles = GC.detectCycles()!! - assertEquals(2, cycles.size) - assertArrayEquals(arrayOf(atomic2, atomic1, atomic2), GC.findCycle(cycles[0])!!) - assertArrayEquals(arrayOf(atomic1, atomic2, atomic1), GC.findCycle(cycles[1])!!) - } finally { - atomic1.value = null - atomic2.value = null - } -} - -@Test -fun twoCyclesWithHolder() { - val atomic1 = AtomicReference(null) - val atomic2 = AtomicReference(null) - try { - atomic1.value = atomic2 - atomic2.value = Holder(atomic1).freeze() - val cycles = GC.detectCycles()!! - assertEquals(2, cycles.size) - assertArrayEquals(arrayOf(atomic2, atomic2.value!!, atomic1, atomic2), GC.findCycle(cycles[0])!!) - assertArrayEquals(arrayOf(atomic1, atomic2, atomic2.value!!, atomic1), GC.findCycle(cycles[1])!!) - } finally { - atomic1.value = null - atomic2.value = null - } -} - -@Test -fun threeSeparateCycles() { - val atomic1 = AtomicReference(null) - val atomic2 = AtomicReference(null) - val atomic3 = AtomicReference(null) - try { - atomic1.value = atomic1 - atomic2.value = Holder2(atomic1, atomic2).freeze() - atomic3.value = Holder2(atomic3, atomic1).freeze() - val cycles = GC.detectCycles()!! - assertEquals(3, cycles.size) - assertArrayEquals(arrayOf(atomic3, atomic3.value!!, atomic3), GC.findCycle(cycles[0])!!) - assertArrayEquals(arrayOf(atomic2, atomic2.value!!, atomic2), GC.findCycle(cycles[1])!!) - assertArrayEquals(arrayOf(atomic1, atomic1), GC.findCycle(cycles[2])!!) - } finally { - atomic1.value = null - atomic2.value = null - atomic3.value = null - } -} - -@Test -fun noCyclesWithFreezableAtomicReference() { - val atomic = FreezableAtomicReference(null) - try { - atomic.value = atomic - val cycles = GC.detectCycles()!! - assertEquals(0, cycles.size) - } finally { - atomic.value = null - } -} - -@Test -fun oneCycleWithFrozenFreezableAtomicReference() { - val atomic = FreezableAtomicReference(null) - try { - atomic.value = atomic - atomic.freeze() - val cycles = GC.detectCycles()!! - assertEquals(1, cycles.size) - assertArrayEquals(arrayOf(atomic, atomic), GC.findCycle(cycles[0])!!) - } finally { - atomic.value = null - } -} diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt deleted file mode 100644 index 2942bdc8b5a..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze0.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class) - -package runtime.workers.freeze0 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -data class SharedDataMember(val double: Double) - -data class SharedData(val string: String, val int: Int, val member: SharedDataMember) - -@Test fun runTest() { - val worker = Worker.start() - // Create immutable shared data. - val immutable = SharedData("Hello", 10, SharedDataMember(0.1)).freeze() - println("frozen bit is ${immutable.isFrozen}") - - val future = worker.execute(TransferMode.SAFE, { immutable } ) { - input -> - println("Worker: $input") - input - } - future.consume { - result -> println("Main: $result") - } - worker.requestTermination().result - println("OK") -} diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze0.out b/kotlin-native/backend.native/tests/runtime/workers/freeze0.out deleted file mode 100644 index b7f896936ad..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze0.out +++ /dev/null @@ -1,4 +0,0 @@ -frozen bit is true -Worker: SharedData(string=Hello, int=10, member=SharedDataMember(double=0.1)) -Main: SharedData(string=Hello, int=10, member=SharedDataMember(double=0.1)) -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt deleted file mode 100644 index 82cfc3fad21..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze1.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class) - -package runtime.workers.freeze1 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -data class Node(var previous: Node?, var data: Int) - -fun makeCycle(count: Int): Node { - val first = Node(null, 0) - var current = first - for (index in 1 .. count - 1) { - current = Node(current, index) - } - first.previous = current - return first -} - -data class Node2(var leaf1: Node2?, var leaf2: Node2?) - -fun makeDiamond(): Node2 { - val bottom = Node2(null, null) - val mid1prime = Node2(bottom, null) - val mid1 = Node2(mid1prime, null) - val mid2 = Node2(bottom, null) - return Node2(mid1, mid2) -} - -@Test fun runTest() { - makeCycle(10).freeze() - - // Must be able to freeze diamond shaped graph. - val diamond = makeDiamond().freeze() - - val immutable = Node(null, 4).freeze() - try { - immutable.data = 42 - } catch (e: InvalidMutabilityException) { - println("OK, cannot mutate frozen") - } -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze1.out b/kotlin-native/backend.native/tests/runtime/workers/freeze1.out deleted file mode 100644 index 0d08b329132..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze1.out +++ /dev/null @@ -1 +0,0 @@ -OK, cannot mutate frozen diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt deleted file mode 100644 index 969dae22d9d..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze2.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class) - -package runtime.workers.freeze2 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -data class Data(var int: Int) - -@Test fun runTest() { - // Ensure that we can not mutate frozen objects and arrays. - val a0 = Data(2) - a0.int++ - a0.freeze() - assertFailsWith {a0.int++ } - - val a1 = ByteArray(2) - a1[1]++ - a1.freeze() - assertFailsWith { a1[1]++ } - - val a2 = ShortArray(2) - a2[1]++ - a2.freeze() - assertFailsWith { a2[1]++ } - - val a3 = IntArray(2) - a3[1]++ - a3.freeze() - assertFailsWith { a3[1]++ } - - val a4 = LongArray(2) - a4[1]++ - a4.freeze() - assertFailsWith { a4[1]++ } - - val a5 = BooleanArray(2) - a5[1] = true - a5.freeze() - assertFailsWith { a5[1] = false } - - val a6 = CharArray(2) - a6[1] = 'a' - a6.freeze() - assertFailsWith { a6[1] = 'b' } - - val a7 = FloatArray(2) - a7[1] = 1.0f - a7.freeze() - assertFailsWith { a7[1] = 2.0f } - - val a8 = DoubleArray(2) - a8[1] = 1.0 - a8.freeze() - assertFailsWith { a8[1] = 2.0 } - - // Ensure that String and integral boxes are frozen by default, by passing local to the worker. - val worker = Worker.start() - var data: Any = "Hello" + " " + "world" - assertTrue(data.isFrozen) - worker.execute(TransferMode.SAFE, { data } ) { - input -> println("Worker 1: $input") - }.result - - data = 42 - assertTrue(data.isFrozen) - worker.execute(TransferMode.SAFE, { data } ) { - input -> println("Worker2: $input") - }.result - - data = 239.0 - assertTrue(data.isFrozen) - worker.execute(TransferMode.SAFE, { data } ) { - input -> println("Worker3: $input") - }.result - - data = 'a' - assertTrue(data.isFrozen) - worker.execute(TransferMode.SAFE, { data } ) { - input -> println("Worker4: $input") - }.result - - worker.requestTermination().result - - println("OK") -} diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze2.out b/kotlin-native/backend.native/tests/runtime/workers/freeze2.out deleted file mode 100644 index bb2e80aa642..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze2.out +++ /dev/null @@ -1,5 +0,0 @@ -Worker 1: Hello world -Worker2: 42 -Worker3: 239.0 -Worker4: a -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt deleted file mode 100644 index 41fb32433f0..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze3.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class) - -package runtime.workers.freeze3 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -object AnObject { - var x = 1 -} - -@ThreadLocal -object Mutable { - var x = 2 -} - -val topLevelInline: ULong = 0xc3a5c85c97cb3127U - -@Test fun runTest1() { - assertEquals(1, AnObject.x) - if (Platform.memoryModel == MemoryModel.STRICT) { - assertFailsWith { - AnObject.x++ - } - assertEquals(1, AnObject.x) - } else { - AnObject.x++ - assertEquals(2, AnObject.x) - } - - Mutable.x++ - assertEquals(3, Mutable.x) - println("OK") -} - -@Test fun runTest2() { - val ok = AtomicInt(0) - withWorker() { - executeAfter(0, { - assertEquals(0xc3a5c85c97cb3127U, topLevelInline) - ok.increment() - }.freeze()) - } - assertEquals(1, ok.value) -} - diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze3.out b/kotlin-native/backend.native/tests/runtime/workers/freeze3.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze3.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt deleted file mode 100644 index 8f49eaae653..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze4.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class) - -package runtime.workers.freeze4 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -data class Data(val x: Int, val s: String, val next: Data? = null) - -@Test fun runTest() { - val data1 = Data(1, "") - data1.freeze() - assertFailsWith { - data1.ensureNeverFrozen() - } - - val dataNF = Data(42, "42") - dataNF.ensureNeverFrozen() - val data2 = Data(2, "2", dataNF) - assertFailsWith { - data2.freeze() - } - assert(!data2.isFrozen) - println("OK") -} diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze4.out b/kotlin-native/backend.native/tests/runtime/workers/freeze4.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze4.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze5.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze5.kt deleted file mode 100644 index e8ad3bca269..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze5.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -package runtime.workers.freeze5 - -import kotlin.test.* - -object Keys { - internal val myMap: Map> = mapOf( - "val1" to listOf("a1", "a2", "a3"), - "val2" to listOf("b1", "b2") - ) - - fun getKey(name: String): String { - for (key in myMap.keys) { - if (key == name) { - return key - } - } - return "" - } - - fun getValue(name: String): String { - for (value in myMap.values) { - if (value.contains(name)) { - return name - } - } - return "" - } - - fun getEntry(name: String): String { - for (entry in myMap.entries) { - if (entry.key == name) { - return entry.key - } - } - return "" - } -} -@Test fun runTest() { - assertEquals("val2", Keys.getKey("val2")) - assertEquals("a1", Keys.getValue("a1")) - assertEquals("val1", Keys.getEntry("val1")) - println("OK") -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze5.out b/kotlin-native/backend.native/tests/runtime/workers/freeze5.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze5.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt deleted file mode 100644 index a4b5006b41f..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze6.kt +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class, kotlin.native.runtime.NativeRuntimeApi::class) - -package runtime.workers.freeze6 - -import kotlin.test.* -import kotlin.native.concurrent.* -import kotlin.native.ref.* - -data class Hi(val s: String) -data class Nested(val hi: Hi) - -@Test -fun ensureNeverFrozenNoFreezeChild(){ - val noFreeze = Hi("qwert") - noFreeze.ensureNeverFrozen() - - val nested = Nested(noFreeze) - assertFails { nested.freeze() } - - println("OK") -} - -@Test -fun ensureNeverFrozenFailsTarget(){ - val noFreeze = Hi("qwert") - noFreeze.ensureNeverFrozen() - - assertFalse(noFreeze.isFrozen) - assertFails { noFreeze.freeze() } - assertFalse(noFreeze.isFrozen) - println("OK") -} - -fun createRef1(): FreezableAtomicReference { - val ref = FreezableAtomicReference(null) - ref.value = ref - ref.freeze() - ref.value = null - return ref -} - -var global = 0 - -@Test -fun ensureFreezableHandlesCycles1() { - val ref = createRef1() - kotlin.native.runtime.GC.collect() - - val obj: Any = ref - global = obj.hashCode() -} - -class Node(var ref: Any?) - -/** - * ref1 -> Node <- ref3 - * | /\ - * V | - * ref2 --- - */ -fun createRef2(): Pair, Any> { - val ref1 = FreezableAtomicReference(null) - - val node = Node(null) - val ref3 = FreezableAtomicReference(node) - val ref2 = FreezableAtomicReference(ref3) - - node.ref = ref2 - ref1.value = node - - ref1.freeze() - ref3.value = null - - assertTrue(node.isFrozen) - assertTrue(ref1.isFrozen) - assertTrue(ref2.isFrozen) - assertTrue(ref3.isFrozen) - - return ref1 to ref2 -} - -@Test -fun ensureFreezableHandlesCycles2() { - val (ref, obj) = createRef2() - kotlin.native.runtime.GC.collect() - - assertTrue(obj.toString().length > 0) - global = ref.value!!.ref!!.hashCode() -} - -fun createRef3(): FreezableAtomicReference { - val ref = FreezableAtomicReference(null) - val node = Node(ref) - ref.value = node - ref.freeze() - - assertTrue(node.isFrozen) - assertTrue(ref.isFrozen) - - return ref -} - -@Test -fun ensureFreezableHandlesCycles3() { - val ref = createRef3() - ref.value = null - kotlin.native.runtime.GC.collect() - - val obj: Any = ref - assertTrue(obj.toString().length > 0) - global = obj.hashCode() -} - -lateinit var weakRef: WeakReference - -fun createRef4(): FreezableAtomicReference { - val ref = FreezableAtomicReference(null) - val node = Node(ref) - weakRef = WeakReference(node) - ref.value = node - ref.freeze() - assertTrue(weakRef.get() != null) - return ref -} - -@Test -fun ensureWeakRefNotLeaks1() { - val ref = createRef4() - ref.value = null - // We cannot check weakRef.get() here, as value read will be stored in the stack slot, - // and thus hold weak reference from release. - kotlin.native.runtime.GC.collect() - - assertTrue(weakRef.get() == null) -} - -lateinit var node1: Node -lateinit var weakNode2: WeakReference - -fun createRef5() { - val ref = FreezableAtomicReference(null) - node1 = Node(ref) - val node2 = Node(node1) - weakNode2 = WeakReference(node2) - ref.value = node2 - node1.freeze() - assertTrue(weakNode2.get() != null) - ref.value = null -} - -@Test -fun ensureWeakRefNotLeaks2() { - createRef5() - kotlin.native.runtime.GC.collect() - assertTrue(weakNode2.get() == null) -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze6.out b/kotlin-native/backend.native/tests/runtime/workers/freeze6.out deleted file mode 100644 index 2c94e483710..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze6.out +++ /dev/null @@ -1,2 +0,0 @@ -OK -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt b/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt deleted file mode 100644 index af6ad8a3769..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.kt +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ -@file:OptIn(FreezingIsDeprecated::class) - -package runtime.workers.freeze_stress - -import kotlin.test.* - -import kotlin.native.concurrent.* - -class Random(private var seed: Int) { - fun next(): Int { - seed = (1103515245 * seed + 12345) and 0x7fffffff - return seed - } - - fun next(maxExclusiveValue: Int) = if (maxExclusiveValue == 0) 0 else next() % maxExclusiveValue - - fun next(minInclusiveValue: Int, maxInclusiveValue: Int) = - minInclusiveValue + next(maxInclusiveValue - minInclusiveValue + 1) -} - -class Node(val id: Int) { - var numberOfEdges = 0 - - lateinit var edge0: Node - lateinit var edge1: Node - lateinit var edge2: Node - lateinit var edge3: Node - lateinit var edge4: Node - lateinit var edge5: Node - lateinit var edge6: Node - lateinit var edge7: Node - lateinit var edge8: Node - lateinit var edge9: Node - - fun addEdge(child: Node) { - when (numberOfEdges) { - 0 -> edge0 = child - 1 -> edge1 = child - 2 -> edge2 = child - 3 -> edge3 = child - 4 -> edge4 = child - 5 -> edge5 = child - 6 -> edge6 = child - 7 -> edge7 = child - 8 -> edge8 = child - 9 -> edge9 = child - else -> error("Too many edges") - } - ++numberOfEdges - } - - fun getEdges(): List { - val result = mutableListOf() - if (numberOfEdges > 0) result += edge0 - if (numberOfEdges > 1) result += edge1 - if (numberOfEdges > 2) result += edge2 - if (numberOfEdges > 3) result += edge3 - if (numberOfEdges > 4) result += edge4 - if (numberOfEdges > 5) result += edge5 - if (numberOfEdges > 6) result += edge6 - if (numberOfEdges > 7) result += edge7 - if (numberOfEdges > 8) result += edge8 - if (numberOfEdges > 9) result += edge9 - return result - } -} - -class Graph(val nodes: List, val roots: List) - -fun min(x: Int, y: Int) = if (x < y) x else y -fun max(x: Int, y: Int) = if (x > y) x else y - -@ThreadLocal -val random = Random(42) - -fun generate(condensationSize: Int, branchingFactor: Int, swellingFactor: Int): Graph { - var id = 0 - val nodes = mutableListOf() - - fun genDAG(n: Int): Node { - val node = Node(id++) - nodes += node - if (n == 1) return node - val numberOfChildren = random.next(1, min(n - 1, branchingFactor)) - val used = BooleanArray(n) - val points = IntArray(numberOfChildren + 1) - points[0] = 0 - points[numberOfChildren] = n - 1 - used[0] = true - used[n - 1] = true - for (i in 1 until numberOfChildren) { - var p: Int - do { - p = random.next(1, n - 1) - } while (used[p]) - used[p] = true - points[i] = p - } - points.sort() - for (i in 1..numberOfChildren) { - val childSize = points[i] - points[i - 1] - val child = genDAG(childSize) - if (random.next(2) == 0) - node.addEdge(child) - else - child.addEdge(node) - } - return node - } - - genDAG(condensationSize) - - val numberOfEnters = IntArray(condensationSize) - for (node in nodes) - for (edge in node.getEdges()) - ++numberOfEnters[edge.id] - val roots = nodes.filter { numberOfEnters[it.id] == 0 } - for (i in 0 until condensationSize) { - val node = nodes[i] - val componentSize = random.next(1, swellingFactor) - if (componentSize == 1 && random.next(2) == 0) - continue - val component = Array(componentSize) { - if (it == 0) node else Node(id++).also { nodes += it } - } - for (j in 0 until componentSize) - component[j].addEdge(component[(j - 1 + componentSize) % componentSize]) - val numberOfAdditionalEdges = random.next((componentSize + 1) / 2) - for (j in 0 until numberOfAdditionalEdges) - component[random.next(componentSize)].addEdge(component[random.next(componentSize)]) - } - - return Graph(nodes, roots) -} - -fun freezeOneGraph() { - val graph = generate(100, 5, 20) - graph.roots.forEach { it.freeze() } - for (node in graph.nodes) - assert (node.isFrozen, { "All nodes should be frozen" }) -} - -@Test fun runTest() { - for (i in 0..1000) { - freezeOneGraph() - } - println("OK") -} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.out b/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.out deleted file mode 100644 index d86bac9de59..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/freeze_stress.out +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker9.kt b/kotlin-native/backend.native/tests/runtime/workers/worker9.kt deleted file mode 100644 index c027f0c3028..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/worker9.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the LICENSE file. - */ - -@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class) -package runtime.workers.worker9 - -import kotlin.test.* - -import kotlin.native.concurrent.* - -@Test fun runTest1() { - withLock { println("zzz") } - val worker = Worker.start() - val future = worker.execute(TransferMode.SAFE, {}) { - withLock { - println("42") - } - } - future.result - worker.requestTermination().result - println("OK") -} - -fun withLock(op: () -> Unit) { - op() -} - -@Test fun runTest2() { - val worker = Worker.start() - val future = worker.execute(TransferMode.SAFE, {}) { - val me = Worker.current - var x = 1 - me.executeAfter (20000) { - println("second ${++x}") - } - me.executeAfter(10000) { - println("first ${++x}") - } - } - worker.requestTermination().result -} - -@Test fun runTest3() { - val worker = Worker.start() - if (Platform.memoryModel == MemoryModel.EXPERIMENTAL) { - worker.executeAfter { - println("unfrozen OK") - } - } else { - assertFailsWith { - val message = "shall not happen" - worker.executeAfter { - println(message) - } - } - } - assertFailsWith { - val message = "shall not happen" - worker.executeAfter(-1, { - println(message) - }.freeze()) - } - - worker.executeAfter(0, { - println("frozen OK") - }.freeze()) - - worker.requestTermination().result -} - -class Node(var node: Node?, var outher: Node?) - -fun makeCyclic(): Node { - val inner = Node(null, null) - inner.node = inner - val outer = Node(null, null) - inner.outher = outer - return outer -} - -@OptIn(kotlin.native.runtime.NativeRuntimeApi::class) -@Test fun runTest4() { - val worker = Worker.start() - - val future = worker.execute(TransferMode.SAFE, { }) { - makeCyclic().also { - kotlin.native.runtime.GC.collect() - } - } - assert(future.result != null) - worker.requestTermination().result -} diff --git a/kotlin-native/backend.native/tests/runtime/workers/worker9.out b/kotlin-native/backend.native/tests/runtime/workers/worker9.out deleted file mode 100644 index 5de80692a48..00000000000 --- a/kotlin-native/backend.native/tests/runtime/workers/worker9.out +++ /dev/null @@ -1,6 +0,0 @@ -zzz -42 -OK -first 2 -second 3 -frozen OK diff --git a/kotlin-native/backend.native/tests/samples/build.gradle.kts b/kotlin-native/backend.native/tests/samples/build.gradle.kts index 7263274956b..26b36167004 100644 --- a/kotlin-native/backend.native/tests/samples/build.gradle.kts +++ b/kotlin-native/backend.native/tests/samples/build.gradle.kts @@ -46,7 +46,6 @@ val buildSamplesWithPlatformLibs by tasks.creating { } dependsOn(":echoServer:assemble") dependsOn(":globalState:assemble") - dependsOn(":html5Canvas:assemble") dependsOn(":workers:assemble") if (isMacos || isLinux) { diff --git a/kotlin-native/backend.native/tests/samples/echoServer/build.gradle.kts b/kotlin-native/backend.native/tests/samples/echoServer/build.gradle.kts index b25f6ad6b7d..eb3ecc2561a 100644 --- a/kotlin-native/backend.native/tests/samples/echoServer/build.gradle.kts +++ b/kotlin-native/backend.native/tests/samples/echoServer/build.gradle.kts @@ -4,8 +4,7 @@ plugins { kotlin("multiplatform") } -// Add two additional presets for Raspberry Pi and Linux/ARM64. -val raspberryPiPresets: List = listOf("linuxArm32Hfp", "linuxArm64").map { +val additionalPresets: List = listOf("linuxArm64").map { kotlin.presets[it] as KotlinNativeTargetPreset } @@ -22,13 +21,13 @@ kotlin { } // Create cross-targets. - val raspberryPiTargets = raspberryPiPresets.map { preset -> + val additionalTargets = additionalPresets.map { preset -> val targetName = "echoServer${preset.name.capitalize()}" targetFromPreset(preset, targetName) {} } // Configure executables for all targets. - configure(raspberryPiTargets + listOf(hostTarget)) { + configure(additionalTargets + listOf(hostTarget)) { binaries { executable { entryPoint = "sample.echoserver.main" @@ -39,7 +38,7 @@ kotlin { sourceSets { val echoServerMain by getting - raspberryPiPresets.forEach { preset -> + additionalPresets.forEach { preset -> val mainSourceSetName = "echoServer${preset.name.capitalize()}Main" getByName(mainSourceSetName).dependsOn(echoServerMain) } diff --git a/kotlin-native/backend.native/tests/samples/html5Canvas/build.gradle.kts b/kotlin-native/backend.native/tests/samples/html5Canvas/build.gradle.kts deleted file mode 100644 index c9c83a6e1f9..00000000000 --- a/kotlin-native/backend.native/tests/samples/html5Canvas/build.gradle.kts +++ /dev/null @@ -1,92 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile -import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget -import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile - -plugins { - kotlin("multiplatform") -} - -val hostOs = System.getProperty("os.name") -val isWindows = hostOs.startsWith("Windows") - -val packageName = "kotlinx.interop.wasm.dom" -val jsinteropKlibFile = buildDir.resolve("klib").resolve("$packageName-jsinterop.klib") - -kotlin { - wasm32("html5Canvas") { - binaries { - executable { - entryPoint = "sample.html5canvas.main" - } - } - } - jvm("httpServer") - sourceSets { - val html5CanvasMain by getting { - dependencies { - implementation(files(jsinteropKlibFile)) - } - } - val httpServerMain by getting { - dependencies { - implementation("io.ktor:ktor-server-netty:1.2.1") - } - } - } -} - -val jsinterop by tasks.creating(Exec::class) { - workingDir = projectDir - - val ext = if (isWindows) ".bat" else "" - val distributionPath = project.properties["kotlin.native.home"] as String? - - if (distributionPath != null) { - val jsinteropCommand = file(distributionPath).resolve("bin").resolve("jsinterop$ext") - - inputs.property("jsinteropCommand", jsinteropCommand) - inputs.property("jsinteropPackageName", packageName) - outputs.file(jsinteropKlibFile) - - commandLine( - jsinteropCommand, - "-pkg", packageName, - "-o", jsinteropKlibFile, - "-target", "wasm32" - ) - } else { - doFirst { - // Abort build execution if the distribution path isn't specified. - throw GradleException( - """ - | - |Kotlin/Native distribution path must be specified to build the JavaScript interop. - |Use 'kotlin.native.home' project property to specify it. - """.trimMargin() - ) - } - } -} - -tasks.withType(AbstractKotlinNativeCompile::class).all { - dependsOn(jsinterop) -} - -val assemble by tasks.getting - -// This is to run embedded HTTP server with Ktor: -val runProgram by tasks.creating(JavaExec::class) { - dependsOn(assemble) - - val httpServer: KotlinJvmTarget by kotlin.targets - val httpServerMainCompilation = httpServer.compilations["main"] - - main = "sample.html5canvas.httpserver.HttpServer" - classpath = files(httpServerMainCompilation.output) + httpServerMainCompilation.runtimeDependencyFiles - args = listOf(projectDir.toString()) -} - -tasks.withType(KotlinJvmCompile::class).all { - runProgram.dependsOn(this) - kotlinOptions.jvmTarget = "1.8" -} diff --git a/kotlin-native/backend.native/tests/samples/html5Canvas/gradle.properties b/kotlin-native/backend.native/tests/samples/html5Canvas/gradle.properties deleted file mode 100644 index 790a07d5124..00000000000 --- a/kotlin-native/backend.native/tests/samples/html5Canvas/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -kotlin.code.style=official -kotlin.import.noCommonSourceSets=true diff --git a/kotlin-native/backend.native/tests/samples/html5Canvas/index.html b/kotlin-native/backend.native/tests/samples/html5Canvas/index.html deleted file mode 100644 index a51ba19f7a6..00000000000 --- a/kotlin-native/backend.native/tests/samples/html5Canvas/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - -

Draw something using the mouse!

- - - diff --git a/kotlin-native/backend.native/tests/samples/html5Canvas/src/html5CanvasMain/kotlin/main.kt b/kotlin-native/backend.native/tests/samples/html5Canvas/src/html5CanvasMain/kotlin/main.kt deleted file mode 100644 index 4104fb998ca..00000000000 --- a/kotlin-native/backend.native/tests/samples/html5Canvas/src/html5CanvasMain/kotlin/main.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package sample.html5canvas - -import kotlinx.interop.wasm.dom.* -import kotlinx.wasm.jsinterop.* - -fun main() { - - val canvas = document.getElementById("myCanvas").asCanvas - val ctx = canvas.getContext("2d") - val rect = canvas.getBoundingClientRect() - val rectLeft = rect.left - val rectTop = rect.top - - var mouseX: Int = 0 - var mouseY: Int = 0 - var draw: Boolean = false - - document.setter("onmousemove") { arguments: ArrayList -> - val event = MouseEvent(arguments[0]) - mouseX = event.getInt("clientX") - rectLeft - mouseY = event.getInt("clientY") - rectTop - - if (mouseX < 0) mouseX = 0 - if (mouseX > 639) mouseX = 639 - if (mouseY < 0) mouseY = 0 - if (mouseY > 479) mouseY = 479 - } - - document.setter("onmousedown") { - draw = true - } - - document.setter("onmouseup") { - draw = false - } - - setInterval(10) { - if (draw) { - ctx.strokeStyle = "#222222" - ctx.lineTo(mouseX, mouseY) - ctx.stroke() - } else { - ctx.moveTo(mouseX, mouseY) - ctx.stroke() - } - } -} - diff --git a/kotlin-native/backend.native/tests/samples/html5Canvas/src/httpServerMain/kotlin/HttpServer.kt b/kotlin-native/backend.native/tests/samples/html5Canvas/src/httpServerMain/kotlin/HttpServer.kt deleted file mode 100644 index a9e76dc20ba..00000000000 --- a/kotlin-native/backend.native/tests/samples/html5Canvas/src/httpServerMain/kotlin/HttpServer.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -@file:JvmName("HttpServer") - -package sample.html5canvas.httpserver - -import io.ktor.application.call -import io.ktor.http.ContentType -import io.ktor.http.content.LocalFileContent -import io.ktor.http.content.default -import io.ktor.http.content.files -import io.ktor.http.content.static -import io.ktor.response.respond -import io.ktor.routing.get -import io.ktor.routing.routing -import io.ktor.server.engine.embeddedServer -import io.ktor.server.netty.Netty -import java.io.File - -fun main(args: Array) { - - check(args.size == 1) { "Invalid number of arguments: $args.\nExpected one argument with content root." } - - val contentRoot = File(args[0]) - check(contentRoot.isDirectory) { "Invalid content root: $contentRoot." } - - println( - """ - - IMPORTANT: Please open http://localhost:8080/ in your browser! - - To stop embedded HTTP server use Ctrl+C (Cmd+C for Mac OS X). - - """.trimIndent() - ) - - val server = embeddedServer(Netty, 8080) { - routing { - val wasm = "build/bin/html5Canvas/releaseExecutable/html5Canvas.wasm" - get(wasm) { - // TODO: ktor as of now doesn't know about 'application/wasm'. - // The newer browsers (firefox and chrome at least) don't allow - // 'application/octet-stream' for wasm anymore. - // We provide the proper content type here and, - // at the same time, put it into the ktor database. - // Remove this whole get() clause when ktor fix is available. - call.respond(LocalFileContent(File(wasm), ContentType("application", "wasm"))) - } - static("/") { - files(contentRoot) - default("index.html") - } - } - } - server.start(wait = true) -} diff --git a/kotlin-native/backend.native/tests/samples/watchos/build.gradle.kts b/kotlin-native/backend.native/tests/samples/watchos/build.gradle.kts index acc26f62604..550f10587a1 100644 --- a/kotlin-native/backend.native/tests/samples/watchos/build.gradle.kts +++ b/kotlin-native/backend.native/tests/samples/watchos/build.gradle.kts @@ -8,7 +8,7 @@ plugins { val sdkName: String? = System.getenv("SDK_NAME") enum class Target(val simulator: Boolean, val key: String) { - WATCHOS_X86(true, "watchos"), WATCHOS_ARM64(false, "watchos"), + WATCHOS_X64(true, "watchos"), WATCHOS_ARM64(false, "watchos"), IOS_X64(true, "ios"), IOS_ARM64(false, "ios") } @@ -17,8 +17,8 @@ val target = sdkName.orEmpty().let { it.startsWith("iphoneos") -> Target.IOS_ARM64 it.startsWith("iphonesimulator") -> Target.IOS_X64 it.startsWith("watchos") -> Target.WATCHOS_ARM64 - it.startsWith("watchsimulator") -> Target.WATCHOS_X86 - else -> Target.WATCHOS_X86 + it.startsWith("watchsimulator") -> Target.WATCHOS_X64 + else -> Target.WATCHOS_X64 } } @@ -44,7 +44,7 @@ kotlin { watchosArm64("watchos") } else { // Simulator. - watchosX86("watchos") + watchosX64("watchos") } // Declare the output program. diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/CompilerOutputTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/CompilerOutputTest.kt index ec7d6d95e72..6daf3a24f9d 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/CompilerOutputTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/CompilerOutputTest.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.LibraryCompil import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult.Companion.assertSuccess -import org.jetbrains.kotlin.konan.blackboxtest.support.settings.MemoryModel import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.jupiter.api.Test import java.io.File @@ -89,14 +88,10 @@ class CompilerOutputTest : AbstractNativeSimpleTest() { } private fun normalizeOutput(output: String, exitCode: ExitCode): String { - var normalizedOutput = AbstractCliTest.getNormalizedCompilerOutput( + return AbstractCliTest.getNormalizedCompilerOutput( output, exitCode, "compiler/testData/compileKotlinAgainstCustomBinaries/" ) - if (testRunSettings.get() != MemoryModel.EXPERIMENTAL) { - normalizedOutput = normalizedOutput.replace("warning: legacy MM is deprecated and will be removed in version 1.9.20\n", "") - } - return normalizedOutput } } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt index 102334dbfd2..f17de550e19 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/ConfigurationProperties.kt @@ -60,7 +60,6 @@ internal enum class ClassLevelProperty(shortName: String) { FORCE_STANDALONE("forceStandalone"), COMPILE_ONLY("compileOnly"), OPTIMIZATION_MODE("optimizationMode"), - MEMORY_MODEL("memoryModel"), USE_THREAD_STATE_CHECKER("useThreadStateChecker"), GC_TYPE("gcType"), GC_SCHEDULER("gcScheduler"), diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/NativeTestSupport.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/NativeTestSupport.kt index e9e990739f5..cad2bc5df7d 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/NativeTestSupport.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/NativeTestSupport.kt @@ -150,13 +150,9 @@ private object NativeTestSupport { val enforcedProperties = EnforcedProperties(enclosingTestClass) val optimizationMode = computeOptimizationMode(enforcedProperties) - val memoryModel = computeMemoryModel(enforcedProperties) val threadStateChecker = computeThreadStateChecker(enforcedProperties) if (threadStateChecker == ThreadStateChecker.ENABLED) { - assertEquals(MemoryModel.EXPERIMENTAL, memoryModel) { - "Thread state checker can be enabled only with experimental memory model" - } assertEquals(OptimizationMode.DEBUG, optimizationMode) { "Thread state checker can be enabled only with debug optimization mode" } @@ -164,18 +160,8 @@ private object NativeTestSupport { val sanitizer = computeSanitizer(enforcedProperties) val gcType = computeGCType(enforcedProperties) - if (gcType != GCType.UNSPECIFIED) { - assertEquals(MemoryModel.EXPERIMENTAL, memoryModel) { - "GC type can be specified only with experimental memory model" - } - } val gcScheduler = computeGCScheduler(enforcedProperties) - if (gcScheduler != GCScheduler.UNSPECIFIED) { - assertEquals(MemoryModel.EXPERIMENTAL, memoryModel) { - "GC scheduler can be specified only with experimental memory model" - } - } val nativeHome = getOrCreateTestProcessSettings().get() @@ -194,7 +180,6 @@ private object NativeTestSupport { } output += optimizationMode - output += memoryModel output += threadStateChecker output += gcType output += gcScheduler @@ -221,9 +206,6 @@ private object NativeTestSupport { default = OptimizationMode.DEBUG ) - private fun computeMemoryModel(enforcedProperties: EnforcedProperties): MemoryModel = - ClassLevelProperty.MEMORY_MODEL.readValue(enforcedProperties, MemoryModel.values(), default = MemoryModel.EXPERIMENTAL) - private fun computeThreadStateChecker(enforcedProperties: EnforcedProperties): ThreadStateChecker { val useThreadStateChecker = ClassLevelProperty.USE_THREAD_STATE_CHECKER.readValue(enforcedProperties, String::toBooleanStrictOrNull, default = false) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/NativeTestGroupingMessageCollector.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/NativeTestGroupingMessageCollector.kt index 375526e76bf..623543a1b5b 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/NativeTestGroupingMessageCollector.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/NativeTestGroupingMessageCollector.kt @@ -68,7 +68,6 @@ internal class NativeTestGroupingMessageCollector( || isUnsafeCompilerArgumentsWarning(message) || isLibraryIncludedMoreThanOnceWarning(message) || isK2Experimental(message) - || isLegacyMMWarning(message) || isPartialLinkageWarning(message) -> { // These warnings are known and should not be reported as errors. severity @@ -110,9 +109,6 @@ internal class NativeTestGroupingMessageCollector( private fun isK2Experimental(message: String): Boolean = message.startsWith(K2_NATIVE_EXPERIMENTAL_WARNING_PREFIX) - // Legacy MM is deprecated and will be removed in 1.9.20. Until that moment we still need to run tests with it. - private fun isLegacyMMWarning(message: String): Boolean = message.startsWith(LEGACY_MM_WARNING_PREFIX) - private fun isPartialLinkageWarning(message: String): Boolean = message.matches(PARTIAL_LINKAGE_WARNING_REGEX) override fun hasErrors() = hasWarningsWithRaisedSeverity || super.hasErrors() @@ -122,7 +118,6 @@ internal class NativeTestGroupingMessageCollector( private const val UNSAFE_COMPILER_ARGS_WARNING_PREFIX = "ATTENTION!\nThis build uses unsafe internal compiler arguments:\n\n" private const val LIBRARY_INCLUDED_MORE_THAN_ONCE_WARNING_PREFIX = "library included more than once: " private const val K2_NATIVE_EXPERIMENTAL_WARNING_PREFIX = "Language version 2.0 is experimental" - private const val LEGACY_MM_WARNING_PREFIX = "Legacy MM is deprecated and will be removed" private val PARTIAL_LINKAGE_WARNING_REGEX = Regex("^<[^<>]+>( @ (?:(?!: ).)+)?: .*") diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt index 8821f047cf4..78ef2891080 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt @@ -128,7 +128,6 @@ internal abstract class SourceBasedCompilation( classLoader: KotlinNativeClassLoader, optimizationMode: OptimizationMode, compilerOutputInterceptor: CompilerOutputInterceptor, - private val memoryModel: MemoryModel, private val threadStateChecker: ThreadStateChecker, private val sanitizer: Sanitizer, private val gcType: GCType, @@ -150,7 +149,6 @@ internal abstract class SourceBasedCompilation( ) { override fun applySpecificArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { add("-repo", home.librariesDir.path) - memoryModel.compilerFlags?.let { compilerFlags -> add(compilerFlags) } threadStateChecker.compilerFlag?.let { compilerFlag -> add(compilerFlag) } sanitizer.compilerFlag?.let { compilerFlag -> add(compilerFlag) } gcType.compilerFlag?.let { compilerFlag -> add(compilerFlag) } @@ -191,7 +189,6 @@ internal class LibraryCompilation( classLoader = settings.get(), optimizationMode = settings.get(), compilerOutputInterceptor = settings.get(), - memoryModel = settings.get(), threadStateChecker = settings.get(), sanitizer = settings.get(), gcType = settings.get(), @@ -225,7 +222,6 @@ internal class ObjCFrameworkCompilation( classLoader = settings.get(), optimizationMode = settings.get(), compilerOutputInterceptor = settings.get(), - memoryModel = settings.get(), threadStateChecker = settings.get(), sanitizer = settings.get(), gcType = settings.get(), @@ -310,7 +306,6 @@ internal class ExecutableCompilation( classLoader = settings.get(), optimizationMode = settings.get(), compilerOutputInterceptor = settings.get(), - memoryModel = settings.get(), threadStateChecker = settings.get(), sanitizer = settings.get(), gcType = settings.get(), diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt index c3f2af389d3..8a827718f9a 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt @@ -75,7 +75,6 @@ internal class ExtTestCaseGroupProvider : TestCaseGroupProvider, TestDisposable( customKlibs = settings.get(), pipelineType = settings.get(), timeouts = settings.get(), - memoryModel = settings.get(), ) if (extTestDataFile.isRelevant) @@ -101,7 +100,6 @@ private class ExtTestDataFile( private val customKlibs: CustomKlibs, private val pipelineType: PipelineType, private val timeouts: Timeouts, - private val memoryModel: MemoryModel ) { private val structure by lazy { val allSourceTransformers: ExternalSourceTransformers = if (customSourceTransformers.isNullOrEmpty()) @@ -141,7 +139,6 @@ private class ExtTestDataFile( val isRelevant: Boolean = isCompatibleTarget(TargetBackend.NATIVE, testDataFile) // Checks TARGET_BACKEND/DONT_TARGET_EXACT_BACKEND directives. && !isIgnoredTarget(pipelineType, testDataFile, TargetBackend.NATIVE) // Checks IGNORE_BACKEND directives. - && (memoryModel != MemoryModel.LEGACY || !isIgnoredTarget(pipelineType, testDataFile, TargetBackend.NATIVE_WITH_LEGACY_MM)) // Checks IGNORE_BACKEND directives. && testDataFileSettings.languageSettings.none { it in INCOMPATIBLE_LANGUAGE_SETTINGS } && INCOMPATIBLE_DIRECTIVES.none { it in structure.directives } && structure.directives[API_VERSION_DIRECTIVE] !in INCOMPATIBLE_API_VERSIONS @@ -180,10 +177,6 @@ private class ExtTestDataFile( fun createTestCase(settings: Settings, sharedModules: ThreadSafeCache): TestCase { assertTrue(isRelevant) - if (settings.get() == MemoryModel.LEGACY) { - makeObjectsMutable() - } - val definitelyStandaloneTest = settings.get().value val isStandaloneTest = definitelyStandaloneTest || determineIfStandaloneTest() patchPackageNames(isStandaloneTest) @@ -221,25 +214,6 @@ private class ExtTestDataFile( isStandaloneTest } - /** Annotate all objects and companion objects with [THREAD_LOCAL_ANNOTATION] to make them mutable. */ - private fun makeObjectsMutable() = with(structure) { - filesToTransform.forEach { handler -> - handler.accept(object : KtTreeVisitorVoid() { - override fun visitObjectDeclaration(objectDeclaration: KtObjectDeclaration) { - if (!objectDeclaration.isObjectLiteral()) { - // FIXME: find only those that have vars inside - addAnnotationEntry( - objectDeclaration, - handler.psiFactory.createAnnotationEntry(THREAD_LOCAL_ANNOTATION) - ).ensureSurroundedByWhiteSpace() - } - - super.visitObjectDeclaration(objectDeclaration) - } - }) - } - } - /** * For every Kotlin file (*.kt) stored in this text: * @@ -581,8 +555,6 @@ private class ExtTestDataFile( private fun Directives.multiValues(key: String, predicate: (String) -> Boolean = { true }): Set = listValues(key)?.flatMap { it.split(' ') }?.filter(predicate)?.toSet().orEmpty() - private const val THREAD_LOCAL_ANNOTATION = "@kotlin.native.ThreadLocal" - private val BOX_FUNCTION_NAME = Name.identifier("box") private val OPT_IN_ANNOTATION_NAME = Name.identifier("OptIn") private val HELPERS_PACKAGE_NAME = Name.identifier("helpers") diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/TestProcessSettings.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/TestProcessSettings.kt index e70fc7e05c6..c5428923955 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/TestProcessSettings.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/settings/TestProcessSettings.kt @@ -117,20 +117,7 @@ internal enum class OptimizationMode(private val description: String, val compil } /** - * The Kotlin/Native memory model. - */ -internal enum class MemoryModel(val compilerFlags: List?) { - /** - * but it should be done at some point. - */ - LEGACY(listOf("-memory-model", "strict")), - EXPERIMENTAL(listOf("-memory-model", "experimental")); - - override fun toString() = compilerFlags?.joinToString(prefix = "(", separator = " ", postfix = ")").orEmpty() -} - -/** - * Thread state checked. Can be applied only with [MemoryModel.EXPERIMENTAL], [OptimizationMode.DEBUG], [CacheMode.WithoutCache]. + * Thread state checked. Can be applied only with [OptimizationMode.DEBUG], [CacheMode.WithoutCache]. */ internal enum class ThreadStateChecker(val compilerFlag: String?) { DISABLED(null), @@ -150,7 +137,7 @@ internal enum class Sanitizer(val compilerFlag: String?) { } /** - * Garbage collector type. Can be applied only with [MemoryModel.EXPERIMENTAL]. + * Garbage collector type. */ internal enum class GCType(val compilerFlag: String?) { UNSPECIFIED(null),