more bug fixes
authorbdemsky <bdemsky>
Thu, 10 May 2007 22:53:12 +0000 (22:53 +0000)
committerbdemsky <bdemsky>
Thu, 10 May 2007 22:53:12 +0000 (22:53 +0000)
Robust/src/IR/Flat/BuildFlat.java
Robust/src/IR/Flat/TempDescriptor.java
Robust/src/IR/Tree/BuildIR.java
Robust/src/Runtime/runtime.h

index c52841dd09da7db1a6ce4cf77cf635b3f6efe95f..14d50e7af7ce096137db3a23ad49d05397eeb54e 100644 (file)
@@ -41,21 +41,22 @@ public class BuildFlat {
 
        FlatMethod fm=new FlatMethod(td, ffan);
 
+       HashSet visitedset=new HashSet();
+
        for(int i=0;i<td.numParameters();i++) {
            VarDescriptor paramvd=td.getParameter(i);
            fm.addParameterTemp(getTempforVar(paramvd));
            TagExpressionList tel=td.getTag(paramvd);
-           HashSet visitedset=new HashSet();
            //BUG added next line to fix...to test feed in any task program
            if (tel!=null)
                for(int j=0;j<tel.numTags();j++) {
                    TagVarDescriptor tvd=(TagVarDescriptor) td.getParameterTable().getFromSameScope(tel.getName(j));
+                   TempDescriptor tagtmp=getTempforVar(tvd);
                    if (!visitedset.contains(tvd)) {
                        visitedset.add(tvd);
-                       TempDescriptor tagtmp=getTempforVar(tvd);
                        fm.addTagTemp(tagtmp);
-                       tel.setTemp(j, tagtmp);
                    }
+                   tel.setTemp(j, tagtmp);
                }
        }
 
@@ -704,7 +705,8 @@ public class BuildFlat {
                return td;
            } else if (d instanceof TagVarDescriptor) {
                TagVarDescriptor tvd=(TagVarDescriptor)d;
-               TempDescriptor td=TempDescriptor.paramtempFactory(tvd.getName(),tvd.getTag());
+               TypeDescriptor tagtype=new TypeDescriptor(typeutil.getClass(TypeUtil.TagClass));
+               TempDescriptor td=TempDescriptor.paramtempFactory(tvd.getName(), tagtype, tvd.getTag());
                temptovar.put(tvd,td);
                return td;
            } else throw new Error("Unreconized Descriptor");
@@ -717,12 +719,17 @@ public class BuildFlat {
        else {
            if (d instanceof VarDescriptor) {
                VarDescriptor vd=(VarDescriptor)d;
-               TempDescriptor td=TempDescriptor.tempFactory(vd.getName(),vd.getType());
+               TempDescriptor td=TempDescriptor.tempFactory(vd.getName(), vd.getType());
                temptovar.put(vd,td);
                return td;
            } else if (d instanceof TagVarDescriptor) {
                TagVarDescriptor tvd=(TagVarDescriptor)d;
-               TempDescriptor td=TempDescriptor.tempFactory(tvd.getName(),tvd.getTag());
+               //BUGFIX TAGTYPE - add next line, modify following
+               //line to tag this new type descriptor, modify
+               //TempDescriptor constructor & factory to set type
+               //using this Type To test, use any program with tags
+               TypeDescriptor tagtype=new TypeDescriptor(typeutil.getClass(TypeUtil.TagClass));
+               TempDescriptor td=TempDescriptor.tempFactory(tvd.getName(),tagtype, tvd.getTag());
                temptovar.put(tvd,td);
                return td;
            } else throw new Error("Unrecognized Descriptor");
index 932d7d58f28749ebe2075e16dd504dff60b47fac..2a3b0f9257445fb4e9b06e1ece5802c46cac7532 100644 (file)
@@ -18,8 +18,9 @@ public class TempDescriptor extends Descriptor {
        type=td;
     }
 
-    public TempDescriptor(String name, TagDescriptor td) {
+    public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) {
        this(name);
+       this.type=type;
        tag=td;
     }
     
@@ -35,16 +36,16 @@ public class TempDescriptor extends Descriptor {
        return new TempDescriptor(name+currentid,td);
     }
 
-    public static TempDescriptor tempFactory(String name, TagDescriptor tag) {
-       return new TempDescriptor(name+currentid,tag);
+    public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) {
+       return new TempDescriptor(name+currentid,type,tag);
     }
 
     public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) {
        return new TempDescriptor(name,td);
     }
 
-    public static TempDescriptor paramtempFactory(String name, TagDescriptor tag) {
-       return new TempDescriptor(name,tag);
+    public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) {
+       return new TempDescriptor(name, tagtype, tag);
     }
 
     public String toString() {
index d82d0350b99f72e5ce0ee603c678ff9dcfdb40df..591a67ea42779a64aeebe71c714aed84ba74c49b 100644 (file)
@@ -190,7 +190,9 @@ public class BuildIR {
     }
 
     public TagExpressionList parseTagExpressionList(ParseNode pn) {
-       ParseNodeVector pnv=pn.getChildren();
+       //BUG FIX: change pn.getChildren() to pn.getChild("tag_expression_list").getChildren()
+       //To test, feed in any input program that uses tags
+       ParseNodeVector pnv=pn.getChild("tag_expression_list").getChildren();
        TagExpressionList tel=new TagExpressionList();
        for(int i=0;i<pnv.size();i++) {
            ParseNode tn=pnv.elementAt(i);
index 19990a009952588187ded7843907017b22303204..b0500def20c4700d8c549ee537ce099a10bbc02c 100644 (file)
@@ -19,12 +19,16 @@ extern int failurecount;
 void * allocate_new(void *, int type);
 struct ArrayObject * allocate_newarray(void *, int type, int length);
 struct ___String___ * NewString(void *, const char *str,int length);
+struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
 #else
 void * allocate_new(int type);
 struct ArrayObject * allocate_newarray(int type, int length);
 struct ___String___ * NewString(const char *str,int length);
+struct ___TagDescriptor___ * allocate_tag(int index);
 #endif
 
+
+
 void initializeexithandler();
 void failedboundschk();
 void failednullptr();