diff --git a/examples/actors/xdf/SSR.jrag b/examples/actors/xdf/SSR.jrag index 51f500d6e47e727a85eb5b42a1ca1e2e2e692da6..e1d452a3cd9efd0596bc284223c6efdc0ec92d57 100644 --- a/examples/actors/xdf/SSR.jrag +++ b/examples/actors/xdf/SSR.jrag @@ -25,24 +25,40 @@ aspect SSR { } +aspect SDF { + syn boolean Instance.isSDF() = true; +} + aspect StaticSchedule { - syn LinkedList ASTNode.genStaticSchedule(LinkedList l) = l; - eq Start.genStaticSchedule(LinkedList l) = getSpecification().genStaticSchedule(l); - eq Specification.genStaticSchedule(LinkedList l) { + public Instance Instance.next; + public Instance Instance.prev; + + + syn LinkedList<Instance> ASTNode.genStaticSchedule(LinkedList<Instance> l) = l; + eq Start.genStaticSchedule(LinkedList<Instance> l) = getSpecification().genStaticSchedule(l); + eq Specification.genStaticSchedule(LinkedList<Instance> l) { for (int i=0; i<getNumElement(); i++) { l = getElement(i).genStaticSchedule(l); } return l; } - eq XDF.genStaticSchedule(LinkedList l) { + eq XDF.genStaticSchedule(LinkedList<Instance> l) { for (int i=0; i<getNumElement(); i++) { l = getElement(i).genStaticSchedule(l); } return l; } - eq Connection.genStaticSchedule(LinkedList l) { + eq Connection.genStaticSchedule(LinkedList<Instance> l) { Instance src = getSource(); - System.out.println(src); + Instance dest = getDest(); + if (src.isSDF() && dest.isSDF()) { + src.next = dest; + dest.prev = src; + } + if (src.prev == null) { + l.add(src); + } +// System.out.println(src.name()); return l; // Instance dest = getDest(); } @@ -54,7 +70,18 @@ aspect ActorLookup { String Connection.source() { for (Attribute a : getAttributes()) { if (a instanceof src) { - return a.getAttrValue().getLITERAL(); + return fix(a.getAttrValue().getLITERAL()); + } + } + return ""; + } + + syn Instance Connection.getDest() = root().getInstance(dest()); + + String Connection.dest() { + for (Attribute a : getAttributes()) { + if (a instanceof dst) { + return fix(a.getAttrValue().getLITERAL()); } } return ""; @@ -77,6 +104,7 @@ aspect misc { return null; } eq Instance.getInstance(String s) { +// System.out.println(name()+" == "+s); if (name().equals(s)) { return this; } else { @@ -91,11 +119,18 @@ aspect misc { for (int i=0; i<getNumAttribute(); i++) { Attribute a = getAttribute(i); if (a instanceof id) { - return a.getAttrValue().getLITERAL(); + return fix(a.getAttrValue().getLITERAL()); } } return ""; } + + static String ASTNode.fix(String s) { + if (s.indexOf('"') == 0) { + return s.substring(1,s.length()-1); + } + return s; + } } diff --git a/examples/actors/xdf/SSRAnalysis.java b/examples/actors/xdf/SSRAnalysis.java index 1a7cd73e9675021ef55ff52ed83e150b6e6f4cc2..0590946c61cc9b16d8feab053f2be684adb9dddd 100644 --- a/examples/actors/xdf/SSRAnalysis.java +++ b/examples/actors/xdf/SSRAnalysis.java @@ -1,10 +1,21 @@ import xdfAST.Start; +import xdfAST.Instance; +import java.util.LinkedList; public class SSRAnalysis extends Parser { public static void main(String args[]) { Start ast = parse(args); ast.genSSR(System.out); + LinkedList<Instance> l = ast.genStaticSchedule(new LinkedList<Instance>()); + + for (Instance i: l){ + do { + System.out.print(i.name()+" -> "); + i = i.next; + } while (i != null); + System.out.println(); + } } } diff --git a/tools/jastadd2.jar b/tools/jastadd2.jar index 46ac7b36238e16fcdf1735c4299bc5731a63f7b2..8856a41c394d8ba30e293a0e1ceb2814bb1a96bc 100644 Binary files a/tools/jastadd2.jar and b/tools/jastadd2.jar differ