#22429 Resize connections array when needed
This commit is contained in:
parent
23ca48bdcc
commit
4bb283b458
3 changed files with 7 additions and 6 deletions
|
|
@ -581,7 +581,7 @@ final class GraphStageIsland(
|
|||
private val logicArrayType = Array.empty[GraphStageLogic]
|
||||
private[this] val logics = new ArrayList[GraphStageLogic](64)
|
||||
// TODO: Resize
|
||||
private val connections = new Array[Connection](64)
|
||||
private var connections = new Array[Connection](16)
|
||||
private var maxConnections = 0
|
||||
private var outConnections: List[Connection] = Nil
|
||||
private var fullIslandName: OptionVal[String] = OptionVal.None
|
||||
|
|
@ -613,6 +613,9 @@ final class GraphStageIsland(
|
|||
|
||||
def conn(slot: Int): Connection = {
|
||||
maxConnections = math.max(slot, maxConnections)
|
||||
if (maxConnections >= connections.length) {
|
||||
connections = connections.padTo(connections.length * 2, null)
|
||||
}
|
||||
val c = connections(slot)
|
||||
if (c ne null) c
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue