Fix a shadow field related bug in the compiler. Defined in Java language specificatio...
authorjzhou <jzhou>
Thu, 24 Feb 2011 01:04:32 +0000 (01:04 +0000)
committerjzhou <jzhou>
Thu, 24 Feb 2011 01:04:32 +0000 (01:04 +0000)
Robust/src/IR/ClassDescriptor.java
Robust/src/IR/FieldDescriptor.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/bamboo/multicoreruntime.c
Robust/src/Runtime/object.c
Robust/src/Runtime/runtime.c
Robust/src/Runtime/socket.c
Robust/src/Runtime/thread.c

index 3ca241e0a12725125769da72288bee1a6d9273b0..86babe8dc3ff56e90704d380c4a5e599cdc64458 100644 (file)
@@ -202,6 +202,7 @@ public class ClassDescriptor extends Descriptor {
     if(fd.isStatic()) {
       this.incStaticFields();
     }
+    fd.setClassDescriptor(this);
   }
 
   public void addMethod(MethodDescriptor md) {
index ce515321a3d5e80eedfe9984feae037bf92b8d1a..26b471791412405090f5b5406f62285ab1ba13c5 100644 (file)
@@ -19,6 +19,8 @@ public class FieldDescriptor extends Descriptor {
   private boolean isglobal;
   private boolean isenum;
   private int enumvalue;
+  
+  private ClassDescriptor cn;
 
   public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e, boolean isglobal) {
     super(identifier);
@@ -32,6 +34,14 @@ public class FieldDescriptor extends Descriptor {
     this.enumvalue = -1;
   }
   
+  public ClassDescriptor getClassDescriptor() {
+    return this.cn;
+  }
+  
+  public void setClassDescriptor(ClassDescriptor cn) {
+    this.cn = cn;
+  }
+  
   public boolean isEnum() {
     return this.isenum;
   }
index d5f00a295f48889e41f6ae742f7d13f10814c8b5..0fe70ab4c99ec229dd0a1ad6aef945d8f5b35dd1 100644 (file)
@@ -67,8 +67,6 @@ public class BuildCode {
   DCWrapper delaycomp;
   CallGraph callgraph;
   Hashtable<String, ClassDescriptor> printedfieldstbl;
-  Hashtable<ClassDescriptor, Hashtable<String, ClassDescriptor>> cd2fieldstbl;
-  Hashtable<ClassDescriptor, Vector<FieldDescriptor>> cd2shadowfields;
 
 
   public BuildCode(State st, Hashtable temptovar, TypeUtil typeutil, SafetyAnalysis sa, PrefetchAnalysis pa) {
@@ -115,8 +113,6 @@ public class BuildCode {
       recorddc.doAnalysis();
     }
     printedfieldstbl = new Hashtable<String, ClassDescriptor>();
-    cd2fieldstbl = new Hashtable<ClassDescriptor, Hashtable<String, ClassDescriptor>>();
-    cd2shadowfields = new Hashtable<ClassDescriptor, Vector<FieldDescriptor>>();
   }
 
   /** The buildCode method outputs C code for all the methods.  The Flat
@@ -1415,7 +1411,8 @@ public class BuildCode {
          continue;
        if (type.isPtr()) {
          output.println(",");
-         output.print("((unsigned INTPTR)&(((struct "+cn.getSafeSymbol() +" *)0)->"+fd.getSafeSymbol()+"))");
+         output.print("((unsigned INTPTR)&(((struct "+cn.getSafeSymbol() +" *)0)->"+
+          (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSafeSymbol())+fd.getSafeSymbol()+"))");
        }
       }
       output.println("};");
@@ -1504,7 +1501,6 @@ public class BuildCode {
     if (sp!=null)
       printClassStruct(sp, classdefout, /*globaldefout*/null);
     
-    // TODO: what about here are multiple inherited fields with the same name?
     SymbolTable sitbl = cn.getSuperInterfaceTable();
     Iterator it_sifs = sitbl.getDescriptorsIterator();
     if(state.MGC) {
@@ -1513,21 +1509,17 @@ public class BuildCode {
         printClassStruct(si, classdefout, /*globaldefout*/null);
       }
     }
-    
-    Vector shadow_fields = null;
 
     if (!fieldorder.containsKey(cn)) {
       Vector fields=new Vector();
       fieldorder.put(cn,fields);
-      shadow_fields = new Vector();
-      cd2shadowfields.put(cn, shadow_fields);
       
       Vector fieldvec=cn.getFieldVec();
       for(int i=0;i<fieldvec.size();i++) {
        FieldDescriptor fd=(FieldDescriptor)fieldvec.get(i);
     if(state.MGC) {
       if((sp != null) && sp.getFieldTable().contains(fd.getSymbol())) {
-        shadow_fields.add(fd);
+        // a shadow field
       } else {
         it_sifs = sitbl.getDescriptorsIterator();
         boolean hasprinted = false;
@@ -1540,7 +1532,6 @@ public class BuildCode {
         }
         if(hasprinted) {
           // this field has been defined in the super class
-          shadow_fields.add(fd);
         } else {
           fields.add(fd);
         }
@@ -1552,19 +1543,21 @@ public class BuildCode {
       }
     }
     Vector fields=(Vector)fieldorder.get(cn);
-    shadow_fields=cd2shadowfields.get(cn);
+    
+    /*Vector */fields = cn.getFieldVec();
 
     for(int i=0; i<fields.size(); i++) {
       FieldDescriptor fd=(FieldDescriptor)fields.get(i);
-      if(printedfieldstbl.containsKey(fd.getSymbol())) {
-        printedfieldstbl.put(fd.getSymbol(), cn);
+      String fstring = (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSymbol()) + fd.getSymbol();
+      if(printedfieldstbl.containsKey(fstring)) {
+        printedfieldstbl.put(fstring, cn);
         continue;
       } else {
-        printedfieldstbl.put(fd.getSymbol(), cn);
+        printedfieldstbl.put(fstring, cn);
       }
       if (state.MGC && fd.getType().isClass()
           && fd.getType().getClassDesc().isEnum()) {
-        classdefout.println("  int " + fd.getSafeSymbol() + ";");
+        classdefout.println("  int " + cn.getSafeSymbol() + fd.getSafeSymbol() + ";");
       } else if (fd.getType().isClass()||fd.getType().isArray()) {
         if ((state.MGC) && (fd.isStatic())) {
           // TODO add version for normal Java later
@@ -1576,16 +1569,16 @@ public class BuildCode {
               globaldefout.println("  struct "+fd.getType().getSafeSymbol()+ " * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
             }
           }
-          classdefout.println("  struct "+fd.getType().getSafeSymbol()+" ** "+fd.getSafeSymbol()+";");
+          classdefout.println("  struct "+fd.getType().getSafeSymbol()+" ** "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
         } else if ((state.MGC) && (fd.isVolatile())) {
           // TODO add version for normal Java later
           // static field
           if(globaldefout != null) {
             globaldefout.println("  volatile struct "+fd.getType().getSafeSymbol()+ " * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
           }
-          classdefout.println("  struct"+fd.getType().getSafeSymbol()+" ** "+fd.getSafeSymbol()+";");
+          classdefout.println("  struct"+fd.getType().getSafeSymbol()+" ** "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
         } else {
-       classdefout.println("  struct "+fd.getType().getSafeSymbol()+" * "+fd.getSafeSymbol()+";");
+       classdefout.println("  struct "+fd.getType().getSafeSymbol()+" * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
         }
       } else if ((state.MGC) && (fd.isStatic())) {
         // TODO add version for normal Java later
@@ -1597,53 +1590,16 @@ public class BuildCode {
             globaldefout.println("  "+fd.getType().getSafeSymbol()+ " "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
           }
         }
-        classdefout.println("  "+fd.getType().getSafeSymbol()+" * "+fd.getSafeSymbol()+";");
+        classdefout.println("  "+fd.getType().getSafeSymbol()+" * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
       } else if ((state.MGC) && (fd.isVolatile())) {
         // TODO add version for normal Java later
         // static field
         if(globaldefout != null) {
           globaldefout.println("  volatile "+fd.getType().getSafeSymbol()+ " "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
         }
-        classdefout.println("  "+fd.getType().getSafeSymbol()+" * "+fd.getSafeSymbol()+";");
+        classdefout.println("  "+fd.getType().getSafeSymbol()+" * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
       } else
-       classdefout.println("  "+fd.getType().getSafeSymbol()+" "+fd.getSafeSymbol()+";");
-    }
-    
-    // check the shadow fields, for those static shadow fields, need to add a 
-    // corresponding field in the global_defs_p structure
-    for(int i=0; i<shadow_fields.size(); i++) {
-      FieldDescriptor fd=(FieldDescriptor)shadow_fields.get(i);
-      if ((state.MGC) && (fd.isStatic()) && (globaldefout != null)) {
-        if (fd.getType().isClass()||fd.getType().isArray()) { 
-          // TODO add version for normal Java later
-          // static field
-          if(fd.isVolatile()) {
-            globaldefout.println("  volatile struct "+fd.getType().getSafeSymbol()+ " * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-          } else {
-            globaldefout.println("  struct "+fd.getType().getSafeSymbol()+ " * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-          }
-        } else {
-          // TODO add version for normal Java later
-          // static field
-          if(fd.isVolatile()) {
-            globaldefout.println("  volatile "+fd.getType().getSafeSymbol()+ " "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-          } else {
-            globaldefout.println("  "+fd.getType().getSafeSymbol()+ " "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-          }
-        } 
-      } else if ((state.MGC) && (fd.isVolatile()) && (globaldefout != null)) {
-        // TODO add version for normal Java later
-        // static field
-        if (fd.getType().isClass()||fd.getType().isArray()) { 
-          // TODO add version for normal Java later
-          // static field
-          globaldefout.println("  volatile struct "+fd.getType().getSafeSymbol()+ " * "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-        } else {
-          // TODO add version for normal Java later
-          // static field
-          globaldefout.println("  volatile "+fd.getType().getSafeSymbol()+ " "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
-        } 
-      }
+       classdefout.println("  "+fd.getType().getSafeSymbol()+" "+cn.getSafeSymbol()+fd.getSafeSymbol()+";");
     }
   }
 
@@ -1728,8 +1684,7 @@ public class BuildCode {
       }
     }
     printClassStruct(cn, classdefout, globaldefout);
-    cd2fieldstbl.put(cn, printedfieldstbl);
-    printedfieldstbl = new Hashtable<String, ClassDescriptor>();
+    printedfieldstbl.clear();
     classdefout.println("};\n");
 
     if (state.DSM||state.SINGLETM) {
@@ -2127,12 +2082,7 @@ public class BuildCode {
         FieldDescriptor fd=(FieldDescriptor)fields.get(i);
         if(fd.isStatic()) {
           // static field
-          // decide the exact class/interface that defines the field
-          ClassDescriptor fdcn = 
-            cd2fieldstbl.get(cn).get(fd.getSymbol());
-
-          // static field
-          output.println(generateTemp(fm,fm.getParameter(0),lb)+"->"+fd.getSafeSymbol()+"=&(global_defs_p->"+fdcn.getSafeSymbol()+fd.getSafeSymbol()+");");
+          output.println(generateTemp(fm,fm.getParameter(0),lb)+"->"+cn.getSafeSymbol()+fd.getSafeSymbol()+"=&(global_defs_p->"+fd.getClassDescriptor().getSafeSymbol()+fd.getSafeSymbol()+");");
         }
       }
     }
@@ -2673,7 +2623,8 @@ public class BuildCode {
   public void generateFlatOffsetNode(FlatMethod fm, LocalityBinding lb, FlatOffsetNode fofn, PrintWriter output) {
     output.println("/* FlatOffsetNode */");
     FieldDescriptor fd=fofn.getField();
-    output.println(generateTemp(fm, fofn.getDst(),lb)+ " = (short)(int) (&((struct "+fofn.getClassType().getSafeSymbol() +" *)0)->"+ fd.getSafeSymbol()+");");
+    output.println(generateTemp(fm, fofn.getDst(),lb)+ " = (short)(int) (&((struct "+fofn.getClassType().getSafeSymbol() +" *)0)->"+ 
+        (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSafeSymbol()) + fd.getSafeSymbol()+");");
     output.println("/* offset */");
   }
 
@@ -2787,9 +2738,11 @@ public class BuildCode {
          if (!teststr.equals(""))
            teststr+="&&";
          teststr+="((prefptr="+basestr+")!=NULL)";
-         basestr="((struct "+lasttype.getSafeSymbol()+" *)prefptr)->"+fd.getSafeSymbol();
+         basestr="((struct "+lasttype.getSafeSymbol()+" *)prefptr)->"+
+      (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSafeSymbol())+fd.getSafeSymbol();
        } else {
-         basestr=basestr+"->"+fd.getSafeSymbol();
+         basestr=basestr+"->"+
+      (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSafeSymbol())+fd.getSafeSymbol();
          maybenull=true;
        }
        lasttype=fd.getType();
@@ -2823,7 +2776,8 @@ public class BuildCode {
       Object desc = pp.getDescAt(i);
       if(desc instanceof FieldDescriptor) {
        FieldDescriptor fd=(FieldDescriptor)desc;
-       newfieldoffset = new String("(unsigned int)(&(((struct "+ lasttype.getSafeSymbol()+" *)0)->"+ fd.getSafeSymbol()+ "))");
+       newfieldoffset = new String("(unsigned int)(&(((struct "+ lasttype.getSafeSymbol()+" *)0)->"+ 
+        (fd.getClassDescriptor()==null?"":fd.getClassDescriptor().getSafeSymbol()) + fd.getSafeSymbol()+ "))");
        lasttype=fd.getType();
       } else {
        newfieldoffset = "";
@@ -3298,7 +3252,7 @@ public class BuildCode {
   private void generateFlatFieldNode(FlatMethod fm, LocalityBinding lb, FlatFieldNode ffn, PrintWriter output) {
     if (state.SINGLETM) {
       //single machine transactional memory case
-      String field=ffn.getField().getSafeSymbol();
+      String field=(ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol();
       String src=generateTemp(fm, ffn.getSrc(),lb);
       String dst=generateTemp(fm, ffn.getDst(),lb);
 
@@ -3318,7 +3272,7 @@ public class BuildCode {
     } else if (state.DSM) {
       Integer status=locality.getNodePreTempInfo(lb,ffn).get(ffn.getSrc());
       if (status==LocalityAnalysis.GLOBAL) {
-       String field=ffn.getField().getSafeSymbol();
+       String field=(ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol();
        String src=generateTemp(fm, ffn.getSrc(),lb);
        String dst=generateTemp(fm, ffn.getDst(),lb);
 
@@ -3348,7 +3302,7 @@ public class BuildCode {
       } else if (status==LocalityAnalysis.LOCAL) {
        if (ffn.getField().getType().isPtr()&&
            ffn.getField().isGlobal()) {
-         String field=ffn.getField().getSafeSymbol();
+         String field=(ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol();
          String src=generateTemp(fm, ffn.getSrc(),lb);
          String dst=generateTemp(fm, ffn.getDst(),lb);
          output.println(dst+"="+ src +"->"+field+ ";");
@@ -3401,23 +3355,23 @@ public class BuildCode {
         }
         // redirect to the global_defs_p structure
         if((ffn.getField().isStatic()) || (ffn.getSrc().getType().isClassNameRef())) {
-          // decide the exact class/interface that defines the field
-          ClassDescriptor fdcn = 
-            cd2fieldstbl.get(ffn.getSrc().getType().getClassDesc()).get(ffn.getField().getSymbol());
-
           // reference to the static field with Class name
-          output.println(generateTemp(fm, ffn.getDst(),lb)+"=global_defs_p->"+ fdcn.getSafeSymbol()+ffn.getField().getSafeSymbol()+";");
+          output.println(generateTemp(fm, ffn.getDst(),lb)+"=global_defs_p->"+ 
+              ffn.getField().getClassDescriptor().getSafeSymbol()+ffn.getField().getSafeSymbol()+";");
         } else {
-          output.println(generateTemp(fm, ffn.getDst(),lb)+"=*"+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";");
+          output.println(generateTemp(fm, ffn.getDst(),lb)+"=*"+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ 
+              (ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol()+";");
         }
       } else if (ffn.getField().isEnum()) {
           // an Enum value, directly replace the field access as int
           output.println(generateTemp(fm, ffn.getDst(), lb) + "=" + ffn.getField().enumValue() + ";");
          } else {
-        output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";");
+        output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ 
+            (ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol()+";");
       } 
     } else {
-        output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";");
+        output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ 
+            (ffn.getField().getClassDescriptor()==null?"":ffn.getField().getClassDescriptor().getSafeSymbol()) + ffn.getField().getSafeSymbol()+";");
       }
     }
   }
@@ -3449,10 +3403,12 @@ public class BuildCode {
        output.println("*((unsigned int *)&("+dst+"->___objstatus___))|=DIRTY;");
       }
       if (srcptr&!fsfn.getSrc().getType().isNull()) {
-       output.println("*((unsigned INTPTR *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;");
+       output.println("*((unsigned INTPTR *)&("+dst+"->"+ 
+        (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"))=srcoid;");
        output.println("}");
       } else {
-       output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";");
+       output.println(dst+"->"+ 
+        (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ src+";");
       }
     } else if (state.DSM && locality.getAtomic(lb).get(fsfn).intValue()>0) {
       Integer statussrc=locality.getNodePreTempInfo(lb,fsfn).get(fsfn.getSrc());
@@ -3471,9 +3427,11 @@ public class BuildCode {
        if (wb.needBarrier(fsfn))
          output.println("*((unsigned int *)&("+dst+"->___localcopy___))|=DIRTY;");
        if (srcglobal) {
-         output.println("*((unsigned INTPTR *)&("+glbdst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;");
+         output.println("*((unsigned INTPTR *)&("+glbdst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"))=srcoid;");
        } else
-         output.println(glbdst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";");
+         output.println(glbdst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ src+";");
       } else if (statusdst.equals(LocalityAnalysis.LOCAL)) {
        /** Check if we need to copy */
        output.println("if(!"+dst+"->"+localcopystr+") {");
@@ -3488,17 +3446,21 @@ public class BuildCode {
        output.println("revertlist=(struct ___Object___ *)"+dst+";");
        output.println("}");
        if (srcglobal)
-         output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=(void *) srcoid;");
+         output.println(dst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"=(void *) srcoid;");
        else
-         output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";");
+         output.println(dst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ src+";");
       } else if (statusdst.equals(LocalityAnalysis.EITHER)) {
        //writing to a null...bad
        output.println("if ("+dst+") {");
        output.println("printf(\"BIG ERROR 2\\n\");exit(-1);}");
        if (srcglobal)
-         output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=(void *) srcoid;");
+         output.println(dst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"=(void *) srcoid;");
        else
-         output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";");
+         output.println(dst+"->"+ 
+          (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ src+";");
       }
       if (srcglobal) {
        output.println("}");
@@ -3553,20 +3515,19 @@ public class BuildCode {
         }
         // redirect to the global_defs_p structure
         if(fsfn.getDst().getType().isClassNameRef()) {
-          // reference to the static field with Class name
-          // decide the exact class/interface that defines the field
-          ClassDescriptor fdcn = 
-            cd2fieldstbl.get(fsfn.getDst().getType().getClassDesc()).get(fsfn.getField().getSymbol());
-          
-          output.println("global_defs_p->" + fdcn.getSafeSymbol() + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
+          // reference to the static field with Class name 
+          output.println("global_defs_p->" + fsfn.getField().getClassDescriptor().getSafeSymbol() + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
         } else {
-          output.println("*"+generateTemp(fm, fsfn.getDst(),lb)+"->"+ fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
+          output.println("*"+generateTemp(fm, fsfn.getDst(),lb)+"->"+ 
+              (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
         }
       } else {
-        output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
+        output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ 
+            (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
       } 
       } else {
-        output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
+        output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ 
+            (fsfn.getField().getClassDescriptor()==null?"":fsfn.getField().getClassDescriptor().getSafeSymbol()) + fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
       }
     }
   }
index f08c944723643d9d646e67928423fb8b5d3e5ca6..09ffaf33045c19023b92d4f42959c5df871c9a11 100644 (file)
@@ -225,11 +225,11 @@ long long CALL00(___System______currentTimeMillis____) {
 void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) {
 #ifdef MGC
 #ifdef TILERA_BME
-  struct ArrayObject * chararray=VAR(___s___)->___value___;
+  struct ArrayObject * chararray=VAR(___s___)->___String______value___;
   int i;
-  int offset=VAR(___s___)->___offset___;
+  int offset=VAR(___s___)->___String______offset___;
   tprintf("");
-  for(i=0; i<VAR(___s___)->___count___; i++) {
+  for(i=0; i<VAR(___s___)->___String______count___; i++) {
        short sc=
          ((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
     printf("%c", sc);
@@ -328,9 +328,9 @@ struct ___String___ * NewString(const char *str,int length) {
   struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
   struct ___String___ * strobj=allocate_new(STRINGTYPE);
 #endif
-  strobj->___value___=chararray;
-  strobj->___count___=length;
-  strobj->___offset___=0;
+  strobj->___String______value___=chararray;
+  strobj->___String______count___=length;
+  strobj->___String______offset___=0;
 
   for(i=0; i<length; i++) {
     ((short*)(((char*)&chararray->___length___)+sizeof(int)))[i]=(short)str[i];
@@ -345,6 +345,8 @@ void failedboundschk() {
   printf("Array out of bounds\n");
 #ifdef THREADS
   threadexit();
+#elif defined MGC
+  BAMBOO_EXIT(0xa002);
 #else
   exit(-1);
 #endif
index c552b4c51d92fd27c3c41405e2321081ea1f25cb..8b09a3b2e15c82444c1c7f45c1c3c69fd860a257 100644 (file)
@@ -33,10 +33,10 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
 #endif
     while(1) {
       if (VAR(___this___)->tid==0) {
-       VAR(___this___)->___prevlockobject___=NULL;
-       VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
-       if (VAR(___this___)->___nextlockobject___!=NULL)
-         VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
+       VAR(___this___)->___Object______prevlockobject___=NULL;
+       VAR(___this___)->___Object______nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
+       if (VAR(___this___)->___Object______nextlockobject___!=NULL)
+         VAR(___this___)->___Object______nextlockobject___->___Object______prevlockobject___=VAR(___this___);
        pthread_setspecific(threadlocks, VAR(___this___));
        VAR(___this___)->lockcount=1;
        VAR(___this___)->tid=self;
@@ -61,12 +61,12 @@ int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
   if (self==VAR(___this___)->tid) {
     VAR(___this___)->lockcount--;
     if (VAR(___this___)->lockcount==0) {
-      if (VAR(___this___)->___prevlockobject___==NULL) {
-       pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
+      if (VAR(___this___)->___Object______prevlockobject___==NULL) {
+       pthread_setspecific(threadlocks, VAR(___this___)->___Object______nextlockobject___);
       } else
-       VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
-      if (VAR(___this___)->___nextlockobject___!=NULL)
-       VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
+       VAR(___this___)->___Object______prevlockobject___->___Object______nextlockobject___=VAR(___this___)->___Object______nextlockobject___;
+      if (VAR(___this___)->___Object______nextlockobject___!=NULL)
+       VAR(___this___)->___Object______nextlockobject___->___Object______prevlockobject___=VAR(___this___)->___Object______prevlockobject___;
       VAR(___this___)->lockentry=NULL;
       VAR(___this___)->tid=0;
     }
index 8cf71847fe0b88bf6b65d88302967862a1846ae8..4ba5e83c2f42d8eaffb724e57285b07ef38c381e 100644 (file)
@@ -387,10 +387,10 @@ long long CALL00(___System______getticks____) {
 }
 
 void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) {
-  struct ArrayObject * chararray=VAR(___s___)->___value___;
+  struct ArrayObject * chararray=VAR(___s___)->___String______value___;
   int i;
-  int offset=VAR(___s___)->___offset___;
-  for(i=0; i<VAR(___s___)->___count___; i++) {
+  int offset=VAR(___s___)->___String______offset___;
+  for(i=0; i<VAR(___s___)->___String______count___; i++) {
     short sc=((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
     putchar(sc);
   }
@@ -733,9 +733,9 @@ __attribute__((malloc)) struct ___String___ * NewString(const char *str,int leng
   struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
   struct ___String___ * strobj=allocate_new(STRINGTYPE);
 #endif
-  strobj->___value___=chararray;
-  strobj->___count___=length;
-  strobj->___offset___=0;
+  strobj->___String______value___=chararray;
+  strobj->___String______count___=length;
+  strobj->___String______offset___=0;
 
   for(i=0; i<length; i++) {
     ((short *)(((char *)&chararray->___length___)+sizeof(int)))[i]=(short)str[i];
index e9e73d45ec9efdfdd85611d15602356962af091a..8812ea85c85ef2a2f4c5a89fe625327916335bec 100644 (file)
@@ -299,7 +299,7 @@ int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSo
 #else
   struct sockaddr_in sin;
   unsigned int sinlen=sizeof(sin);
-  int fd=VAR(___this___)->___fd___;
+  int fd=VAR(___this___)->___ServerSocket______fd___;
   int newfd;
 #if defined(THREADS)||defined(DSTM)||defined(STM)
 #ifdef PRECISE_GC
@@ -348,7 +348,7 @@ int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSo
 void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, struct ___Socket___ * ___this___, struct ArrayObject * ___b___, int offset, int length) {
 #ifdef MULTICORE
 #else
-  int fd=VAR(___this___)->___fd___;
+  int fd=VAR(___this___)->___Socket______fd___;
   char * charstr=((char *)&VAR(___b___)->___length___)+sizeof(int)+offset;
   while(1) {
     int offset=0;
@@ -374,7 +374,7 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___,
 #ifdef MULTICORE
   return -1;
 #else
-  int fd=VAR(___this___)->___fd___;
+  int fd=VAR(___this___)->___Socket______fd___;
   int length=VAR(___b___)->___length___;
 
   char * charstr=malloc(length);
@@ -426,7 +426,7 @@ int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___,
 void CALL01(___Socket______nativeClose____, struct ___Socket___ * ___this___) {
 #ifdef MULTICORE
 #else
-  int fd=VAR(___this___)->___fd___;
+  int fd=VAR(___this___)->___Socket______fd___;
   int data;
 #ifdef TASK
   RuntimeHashget(fdtoobject, fd, &data);
index c46b100039a8e9544853c44d5adcb9729673b9fa..848243d05e036c7b1a4e2eabf2a3b6aefc399f93 100644 (file)
@@ -65,9 +65,9 @@ void threadexit() {
 #ifdef THREADS
   struct ___Object___ *ll=pthread_getspecific(threadlocks);
   while(ll!=NULL) {
-    struct ___Object___ *llnext=ll->___nextlockobject___;
-    ll->___nextlockobject___=NULL;
-    ll->___prevlockobject___=NULL;
+    struct ___Object___ *llnext=ll->___Object______nextlockobject___;
+    ll->___Object______nextlockobject___=NULL;
+    ll->___Object______prevlockobject___=NULL;
     ll->lockcount=0;
     ll->tid=0; //unlock it
     ll=llnext;
@@ -346,7 +346,7 @@ void initthread(struct ___Thread___ * ___this___) {
 #else
   ___Thread______staticStart____L___Thread___(___this___);
 #endif
-  ___this___->___finished___=1;
+  ___this___->___Thread______finished___=1;
   pthread_mutex_lock(&joinlock);
   pthread_cond_signal(&joincond);
   pthread_mutex_unlock(&joinlock);
@@ -477,7 +477,7 @@ transstart:
 #if defined(THREADS)||defined(STM)
 void CALL01(___Thread______nativeJoin____, struct ___Thread___ * ___this___) {
   pthread_mutex_lock(&joinlock);
-  while(!VAR(___this___)->___finished___) {
+  while(!VAR(___this___)->___Thread______finished___) {
 #ifdef PRECISE_GC
   stopforgc((struct garbagelist *)___params___);
 #endif