src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeList.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54601 c40b2a190173
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   106                 i++;
   106                 i++;
   107             }
   107             }
   108         }
   108         }
   109     }
   109     }
   110 
   110 
   111     public boolean isList() {
   111     /**
   112         return true;
   112      * Removes null values from the list.
       
   113      */
       
   114     public void trim() {
       
   115         int newSize = 0;
       
   116         for (int i = 0; i < nodes.length; ++i) {
       
   117             if (nodes[i] != null) {
       
   118                 nodes[newSize] = nodes[i];
       
   119                 newSize++;
       
   120             }
       
   121         }
       
   122         size = newSize;
   113     }
   123     }
   114 
   124 
   115     protected abstract void update(T oldNode, T newNode);
   125     protected abstract void update(T oldNode, T newNode);
   116 
   126 
   117     public abstract Edges.Type getEdgesType();
   127     public abstract Edges.Type getEdgesType();
   141     }
   151     }
   142 
   152 
   143     @SuppressWarnings("unchecked")
   153     @SuppressWarnings("unchecked")
   144     @Override
   154     @Override
   145     public boolean add(Node node) {
   155     public boolean add(Node node) {
   146         assert node == null || !node.isDeleted();
   156         assert node == null || !node.isDeleted() : node;
   147         self.incModCount();
   157         self.incModCount();
   148         incModCount();
   158         incModCount();
   149         int length = nodes.length;
   159         int length = nodes.length;
   150         if (length == 0) {
   160         if (length == 0) {
   151             nodes = new Node[2];
   161             nodes = new Node[2];