@@ -994,7 +994,7 @@ internal open class BufferedChannel<E>(
994
994
if (bufferEndSegment.moveForward(ss)) {
995
995
ss = findSegmentBufferOrLast(id, ss)
996
996
if (ss.id != id) return
997
- val i = (b % SEGMENT_SIZE ).toInt()
997
+ // val i = (b % SEGMENT_SIZE).toInt()
998
998
// if (ss.getState(i) === INTERRUPTED_RCV) ss.onSlotCleaned()
999
999
return
1000
1000
}
@@ -1469,8 +1469,8 @@ internal open class BufferedChannel<E>(
1469
1469
final override fun cancel (cause : CancellationException ? ) { cancelImpl(cause) }
1470
1470
1471
1471
internal open fun cancelImpl (cause : Throwable ? ): Boolean {
1472
- val cause = cause ? : CancellationException (" Channel was cancelled" )
1473
- val wasClosed = closeImpl(cause , true )
1472
+ val materializedCause = cause ? : CancellationException (" Channel was cancelled" )
1473
+ val wasClosed = closeImpl(materializedCause , true )
1474
1474
removeRemainingBufferedElements()
1475
1475
onCancel(wasClosed)
1476
1476
return wasClosed
@@ -1726,6 +1726,7 @@ internal open class BufferedChannel<E>(
1726
1726
// #######################
1727
1727
1728
1728
private fun findSegmentSend (id : Long , start : ChannelSegment <E >) =
1729
+ @Suppress(" INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION" )
1729
1730
sendSegment.findSegmentAndMoveForward(id, start, ::createSegment).let {
1730
1731
if (it.isClosed) {
1731
1732
completeCloseOrCancel()
@@ -1755,6 +1756,7 @@ internal open class BufferedChannel<E>(
1755
1756
}
1756
1757
1757
1758
private fun findSegmentReceive (id : Long , start : ChannelSegment <E >) =
1759
+ @Suppress(" INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION" )
1758
1760
receiveSegment.findSegmentAndMoveForward(id, start, ::createSegment).let {
1759
1761
if (it.isClosed) {
1760
1762
completeCloseOrCancel()
@@ -1770,9 +1772,11 @@ internal open class BufferedChannel<E>(
1770
1772
}
1771
1773
1772
1774
private fun findSegmentHasElements (id : Long , start : ChannelSegment <E >) =
1775
+ @Suppress(" INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION" )
1773
1776
receiveSegment.findSegmentAndMoveForward(id, start, ::createSegment)
1774
1777
1775
1778
private fun findSegmentBuffer (id : Long , start : ChannelSegment <E >) =
1779
+ @Suppress(" INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION" )
1776
1780
bufferEndSegment.findSegmentAndMoveForward(id, start, ::createSegment)
1777
1781
1778
1782
// ##################
@@ -1885,38 +1889,34 @@ internal class ChannelSegment<E>(id: Long, prev: ChannelSegment<E>?, pointers: I
1885
1889
// # Manipulation with the Element Fields #
1886
1890
// ########################################
1887
1891
1888
- inline fun storeElement (index : Int , element : E ) {
1892
+ internal fun storeElement (index : Int , element : E ) {
1889
1893
setElementLazy(index, element)
1890
1894
}
1891
1895
1892
1896
@Suppress(" UNCHECKED_CAST" )
1893
- inline fun getElement (index : Int ) = data[index * 2 ].value as E
1897
+ internal fun getElement (index : Int ) = data[index * 2 ].value as E
1894
1898
1895
- inline fun retrieveElement (index : Int ): E = getElement(index).also { cleanElement(index) }
1899
+ internal fun retrieveElement (index : Int ): E = getElement(index).also { cleanElement(index) }
1896
1900
1897
- inline fun cleanElement (index : Int ) {
1901
+ internal fun cleanElement (index : Int ) {
1898
1902
setElementLazy(index, null )
1899
1903
}
1900
1904
1901
- private inline fun setElementLazy (index : Int , value : Any? ) {
1905
+ private fun setElementLazy (index : Int , value : Any? ) {
1902
1906
data[index * 2 ].lazySet(value)
1903
1907
}
1904
1908
1905
1909
// ######################################
1906
1910
// # Manipulation with the State Fields #
1907
1911
// ######################################
1908
1912
1909
- inline fun getState (index : Int ): Any? = data[index * 2 + 1 ].value
1913
+ internal fun getState (index : Int ): Any? = data[index * 2 + 1 ].value
1910
1914
1911
- inline fun setState (index : Int , value : Any? ) {
1915
+ internal fun setState (index : Int , value : Any? ) {
1912
1916
data[index * 2 + 1 ].value = value
1913
1917
}
1914
1918
1915
- inline fun setStateLazy (index : Int , value : Any? ) {
1916
- data[index * 2 + 1 ].lazySet(value)
1917
- }
1918
-
1919
- inline fun casState (index : Int , from : Any? , to : Any? ) = data[index * 2 + 1 ].compareAndSet(from, to)
1919
+ internal fun casState (index : Int , from : Any? , to : Any? ) = data[index * 2 + 1 ].compareAndSet(from, to)
1920
1920
1921
1921
// ########################
1922
1922
// # Cancellation Support #
@@ -2119,7 +2119,7 @@ private const val CLOSE_STATUS_SHIFT = 60
2119
2119
private const val COUNTER_MASK = (1L shl CLOSE_STATUS_SHIFT ) - 1
2120
2120
private inline val Long .counter get() = this and COUNTER_MASK
2121
2121
private inline val Long .closeStatus: Int get() = (this shr CLOSE_STATUS_SHIFT ).toInt()
2122
- private inline fun constructSendersAndCloseStatus (counter : Long , closeStatus : Int ): Long =
2122
+ private fun constructSendersAndCloseStatus (counter : Long , closeStatus : Int ): Long =
2123
2123
(closeStatus.toLong() shl CLOSE_STATUS_SHIFT ) + counter
2124
2124
2125
2125
/*
@@ -2150,4 +2150,4 @@ private val NO_CLOSE_CAUSE = Symbol("NO_CLOSE_CAUSE")
2150
2150
* [BufferedChannel.BufferedChannelIterator], should be marked with this interface
2151
2151
* to make the code faster and easier to read.
2152
2152
*/
2153
- internal interface Waiter
2153
+ internal interface Waiter
0 commit comments