get specjbb compiling again...get rid of annoying warnings...still left with large...
authorbdemsky <bdemsky>
Sat, 9 Apr 2011 10:45:10 +0000 (10:45 +0000)
committerbdemsky <bdemsky>
Sat, 9 Apr 2011 10:45:10 +0000 (10:45 +0000)
Robust/src/Analysis/CallGraph/JavaCallGraph.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/TypeUtil.java
Robust/src/Runtime/math.c
Robust/src/Runtime/object.c
Robust/src/Runtime/socket.c

index 14e9a759eb4f83911919c0643c5e26a10c539fbe..c7acbbe7fa02618bdb2a713bc2c64e658949aa66 100644 (file)
@@ -76,6 +76,7 @@ public class JavaCallGraph extends CallGraph {
              HashSet ns=new HashSet();
              ns.addAll(callees);
              ns.addAll(getMethods(tu.getRun(), fcall.getThis().getType()));
+             ns.addAll(getMethods(tu.getStaticStart(), fcall.getThis().getType()));
              callees=ns;
            }
          }
index ed6e796826d9dacbbedcc1fdec7bb4927a9f731f..6b625a519ceae206ba7533cb15f8cafb94480522 100644 (file)
@@ -2627,23 +2627,21 @@ public class BuildCode {
        // is a static block or is invoked in some static block
        ClassDescriptor cd = fm.getMethod().getClassDesc();
        ClassDescriptor cn = fsfn.getDst().getType().getClassDesc();
-       if(cd == cn) {
-         // the same class, do nothing
-       } else if(mgcstaticinit){
-      // generate static init check code if has not done the static init in main()
+       if(cd != cn && mgcstaticinit){
+         // generate static init check code if has not done the static init in main()
          if((cn.getNumStaticFields() != 0) || (cn.getNumStaticBlocks() != 0)) {
            // need to check if the class' static fields have been initialized and/or
            // its static blocks have been executed
            output.println("if(global_defsprim_p->" + cn.getSafeSymbol()+"static_block_exe_flag == 0) {");
            if(cn.getNumStaticBlocks() != 0) {
              MethodDescriptor t_md = (MethodDescriptor)cn.getMethodTable().get("staticblocks");
-          if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
-            output.print("       struct "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"_params __parameterlist__={");
-            output.println("0, NULL};");
-            output.println("     "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"(& __parameterlist__);");
-          } else {
-            output.println("  "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"();");
-          }
+             if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
+               output.print("       struct "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"_params __parameterlist__={");
+               output.println("0, NULL};");
+               output.println("     "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"(& __parameterlist__);");
+             } else {
+               output.println("  "+cn.getSafeSymbol()+t_md.getSafeSymbol()+"_"+t_md.getSafeMethodDescriptor()+"();");
+             }
            } else {
              output.println("  global_defsprim_p->" + cn.getSafeSymbol()+"static_block_exe_flag = 1;");
            }
@@ -2652,12 +2650,16 @@ public class BuildCode {
        }
       }
       // redirect to the global_defs_p structure
-       if (fsfn.getField().getType().isPtr())
+      if (fsfn.getField().getType().isPtr()) {
+       if (fsfn.getField().getType()!=fsfn.getSrc().getType())
          output.println("global_defs_p->" +
-                        fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";");
+                        fsfn.getField().getSafeSymbol()+"=(struct "+ fsfn.getField().getType().getSafeSymbol()+" *)"+generateTemp(fm,fsfn.getSrc())+";");
        else
-         output.println("global_defsprim_p->" +
+         output.println("global_defs_p->" +
                         fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";");
+      } else
+       output.println("global_defsprim_p->" +
+                      fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";");
     } else {
       output.println("#ifdef MULTICORE_DEBUG");
       output.println("if (" + generateTemp(fm,fsfn.getDst()) + " == NULL) {");
@@ -2669,8 +2671,12 @@ public class BuildCode {
       }
       output.println("}");
       output.println("#endif //MULTICORE_DEBUG");
-      output.println(generateTemp(fm, fsfn.getDst())+"->"+
-                    fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";");
+      if (fsfn.getSrc().getType().isPtr()&&fsfn.getSrc().getType()!=fsfn.getField().getType())
+       output.println(generateTemp(fm, fsfn.getDst())+"->"+
+                      fsfn.getField().getSafeSymbol()+"=(struct "+ fsfn.getField().getType().getSafeSymbol()+"*)"+generateTemp(fm,fsfn.getSrc())+";");
+      else
+       output.println(generateTemp(fm, fsfn.getDst())+"->"+
+                      fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc())+";");
     }
   }
 
index 61faa673f8b89bde904f7f5612499d5204ea309c..8613bbe359b0e602053e80cebfb8dfa352cc2363 100644 (file)
@@ -102,6 +102,17 @@ public class TypeUtil {
     }
     throw new Error("Can't find Thread.run");
   }
+
+  public MethodDescriptor getStaticStart() {
+    ClassDescriptor cd=getClass(TypeUtil.ThreadClass);
+    for(Iterator methodit=cd.getMethodTable().getSet("staticStart").iterator(); methodit.hasNext();) {
+      MethodDescriptor md=(MethodDescriptor) methodit.next();
+      if (md.numParameters()!=1||!md.getModifiers().isStatic()||!md.getParamType(0).isClass()||md.getParamType(0).getClassDesc()!=cd)
+       continue;
+      return md;
+    }
+    throw new Error("Can't find Thread.run");
+  }
   
   public MethodDescriptor getExecute() {
     ClassDescriptor cd = getClass(TypeUtil.TaskClass);
index e352244627ac23136403aaee705e38fdc0722e70..d930413dc1d2e15e352d1a80e340c7cdaef58c98 100644 (file)
@@ -1,6 +1,7 @@
 #include "runtime.h"
 #include "math.h"
 #include "structdefs.h"
+#include "methodheaders.h"
 
 #ifdef D___Math______cos____D
 double CALL11(___Math______cos____D, double ___a___, double ___a___) {
index a7e1062ac0fe2073ba804910bba50d46142d88df..55de437ade644fdfb8a4493d4b8dc37c9022246a 100644 (file)
@@ -44,16 +44,18 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
     atomic_inc(&VAR(___this___)->lockcount);
   } else {
     while(1) {
-      if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
-       VAR(___this___)->___prevlockobject___=NULL;
-       VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
-       if (VAR(___this___)->___nextlockobject___!=NULL)
-         VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
-       pthread_setspecific(threadlocks, VAR(___this___));
-       VAR(___this___)->tid=self;
-       pthread_mutex_unlock(&objlock);
-       BARRIER();
-       return;
+      if (VAR(___this___)->lockcount==0) {
+       if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
+         VAR(___this___)->___prevlockobject___=NULL;
+         VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
+         if (VAR(___this___)->___nextlockobject___!=NULL)
+           VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
+         pthread_setspecific(threadlocks, VAR(___this___));
+         VAR(___this___)->tid=self;
+         pthread_mutex_unlock(&objlock);
+         BARRIER();
+         return;
+       }
       }
       {
 #ifdef PRECISE_GC
@@ -109,16 +111,18 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
 #endif
 
   while(1) {
-    if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) {
-      VAR(___this___)->___prevlockobject___=NULL;
-      VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
-      if (VAR(___this___)->___nextlockobject___!=NULL)
-       VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
-      pthread_setspecific(threadlocks, VAR(___this___));
-      VAR(___this___)->tid=self;
-      pthread_mutex_unlock(&objlock);
-      BARRIER();
-      return;
+    if (VAR(___this___)->lockcount==0) {
+      if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) {
+       VAR(___this___)->___prevlockobject___=NULL;
+       VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
+       if (VAR(___this___)->___nextlockobject___!=NULL)
+         VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
+       pthread_setspecific(threadlocks, VAR(___this___));
+       VAR(___this___)->tid=self;
+       pthread_mutex_unlock(&objlock);
+       BARRIER();
+       return;
+      }
     }
     {
 #ifdef PRECISE_GC
index bc46887031465c43e518aadef43b46a71e4992db..f06476bde29886a98770790881e00a9602bd5392 100644 (file)
@@ -11,6 +11,7 @@
 #endif
 #include "SimpleHash.h"
 #include "GenericHashtable.h"
+#include "methodheaders.h"
 
 struct RuntimeHash *fdtoobject;