Microoptimizaitons in the interpreter

This commit is contained in:
Endre Sándor Varga 2016-07-20 13:53:53 +02:00
parent a6cf6c646e
commit b01acfd8d6
2 changed files with 34 additions and 28 deletions

View file

@ -650,7 +650,7 @@ final class GraphInterpreter(
elem
}
private def enqueue(connection: Int): Unit = {
def enqueue(connection: Int): Unit = {
if (Debug) if (queueTail - queueHead > mask) new Exception(s"$Name internal queue full ($queueStatus) + $connection").printStackTrace()
eventQueue(queueTail & mask) = connection
queueTail += 1
@ -688,23 +688,6 @@ final class GraphInterpreter(
}
}
private[stream] def push(connection: Int, elem: Any): Unit = {
val currentState = portStates(connection)
portStates(connection) = currentState ^ PushStartFlip
if ((currentState & InClosed) == 0) {
connectionSlots(connection) = elem
enqueue(connection)
}
}
private[stream] def pull(connection: Int): Unit = {
val currentState = portStates(connection)
portStates(connection) = currentState ^ PullStartFlip
if ((currentState & OutClosed) == 0) {
enqueue(connection)
}
}
private[stream] def complete(connection: Int): Unit = {
val currentState = portStates(connection)
if (Debug) println(s"$Name complete($connection) [$currentState]")