diff --git a/backend.native/build.gradle b/backend.native/build.gradle index b0803ab52ab..24948ad9eaa 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -102,6 +102,7 @@ configurations { kotlin_reflect_jar kotlin_script_runtime_jar kotlin_common_stdlib_src + trove4j_jar cli_bcRuntime { extendsFrom compilerRuntime @@ -114,6 +115,7 @@ configurations { } dependencies { + trove4j_jar "org.jetbrains.intellij.deps:trove4j:1.0.20181211@jar" kotlin_compiler_jar "$kotlinCompilerModule@jar" kotlin_stdlib_jar "$kotlinStdLibModule@jar" kotlin_reflect_jar "$kotlinReflectModule@jar" @@ -257,6 +259,15 @@ jar { def externalJars = ['compiler', 'stdlib', 'reflect', 'script_runtime'] +task trove4jCopy(type: Copy) { + from configurations.getByName("trove4j_jar") { + include "trove4j*.jar" + rename "trove4j(.*).jar", "trove4j.jar" + + into 'build/external_jars' + } +} + externalJars.each { arg -> def jar = arg.replace('_', '-') // :( task ("${arg}Copy", type:Copy) { @@ -271,6 +282,7 @@ externalJars.each { arg -> task external_jars(type: Copy) { dependsOn externalJars.collect{"${it}Copy"} + dependsOn trove4jCopy from configurations.compilerCompile { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index e161ec006c4..9fed6c70417 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -468,11 +468,11 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val val threadLocal = context.builtIns.builtInsModule.findClassAcrossModuleDependencies( - ClassId.topLevel(FqName("kotlin.native.ThreadLocal")))!! + ClassId.topLevel(FqName("kotlin.native.concurrent.ThreadLocal")))!! val sharedImmutable = context.builtIns.builtInsModule.findClassAcrossModuleDependencies( - ClassId.topLevel(FqName("kotlin.native.SharedImmutable")))!! + ClassId.topLevel(FqName("kotlin.native.concurrent.SharedImmutable")))!! private fun internalFunction(name: String): IrSimpleFunctionSymbol = symbolTable.referenceSimpleFunction(context.getInternalFunctions(name).single()) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 9c9c1179b31..8560de8250d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -41,8 +41,8 @@ import org.jetbrains.kotlin.konan.target.CompilerOutputKind import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.descriptorUtil.classId -private val threadLocalAnnotationFqName = FqName("kotlin.native.ThreadLocal") -private val sharedAnnotationFqName = FqName("kotlin.native.SharedImmutable") +private val threadLocalAnnotationFqName = FqName("kotlin.native.concurrent.ThreadLocal") +private val sharedAnnotationFqName = FqName("kotlin.native.concurrent.SharedImmutable") private val frozenAnnotationFqName = FqName("kotlin.native.internal.Frozen") val IrField.propertyDescriptor: PropertyDescriptor diff --git a/cmd/run_konan b/cmd/run_konan index 6e0248cfe73..65f59e4c855 100755 --- a/cmd/run_konan +++ b/cmd/run_konan @@ -89,7 +89,8 @@ EXTRACTED_METADATA_JAR="${KONAN_HOME}/konan/lib/konan.metadata.jar" EXTRACTED_SERIALIZER_JAR="${KONAN_HOME}/konan/lib/konan.serializer.jar" KLIB_JAR="${KONAN_HOME}/konan/lib/klib.jar" UTILITIES_JAR="${KONAN_HOME}/konan/lib/utilities.jar" -KONAN_CLASSPATH="$KOTLIN_JAR:$KOTLIN_STDLIB_JAR:$KOTLIN_REFLECT_JAR:$KOTLIN_SCRIPT_RUNTIME_JAR:$INTEROP_JAR:$STUB_GENERATOR_JAR:$INTEROP_INDEXER_JAR:$KONAN_JAR:$KLIB_JAR:$UTILITIES_JAR:$SHARED_JAR:$EXTRACTED_METADATA_JAR:$EXTRACTED_SERIALIZER_JAR" +TROVE_JAR="${KONAN_HOME}/konan/lib/trove4j.jar" +KONAN_CLASSPATH="$KOTLIN_JAR:$KOTLIN_STDLIB_JAR:$KOTLIN_REFLECT_JAR:$KOTLIN_SCRIPT_RUNTIME_JAR:$INTEROP_JAR:$STUB_GENERATOR_JAR:$INTEROP_INDEXER_JAR:$KONAN_JAR:$KLIB_JAR:$UTILITIES_JAR:$SHARED_JAR:$EXTRACTED_METADATA_JAR:$EXTRACTED_SERIALIZER_JAR:$TROVE_JAR" TOOL_CLASS=org.jetbrains.kotlin.cli.utilities.MainKt LIBCLANG_DISABLE_CRASH_RECOVERY=1 \ diff --git a/cmd/run_konan.bat b/cmd/run_konan.bat index b8d2f21daf5..9c87759cb06 100644 --- a/cmd/run_konan.bat +++ b/cmd/run_konan.bat @@ -67,8 +67,9 @@ set "KOTLIN_REFLECT_JAR=%KONAN_LIB%\kotlin-stdlib.jar" set "KOTLIN_SCRIPT_RUNTIME_JAR=%KONAN_LIB%\kotlin-script-runtime.jar" set "STUB_GENERATOR_JAR=%KONAN_LIB%\StubGenerator.jar" set "UTILITIES_JAR=%KONAN_LIB%\utilities.jar" +set TROVE_JAR="%KONAN_LIB%\lib\trove4j.jar" -set "KONAN_CLASSPATH=%KOTLIN_JAR%;%KOTLIN_STDLIB_JAR%;%KOTLIN_REFLECT_JAR%;%KOTLIN_SCRIPT_RUNTIME_JAR%;%INTEROP_RUNTIME_JAR%;%KONAN_JAR%;%STUB_GENERATOR_JAR%;%INTEROP_INDEXER_JAR%;%SHARED_JAR%;%EXTRACTED_METADATA_JAR%;%EXTRACTED_SERIALIZER_JAR%;%KLIB_JAR%;%UTILITIES_JAR%" +set "KONAN_CLASSPATH=%KOTLIN_JAR%;%KOTLIN_STDLIB_JAR%;%KOTLIN_REFLECT_JAR%;%KOTLIN_SCRIPT_RUNTIME_JAR%;%INTEROP_RUNTIME_JAR%;%KONAN_JAR%;%STUB_GENERATOR_JAR%;%INTEROP_INDEXER_JAR%;%SHARED_JAR%;%EXTRACTED_METADATA_JAR%;%EXTRACTED_SERIALIZER_JAR%;%KLIB_JAR%;%UTILITIES_JAR%;%TROVE_JAR%" set JAVA_OPTS=-ea ^ -Xmx3G ^ diff --git a/gradle.properties b/gradle.properties index fa0c55a422f..91369f117da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,9 +18,9 @@ buildKotlinVersion=1.3.0-rc-116 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_130_CompilerAllPlugins),number:1.3.0-rc-116,tag:kotlin-native,pinned:true/artifacts/content/maven remoteRoot=konan_tests -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.30-dev-678,pinned:true/artifacts/content/maven -kotlinVersion=1.3.30-dev-678 -testKotlinVersion=1.3.30-dev-678 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.30-dev-761,pinned:true/artifacts/content/maven +kotlinVersion=1.3.30-dev-761 +testKotlinVersion=1.3.30-dev-761 konanVersion=1.2.0 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.workers.max=4 diff --git a/runtime/src/main/kotlin/kotlin/native/Annotations.kt b/runtime/src/main/kotlin/kotlin/native/Annotations.kt index b389c18d3cc..daa91f3a3f5 100644 --- a/runtime/src/main/kotlin/kotlin/native/Annotations.kt +++ b/runtime/src/main/kotlin/kotlin/native/Annotations.kt @@ -40,24 +40,6 @@ public annotation class Retain @Retention(AnnotationRetention.SOURCE) public annotation class Throws(vararg val exceptionClasses: KClass) -/** - * Top level variable or object is thread local, and so could be mutable. - * One may use this annotation as the stopgap measure for singleton - * object immutability. - * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. - */ -@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -public annotation class ThreadLocal - -/** - * Top level variable is immutable and so could be shared. - * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. - */ -@Target(AnnotationTarget.PROPERTY) -@Retention(AnnotationRetention.BINARY) -public annotation class SharedImmutable - /** * Makes top level function available from C/C++ code with the given name. * @@ -66,4 +48,10 @@ public annotation class SharedImmutable */ @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) -public annotation class CName(val externName: String = "", val shortName: String = "") \ No newline at end of file +public annotation class CName(val externName: String = "", val shortName: String = "") + +@Deprecated("Please use kotlin.native.concurrent") +typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal + +@Deprecated("Please use kotlin.native.concurrent") +typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt b/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt new file mode 100644 index 00000000000..1f8afa1ec6a --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/native/concurrent/Annotations.kt @@ -0,0 +1,24 @@ +/* + * 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 kotlin.native.concurrent + +/** + * Top level variable or object is thread local, and so could be mutable. + * One may use this annotation as the stopgap measure for singleton + * object immutability. + * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + */ +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) +@Retention(AnnotationRetention.BINARY) +public actual annotation class ThreadLocal + +/** + * Top level variable is immutable and so could be shared. + * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + */ +@Target(AnnotationTarget.PROPERTY) +@Retention(AnnotationRetention.BINARY) +public actual annotation class SharedImmutable