diff --git a/src/jastadd/incremental/IncrementalDDG.jadd b/src/jastadd/incremental/IncrementalDDG.jadd index 33f76578cb59dfc60eec9682280004f20580535a..1470b385c6aafe42773569ca4789cf43a8143c26 100644 --- a/src/jastadd/incremental/IncrementalDDG.jadd +++ b/src/jastadd/incremental/IncrementalDDG.jadd @@ -60,6 +60,10 @@ aspect IncrementalDDG { if (name().equals(config().astNodeType())) { tt.expand("ASTDecl.createASTHandlers", out); } + // Rewrite attribute. + if (hasRewriteAttribute()) { + tt.expand("ASTDecl.createRewriteAttributeHandler", out); + } // Collect attributes. ArrayList list = new ArrayList(); for (AttrDecl attr : synDecls()) { diff --git a/src/jastadd/incremental/IncrementalNotification.jadd b/src/jastadd/incremental/IncrementalNotification.jadd index 33829769dc6628bff6a099cb145dfaaa297a6f73..7bbd28c4f3cf8c6b74804a48d07cd00f0dd1f797 100644 --- a/src/jastadd/incremental/IncrementalNotification.jadd +++ b/src/jastadd/incremental/IncrementalNotification.jadd @@ -32,10 +32,11 @@ TemplateContext tt = templateContext(); - tt.expand("ASTNode.incFlushRewritesLocateEnclosingRewriteMethod", out); - tt.expand("ASTNode.incResetRewritesMethod", out); - tt.expand("ASTNode.incRestoreEnclosingRewriteMethod", out); - tt.expand("ASTNode.incRestoreInitialForIndexMethod", out); +// tt.expand("ASTNode.incFlushRewritesLocateEnclosingRewriteMethod", out); +// tt.expand("ASTNode.incResetRewritesMethod", out); +// tt.expand("ASTNode.incRestoreEnclosingRewriteMethod", out); +// tt.expand("ASTNode.incRestoreInitialForIndexMethod", out); + tt.expand("ASTNode.incLocateInitialCopyMethod", out); tt.bind("AttrAffectedChecks", emitAttrAffectedChecksString()); diff --git a/src/template/ast/CopyNode.tt b/src/template/ast/CopyNode.tt index 27bd3392fd3e869667d77036f37534894e9e2fec..10b631dfeb8958545c2fd17093508e9135a437b1 100644 --- a/src/template/ast/CopyNode.tt +++ b/src/template/ast/CopyNode.tt @@ -42,8 +42,6 @@ $if(IncrementalEnabled) for (int i = 0; node.children != null && i < node.children.length; i++) { node.children[i] = null; } - node.init_children = null; - node.children_computed = null; inc_copyHandlers(node); $endif $if(Concurrent) diff --git a/src/template/ast/NodeConstructor.tt b/src/template/ast/NodeConstructor.tt index 521d002151ac11f0c3cb67bd00332a4a875e4e64..ba43b91a543c2cad73a385b7cebdd0b630524999 100644 --- a/src/template/ast/NodeConstructor.tt +++ b/src/template/ast/NodeConstructor.tt @@ -79,7 +79,6 @@ OptDecl.constructor = [[ ListDecl.constructor = [[ public $List.$List(T... initialChildren) { children = new $ASTNode[initialChildren.length]; - #genIncrementalInitChildHandlers for (int i = 0; i < children.length; ++i) { addChild(initialChildren[i]); } diff --git a/src/template/incremental/DDGNode.tt b/src/template/incremental/DDGNode.tt index cf721c45eab97d5ba52d203120ad3d75f1804fb1..8a473f141abbfd87edf30b5caafa7f072e57ffdb 100644 --- a/src/template/incremental/DDGNode.tt +++ b/src/template/incremental/DDGNode.tt @@ -499,6 +499,11 @@ ASTDecl.createNodeHandler = [[ protected $DDGNodeName #name.handler = new $DDGNodeName(this); ]] +# Create DDG node for rewrite attribute. +ASTDecl.createRewriteAttributeHandler = [[ + protected $DDGNodeName #name.rewrittenNode_handler; +]] + # Create DDG node for attribute ASTDecl.createAttributeHandler = [[ $if (IncrementalLevelParam) diff --git a/src/template/incremental/Debug.tt b/src/template/incremental/Debug.tt index ef8b0ad51bc8ac8e312793f3b967b306f8adce5d..573f1082c0d5968d815ee4d12779efeb61ffb487 100644 --- a/src/template/incremental/Debug.tt +++ b/src/template/incremental/Debug.tt @@ -117,15 +117,6 @@ $endif # Generate code for method dumping cached values ASTDecl.dumpCachedValuesMethod = [[ public void #name.dumpCachedValues() { -$if (#isASTNodeDecl) - // Rewritten children - for (int k = 0; children_computed != null && k < children_computed.length; k++) { - if (children_computed[k]) { - System.out.println(children[k].relativeNodeID() + " rewritten, initial=" + - (init_children[k] != null ? init_children[k].relativeNodeID() : null)); - } - } -$endif $DumpAttributeValues // TODO: dump collection values $if (!#isASTNodeDecl) diff --git a/src/template/incremental/Notification.tt b/src/template/incremental/Notification.tt index d8528d09377a02e601c76d895ef5ea276539d9c9..55a1267371d24b4edd8ee641d47a5722e31f9f8e 100644 --- a/src/template/incremental/Notification.tt +++ b/src/template/incremental/Notification.tt @@ -181,34 +181,6 @@ $if(IncrementalChangeFlush) // flush children $if(IncrementalLevelParam) -$if(#isASTNodeDecl) -if (attrID.equals("getChild")) { - int i = (Integer)_parameters; - if (children_computed != null && i < children_computed.length && children_computed[i]) { - // Make sure this condition is false before calling notify. - // There may be a circular dependency resulting in a double flush otherwise. - // A double flush will cause null to be moved in as the initial child. - children_computed[i] = false; - children[i].inc_resetRewrites(); - // outer rewrites - if (init_children[i] != null) { - // set up change - $ASTNode oldChild = children[i]; - $ASTNode newChild = init_children[i]; - // make change - oldChild.inc_flush_subtree(getChild_handler[i]); - children[i] = newChild; - init_children[i] = null; - // set parent and notify - newChild.setParent(this); - getChild_handler[i].notifyDependencies(); - } else { - // inner rewrites - inc_restoreEnclosingRewrite(); - } - } -} -$endif $endif $if(IncrementalLevelAttr) diff --git a/src/template/incremental/Rewrites.tt b/src/template/incremental/Rewrites.tt index d60370b22a1e3652e7c6b18f68996e23cea6b0ba..24152c0528c6843f2725fca4d82367d787a5dbe9 100644 --- a/src/template/incremental/Rewrites.tt +++ b/src/template/incremental/Rewrites.tt @@ -212,6 +212,8 @@ $if(IncrementalEnabled) $if(#isASTNodeDecl) /** @apilevel internal */ protected $ASTNode $ASTNode.inc_locateInitialCopy() { + //TODO(emso): fix this method to work with CNTAs. + if (true) return null; // locate enclosing rewrite $ASTNode child = this; $ASTNode parent = getParent(); @@ -219,9 +221,9 @@ $if(#isASTNodeDecl) while (parent != null) { int index = child.childIndex; indexList.addFirst(Integer.valueOf(index)); - if (parent.init_children != null && index >= 0 && index < parent.init_children.length && parent.init_children[index] != null) { - break; - } + //if (parent.init_children != null && index >= 0 && index < parent.init_children.length && parent.init_children[index] != null) { + // break; + //} child = parent; parent = child.getParent(); } @@ -235,7 +237,7 @@ $if(#isASTNodeDecl) int index = ((Integer)itr.next()).intValue(); if (first) { first = false; - child = parent.init_children[index]; + //child = parent.init_children[index]; parent = child; } else if (index < parent.getNumChildNoTransform()) { child = parent.getChildNoTransform(index); diff --git a/src/template/incremental/State.tt b/src/template/incremental/State.tt index aa359045528c18a1dc9fe8574005093060ae2965..1cf8fce4e6cda74c3ef273736b8578896edef4f9 100644 --- a/src/template/incremental/State.tt +++ b/src/template/incremental/State.tt @@ -277,9 +277,6 @@ $if(#isASTNodeDecl) if (child != null) { child.inc_throwAway(); } - if (init_children != null && i < init_children.length && init_children[i] != null) { - init_children[i].inc_throwAway(); - } } $endif $if(IncrementalLevelAttr) @@ -291,9 +288,6 @@ $if(#isASTNodeDecl) if (child != null) { child.inc_throwAway(); } - if (init_children != null && i < init_children.length && init_children[i] != null) { - init_children[i].inc_throwAway(); - } } $endif $if(IncrementalLevelNode) @@ -303,9 +297,6 @@ $if(#isASTNodeDecl) if (child != null) { child.inc_throwAway(); } - if (init_children != null && i < init_children.length && init_children[i] != null) { - init_children[i].inc_throwAway(); - } } $endif $if(IncrementalLevelRegion) @@ -317,9 +308,6 @@ $if(#isASTNodeDecl) if (child != null) { child.inc_throwAway(); } - if (init_children != null && i < init_children.length && init_children[i] != null) { - init_children[i].inc_throwAway(); - } } $endif $else diff --git a/src/template/incremental/Tracking.tt b/src/template/incremental/Tracking.tt index 9bd43b7c6b85138cb702187ca0fb22c80467cb58..a94462671f96e5f7451f90d018d9e8e0a3a6c406 100644 --- a/src/template/incremental/Tracking.tt +++ b/src/template/incremental/Tracking.tt @@ -119,6 +119,7 @@ $endif $endif ]] + ASTNode.incHookGetChild1 = [[ $if(IncrementalEnabled)