Mercurial > hg > truffle
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 9486:6678695afc3b
NodeUtil.cloneNode: cloned children array should preserve component type.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 01 May 2013 19:21:32 +0200 |
parents | 8cf939b349dd |
children | 0285fbb8b05d |
comparison
equal
deleted
inserted
replaced
9485:62838eadbf56 | 9486:6678695afc3b |
---|---|
232 } | 232 } |
233 } | 233 } |
234 for (long fieldOffset : nodeClass.nodeArrayFieldOffsets) { | 234 for (long fieldOffset : nodeClass.nodeArrayFieldOffsets) { |
235 Node[] children = (Node[]) unsafe.getObject(orig, fieldOffset); | 235 Node[] children = (Node[]) unsafe.getObject(orig, fieldOffset); |
236 if (children != null) { | 236 if (children != null) { |
237 Node[] clonedChildren = new Node[children.length]; | 237 Node[] clonedChildren = children.clone(); |
238 Arrays.fill(clonedChildren, null); | |
238 for (int i = 0; i < children.length; i++) { | 239 for (int i = 0; i < children.length; i++) { |
239 Node clonedChild = cloneNode(children[i]); | 240 Node clonedChild = cloneNode(children[i]); |
240 if (clonedChild == null) { | 241 if (clonedChild == null) { |
241 return null; | 242 return null; |
242 } | 243 } |