Gross stdlib cleanup (part 2) (#1924)
This commit is contained in:
+3
-3
@@ -79,12 +79,12 @@ internal class InteropBuiltIns(builtIns: KonanBuiltIns, vararg konanPrimitives:
|
||||
|
||||
val staticCFunction = packageScope.getContributedFunctions("staticCFunction").toSet()
|
||||
|
||||
val workerPackageScope = builtIns.builtInsModule.getPackage(FqName("kotlin.native.worker")).memberScope
|
||||
val concurrentPackageScope = builtIns.builtInsModule.getPackage(FqName("kotlin.native.concurrent")).memberScope
|
||||
|
||||
val scheduleFunction = workerPackageScope.getContributedClass("Worker")
|
||||
val scheduleFunction = concurrentPackageScope.getContributedClass("Worker")
|
||||
.unsubstitutedMemberScope.getContributedFunctions("schedule").single()
|
||||
|
||||
val scheduleImplFunction = workerPackageScope.getContributedFunctions("scheduleImpl").single()
|
||||
val scheduleImplFunction = concurrentPackageScope.getContributedFunctions("scheduleImpl").single()
|
||||
|
||||
val signExtend = packageScope.getContributedFunctions("signExtend").single()
|
||||
|
||||
|
||||
+11
-8
@@ -297,10 +297,12 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val
|
||||
context.getInternalFunctions("valueOfForEnum").single())
|
||||
|
||||
val enumValues = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin").getContributedFunctions(Name.identifier("enumValues"), NoLookupLocation.FROM_BACKEND).single())
|
||||
builtInsPackage("kotlin").getContributedFunctions(
|
||||
Name.identifier("enumValues"), NoLookupLocation.FROM_BACKEND).single())
|
||||
|
||||
val enumValueOf = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin").getContributedFunctions(Name.identifier("enumValueOf"), NoLookupLocation.FROM_BACKEND).single())
|
||||
builtInsPackage("kotlin").getContributedFunctions(
|
||||
Name.identifier("enumValueOf"), NoLookupLocation.FROM_BACKEND).single())
|
||||
|
||||
val createUninitializedInstance = symbolTable.referenceSimpleFunction(
|
||||
context.getInternalFunctions("createUninitializedInstance").single())
|
||||
@@ -309,14 +311,17 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val
|
||||
context.getInternalFunctions("initInstance").single())
|
||||
|
||||
val freeze = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin", "native", "worker").getContributedFunctions(Name.identifier("freeze"), NoLookupLocation.FROM_BACKEND).single())
|
||||
builtInsPackage("kotlin", "native", "concurrent").getContributedFunctions(
|
||||
Name.identifier("freeze"), NoLookupLocation.FROM_BACKEND).single())
|
||||
|
||||
val println = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin", "io").getContributedFunctions(Name.identifier("println"), NoLookupLocation.FROM_BACKEND)
|
||||
builtInsPackage("kotlin", "io").getContributedFunctions(
|
||||
Name.identifier("println"), NoLookupLocation.FROM_BACKEND)
|
||||
.single { it.valueParameters.singleOrNull()?.type == builtIns.stringType })
|
||||
|
||||
val anyNToString = symbolTable.referenceSimpleFunction(
|
||||
builtInsPackage("kotlin").getContributedFunctions(Name.identifier("toString"), NoLookupLocation.FROM_BACKEND)
|
||||
builtInsPackage("kotlin").getContributedFunctions(
|
||||
Name.identifier("toString"), NoLookupLocation.FROM_BACKEND)
|
||||
.single { it.extensionReceiverParameter?.type == builtIns.nullableAnyType})
|
||||
|
||||
val getContinuation = symbolTable.referenceSimpleFunction(
|
||||
@@ -350,10 +355,8 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val
|
||||
.filterNot { it.isExpect }.single().getter!!
|
||||
)
|
||||
|
||||
// removed in Big Kotlin @c62e4b4fcf50e99800e6d5c3a220101b691e1d43
|
||||
val refClass = symbolTable.referenceClass(context.getInternalClass("Ref"))
|
||||
|
||||
|
||||
val kLocalDelegatedPropertyImpl = symbolTable.referenceClass(context.reflectionTypes.kLocalDelegatedPropertyImpl)
|
||||
val kLocalDelegatedMutablePropertyImpl = symbolTable.referenceClass(context.reflectionTypes.kLocalDelegatedMutablePropertyImpl)
|
||||
|
||||
@@ -376,7 +379,7 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable, val
|
||||
symbolTable.referenceClass(context.getInternalClass(name))
|
||||
|
||||
private fun getKonanTestClass(className: String) = symbolTable.referenceClass(
|
||||
builtInsPackage("kotlin", "native", "test").getContributedClassifier(
|
||||
builtInsPackage("kotlin", "native", "internal", "test").getContributedClassifier(
|
||||
Name.identifier(className), NoLookupLocation.FROM_BACKEND
|
||||
) as ClassDescriptor)
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ internal fun findMainEntryPoint(context: Context): FunctionDescriptor? {
|
||||
}
|
||||
|
||||
private val defaultEntryName = "main"
|
||||
private val testEntryName = "kotlin.native.test.main"
|
||||
private val testEntryName = "kotlin.native.internal.test.main"
|
||||
|
||||
private val defaultEntryPackage = FqName.ROOT
|
||||
|
||||
|
||||
+1
-1
@@ -346,7 +346,7 @@ internal class TestProcessor (val context: KonanBackendContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a method in `[testSuite]` class with anem `[getterName]`
|
||||
* Builds a method in `[testSuite]` class with name `[getterName]`
|
||||
* returning a new instance of class referenced by [classSymbol].
|
||||
*/
|
||||
private inner class InstanceGetterBuilder(val classSymbol: IrClassSymbol, testSuite: IrClassSymbol, getterName: Name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package codegen.enum.isFrozen
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
enum class Zzz(val zzz: String) {
|
||||
Z1("z1"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package runtime.basic.worker_random
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
import kotlin.collections.*
|
||||
import kotlin.random.*
|
||||
import kotlin.system.*
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.atomic0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
fun test1(workers: Array<Worker>) {
|
||||
val atomic = AtomicInt(15)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package runtime.workers.enum_identity
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
enum class A {
|
||||
A, B
|
||||
|
||||
@@ -18,7 +18,7 @@ package runtime.workers.freeze0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class SharedDataMember(val double: Double)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package runtime.workers.freeze1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class Node(var previous: Node?, var data: Int)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package runtime.workers.freeze2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class Data(var int: Int)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.freeze3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
object Immutable {
|
||||
var x = 1
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.freeze4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class Data(val x: Int, val s: String, val next: Data? = null)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package runtime.workers.freeze5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
object Keys {
|
||||
internal val myMap: Map<String, List<String>> = mapOf(
|
||||
"val1" to listOf("a1", "a2", "a3"),
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.freeze_stress
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
class Random(private var seed: Int) {
|
||||
fun next(): Int {
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.lazy0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class Data(val x: Int, val y: String)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.lazy1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
class Leak {
|
||||
val leak by lazy { this }
|
||||
|
||||
@@ -2,11 +2,11 @@ package runtime.workers.worker0
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val worker = startWorker()
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "Input".shallowCopy()}) {
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "Input" }) {
|
||||
input -> input + " processed"
|
||||
}
|
||||
future.consume {
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker1
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val COUNT = 5
|
||||
@@ -10,7 +10,7 @@ import kotlin.native.worker.*
|
||||
|
||||
for (attempt in 1 .. 3) {
|
||||
val futures = Array(workers.size,
|
||||
{ i -> workers[i].schedule(TransferMode.CHECKED, { "$attempt: Input $i".shallowCopy() })
|
||||
{ i -> workers[i].schedule(TransferMode.CHECKED, { "$attempt: Input $i" })
|
||||
{ input -> input + " processed" }
|
||||
})
|
||||
futures.forEachIndexed { index, future ->
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker2
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class WorkerArgument(val intParam: Int, val stringParam: String)
|
||||
data class WorkerResult(val intResult: Int, val stringResult: String)
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker3
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class DataParam(var int: Int)
|
||||
data class WorkerArgument(val intParam: Int, val dataParam: DataParam)
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker4
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val worker = startWorker()
|
||||
|
||||
@@ -2,11 +2,11 @@ package runtime.workers.worker5
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val worker = startWorker()
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "zzz".shallowCopy() }) {
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "zzz" }) {
|
||||
input -> input.length
|
||||
}
|
||||
future.consume {
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker6
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val worker = startWorker()
|
||||
|
||||
@@ -2,11 +2,11 @@ package runtime.workers.worker7
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val worker = startWorker()
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "Input".shallowCopy() }) {
|
||||
val future = worker.schedule(TransferMode.CHECKED, { "Input" }) {
|
||||
input -> println(input)
|
||||
}
|
||||
future.consume {
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker8
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
data class SharedDataMember(val double: Double)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package runtime.workers.worker9
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
import kotlin.native.worker.*
|
||||
import kotlin.native.concurrent.*
|
||||
|
||||
@Test fun runTest() {
|
||||
withLock { println("zzz") }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package kotlin.test.tests
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.native.test.*
|
||||
|
||||
import kotlin.native.internal.test.*
|
||||
|
||||
@Ignore
|
||||
class IgnoredClass {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package kotlin.test.tests
|
||||
|
||||
import kotlin.test.*
|
||||
import kotlin.native.test.*
|
||||
import kotlin.native.internal.test.*
|
||||
|
||||
@Test
|
||||
fun test() {
|
||||
|
||||
Reference in New Issue
Block a user