Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java @ 10859:7a0ba9b20fec
Truffle-DSL: fixed bug in rewriting of child arrays.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 23 Jul 2013 17:47:56 +0200 |
parents | 00a9dbcbe431 |
children | a9cb98ff8fd9 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Mon Jul 22 13:35:23 2013 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Tue Jul 23 17:47:56 2013 +0200 @@ -1374,7 +1374,25 @@ if (Utils.isAssignable(getContext(), var.asType(), getContext().getTruffleTypes().getNode())) { builder.string(" = adoptChild(copy.").string(varName).string(")"); } else if (Utils.isAssignable(getContext(), var.asType(), getContext().getTruffleTypes().getNodeArray())) { - builder.string(" = adoptChildren(copy.").string(varName).string(")"); + NodeData node = getModel().getNode(); + NodeChildData child = node.findChild(varName); + if (child != null) { + builder.string(" = adoptChildren("); + builder.string("new ").type((child.getNodeType())).string(" {"); + builder.startCommaGroup(); + for (ActualParameter parameter : getModel().getParameters()) { + NodeChildData foundChild = node.findChild(parameter.getSpecification().getName()); + if (foundChild == child) { + builder.startGroup(); + builder.string("copy.").string(varName).string("[").string(String.valueOf(parameter.getIndex())).string("]"); + builder.end(); + } + } + + builder.end().string("})"); + } else { + builder.string(" = adoptChildren(copy.").string(varName).string(")"); + } } else { builder.string(" = copy.").string(varName); }