Skip to content

Commit 80335a9

Browse files
committed
New channel algorithms
1 parent 117dcb8 commit 80335a9

File tree

49 files changed

+2405
-2335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2405
-2335
lines changed

Diff for: benchmarks/src/jmh/kotlin/benchmarks/ParametrizedDispatcherBase.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {
2525
private var closeable: Closeable? = null
2626

2727
@Setup
28-
@UseExperimental(InternalCoroutinesApi::class)
28+
@OptIn(InternalCoroutinesApi::class)
2929
open fun setup() {
3030
coroutineContext = when {
3131
dispatcher == "fjp" -> ForkJoinPool.commonPool().asCoroutineDispatcher()

Diff for: gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Kotlin
66
version=1.6.0-SNAPSHOT
77
group=org.jetbrains.kotlinx
8-
kotlin_version=1.6.0
8+
kotlin_version=1.7.0-dev-1132
99

1010
# Dependencies
1111
junit_version=4.12

Diff for: gradle/test-mocha-js.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ task testMochaNode(type: NodeTask, dependsOn: [compileTestJsLegacy, installDepen
2929

3030
def jsLegacyTestTask = project.tasks.findByName('jsLegacyTest') ? jsLegacyTest : jsTest
3131

32-
jsLegacyTestTask.dependsOn testMochaNode
32+
//jsLegacyTestTask.dependsOn testMochaNode
3333

3434
// -- Testing with Mocha under headless Chrome
3535

@@ -99,5 +99,5 @@ task testMochaJsdom(type: NodeTask, dependsOn: [compileTestJsLegacy, installDepe
9999
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
100100
}
101101

102-
jsLegacyTestTask.dependsOn testMochaJsdom
102+
//jsLegacyTestTask.dependsOn testMochaJsdom
103103

Diff for: kotlinx-coroutines-core/api/kotlinx-coroutines-core.api

+5-19
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public final class kotlinx/coroutines/CancellableContinuation$DefaultImpls {
5151
public static synthetic fun tryResume$default (Lkotlinx/coroutines/CancellableContinuation;Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
5252
}
5353

54-
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation {
54+
public class kotlinx/coroutines/CancellableContinuationImpl : kotlin/coroutines/jvm/internal/CoroutineStackFrame, kotlinx/coroutines/CancellableContinuation, kotlinx/coroutines/channels/Waiter {
5555
public fun <init> (Lkotlin/coroutines/Continuation;I)V
5656
public final fun callCancelHandler (Lkotlinx/coroutines/CancelHandler;Ljava/lang/Throwable;)V
5757
public final fun callOnCancellation (Lkotlin/jvm/functions/Function1;Ljava/lang/Throwable;)V
@@ -768,23 +768,6 @@ public final class kotlinx/coroutines/channels/ClosedSendChannelException : java
768768
public fun <init> (Ljava/lang/String;)V
769769
}
770770

771-
public final class kotlinx/coroutines/channels/ConflatedBroadcastChannel : kotlinx/coroutines/channels/BroadcastChannel {
772-
public fun <init> ()V
773-
public fun <init> (Ljava/lang/Object;)V
774-
public synthetic fun cancel (Ljava/lang/Throwable;)Z
775-
public fun cancel (Ljava/util/concurrent/CancellationException;)V
776-
public fun close (Ljava/lang/Throwable;)Z
777-
public fun getOnSend ()Lkotlinx/coroutines/selects/SelectClause2;
778-
public final fun getValue ()Ljava/lang/Object;
779-
public final fun getValueOrNull ()Ljava/lang/Object;
780-
public fun invokeOnClose (Lkotlin/jvm/functions/Function1;)V
781-
public fun isClosedForSend ()Z
782-
public fun offer (Ljava/lang/Object;)Z
783-
public fun openSubscription ()Lkotlinx/coroutines/channels/ReceiveChannel;
784-
public fun send (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
785-
public fun trySend-JP2dKIU (Ljava/lang/Object;)Ljava/lang/Object;
786-
}
787-
788771
public final class kotlinx/coroutines/channels/ProduceKt {
789772
public static final fun awaitClose (Lkotlinx/coroutines/channels/ProducerScope;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
790773
public static synthetic fun awaitClose$default (Lkotlinx/coroutines/channels/ProducerScope;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
@@ -855,6 +838,9 @@ public final class kotlinx/coroutines/channels/TickerMode : java/lang/Enum {
855838
public static fun values ()[Lkotlinx/coroutines/channels/TickerMode;
856839
}
857840

841+
public abstract interface class kotlinx/coroutines/channels/Waiter {
842+
}
843+
858844
public final class kotlinx/coroutines/debug/internal/DebugCoroutineInfo {
859845
public fun <init> (Lkotlinx/coroutines/debug/internal/DebugCoroutineInfoImpl;Lkotlin/coroutines/CoroutineContext;)V
860846
public final fun getContext ()Lkotlin/coroutines/CoroutineContext;
@@ -1277,7 +1263,7 @@ protected final class kotlinx/coroutines/selects/SelectImplementation$ClauseData
12771263
public final fun tryRegister (Lkotlinx/coroutines/selects/SelectImplementation;)Z
12781264
}
12791265

1280-
public abstract interface class kotlinx/coroutines/selects/SelectInstance {
1266+
public abstract interface class kotlinx/coroutines/selects/SelectInstance : kotlinx/coroutines/channels/Waiter {
12811267
public abstract fun disposeOnCompletion (Lkotlinx/coroutines/DisposableHandle;)V
12821268
public abstract fun getContext ()Lkotlin/coroutines/CoroutineContext;
12831269
public abstract fun selectInRegistrationPhase (Ljava/lang/Object;)V

Diff for: kotlinx-coroutines-core/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ task jvmStressTest(type: Test, dependsOn: compileTestKotlinJvm) {
241241
systemProperty 'kotlinx.coroutines.scheduler.keep.alive.sec', '100000' // any unpark problem hangs test
242242
systemProperty 'kotlinx.coroutines.semaphore.segmentSize', '2'
243243
systemProperty 'kotlinx.coroutines.semaphore.maxSpinCycles', '10'
244+
systemProperty 'kotlinx.coroutines.bufferedChannel.segmentSize', '2'
244245
}
245246

246247
task jvmLincheckTest(type: Test, dependsOn: compileTestKotlinJvm) {
@@ -259,6 +260,7 @@ static void configureJvmForLincheck(task) {
259260
'--add-exports', 'java.base/jdk.internal.util=ALL-UNNAMED'] // in the model checking mode
260261
task.systemProperty 'kotlinx.coroutines.semaphore.segmentSize', '2'
261262
task.systemProperty 'kotlinx.coroutines.semaphore.maxSpinCycles', '1' // better for the model checking mode
263+
task.systemProperty 'kotlinx.coroutines.bufferedChannel.segmentSize', '2'
262264
}
263265

264266
// Always check additional test sets

Diff for: kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package kotlinx.coroutines
66

77
import kotlinx.atomicfu.*
8+
import kotlinx.coroutines.channels.Waiter
89
import kotlinx.coroutines.internal.*
910
import kotlin.coroutines.*
1011
import kotlin.coroutines.intrinsics.*
@@ -26,7 +27,7 @@ internal val RESUME_TOKEN = Symbol("RESUME_TOKEN")
2627
internal open class CancellableContinuationImpl<in T>(
2728
final override val delegate: Continuation<T>,
2829
resumeMode: Int
29-
) : DispatchedTask<T>(resumeMode), CancellableContinuation<T>, CoroutineStackFrame {
30+
) : DispatchedTask<T>(resumeMode), CancellableContinuation<T>, CoroutineStackFrame, Waiter {
3031
init {
3132
assert { resumeMode != MODE_UNINITIALIZED } // invalid mode for CancellableContinuationImpl
3233
}

0 commit comments

Comments
 (0)