comparison graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java @ 11674:8505bcff4bdc

New graph duplication mechanism that allows in-place fixing of edges.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Sep 2013 23:17:56 +0200
parents 3967f9f306f8
children 435c8b984680
comparison
equal deleted inserted replaced
11673:1c5bc8307c76 11674:8505bcff4bdc
592 } 592 }
593 593
594 static int count = 0; 594 static int count = 0;
595 595
596 public Node clone(Graph into) { 596 public Node clone(Graph into) {
597 return clone(into, true);
598 }
599
600 Node clone(Graph into, boolean clearInputsAndSuccessors) {
597 NodeClass nodeClass = getNodeClass(); 601 NodeClass nodeClass = getNodeClass();
598 if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) { 602 if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) {
599 Node otherNode = into.findNodeInCache(this); 603 Node otherNode = into.findNodeInCache(this);
600 if (otherNode != null) { 604 if (otherNode != null) {
601 return otherNode; 605 return otherNode;
606 try { 610 try {
607 newNode = (Node) this.clone(); 611 newNode = (Node) this.clone();
608 } catch (CloneNotSupportedException e) { 612 } catch (CloneNotSupportedException e) {
609 throw new GraalInternalError(e).addContext(this); 613 throw new GraalInternalError(e).addContext(this);
610 } 614 }
611 nodeClass.clearInputs(newNode); 615 if (clearInputsAndSuccessors) {
612 nodeClass.clearSuccessors(newNode); 616 nodeClass.clearInputs(newNode);
617 nodeClass.clearSuccessors(newNode);
618 }
613 newNode.graph = into; 619 newNode.graph = into;
614 newNode.typeCacheNext = null; 620 newNode.typeCacheNext = null;
615 newNode.id = INITIAL_ID; 621 newNode.id = INITIAL_ID;
616 into.register(newNode); 622 into.register(newNode);
617 newNode.usage0 = null; 623 newNode.usage0 = null;