< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeList.java

Print this page
rev 56282 : [mq]: graal

*** 1,7 **** /* ! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 106,115 **** --- 106,129 ---- i++; } } } + /** + * Removes null values from the list. + */ + public void trim() { + int newSize = 0; + for (int i = 0; i < nodes.length; ++i) { + if (nodes[i] != null) { + nodes[newSize] = nodes[i]; + newSize++; + } + } + size = newSize; + } + public boolean isList() { return true; } protected abstract void update(T oldNode, T newNode);
*** 141,151 **** } @SuppressWarnings("unchecked") @Override public boolean add(Node node) { ! assert node == null || !node.isDeleted(); self.incModCount(); incModCount(); int length = nodes.length; if (length == 0) { nodes = new Node[2]; --- 155,165 ---- } @SuppressWarnings("unchecked") @Override public boolean add(Node node) { ! assert node == null || !node.isDeleted() : node; self.incModCount(); incModCount(); int length = nodes.length; if (length == 0) { nodes = new Node[2];
< prev index next >