Commit 3807a74
Optimize select expression registration phase (#1445)
* Optimize select expression registration phase
There is no need for multi-word atomic performAtomicIfNotSelected
operation when enqueuing select node for operation. We can simply
enqueue (addLast) xxxSelect node (SendSelect, ReceiveSelect, LockSelect).
If the coroutine that rendezvous with this node finds out that the
select expression was already selected, then it'll try again.
* Removed SelectInstance.performAtomicIfNotSelected function
* Removed Mutex.TryEnqueueLockDesc class, simplified onLock
* Removed AbstractSendChannel.TryEnqueueSendDesc class, simpler onSend
* Removed AbstractChannel.TryEnqueueReceiveDesc class, simpler onReceive
* Simplified SelectInstance.disposeOnSelect. It does not have to
do atomic addLastIf operation. Can do a simple addLast.
* Fixed unlimited channel select onSend on closed channel
It was hanging not being able to properly see that the channel was
already closed at that send attempt should fail.1 parent 0342a0a commit 3807a74
File tree
12 files changed
+228
-241
lines changed- binary-compatibility-validator/reference-public-api
- kotlinx-coroutines-core
- common
- src
- channels
- internal
- selects
- sync
- test/selects
- js/src/internal
- jvm
- src/internal
- test
- internal
- selects
- native/src/internal
12 files changed
+228
-241
lines changedLines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1046 | 1046 | | |
1047 | 1047 | | |
1048 | 1048 | | |
1049 | | - | |
1050 | 1049 | | |
1051 | 1050 | | |
1052 | 1051 | | |
| |||
1069 | 1068 | | |
1070 | 1069 | | |
1071 | 1070 | | |
1072 | | - | |
1073 | 1071 | | |
1074 | 1072 | | |
1075 | 1073 | | |
| |||
Lines changed: 88 additions & 130 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 113 | | |
119 | 114 | | |
120 | 115 | | |
| |||
129 | 124 | | |
130 | 125 | | |
131 | 126 | | |
| 127 | + | |
132 | 128 | | |
133 | 129 | | |
134 | 130 | | |
| |||
329 | 325 | | |
330 | 326 | | |
331 | 327 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
341 | 333 | | |
| 334 | + | |
| 335 | + | |
342 | 336 | | |
343 | 337 | | |
344 | 338 | | |
| |||
368 | 362 | | |
369 | 363 | | |
370 | 364 | | |
371 | | - | |
372 | | - | |
| 365 | + | |
| 366 | + | |
373 | 367 | | |
374 | 368 | | |
375 | | - | |
376 | | - | |
| 369 | + | |
377 | 370 | | |
378 | 371 | | |
379 | 372 | | |
| |||
405 | 398 | | |
406 | 399 | | |
407 | 400 | | |
408 | | - | |
| 401 | + | |
409 | 402 | | |
410 | 403 | | |
411 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
259 | 254 | | |
260 | 255 | | |
261 | 256 | | |
| |||
291 | 286 | | |
292 | 287 | | |
293 | 288 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | 289 | | |
308 | 290 | | |
309 | 291 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
406 | 429 | | |
407 | 430 | | |
408 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
Lines changed: 3 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | 257 | | |
278 | 258 | | |
279 | 259 | | |
| |||
376 | 356 | | |
377 | 357 | | |
378 | 358 | | |
379 | | - | |
| 359 | + | |
380 | 360 | | |
381 | 361 | | |
382 | 362 | | |
| |||
408 | 388 | | |
409 | 389 | | |
410 | 390 | | |
411 | | - | |
| 391 | + | |
412 | 392 | | |
413 | 393 | | |
414 | 394 | | |
| |||
460 | 440 | | |
461 | 441 | | |
462 | 442 | | |
463 | | - | |
| 443 | + | |
464 | 444 | | |
465 | 445 | | |
466 | 446 | | |
| |||
684 | 664 | | |
685 | 665 | | |
686 | 666 | | |
687 | | - | |
688 | | - | |
689 | 667 | | |
690 | 668 | | |
691 | 669 | | |
| |||
Lines changed: 1 addition & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 50 | | |
74 | 51 | | |
75 | 52 | | |
| |||
82 | 59 | | |
83 | 60 | | |
84 | 61 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 62 | | |
96 | 63 | | |
97 | 64 | | |
| |||
0 commit comments