Small bug fix for multicore gc w/o tasks
authorjzhou <jzhou>
Thu, 21 Oct 2010 18:27:54 +0000 (18:27 +0000)
committerjzhou <jzhou>
Thu, 21 Oct 2010 18:27:54 +0000 (18:27 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/BuildCodeMGC.java
Robust/src/Main/Main.java
Robust/src/Tests/MGC/SynchonizedTest.java

index c69398c3f166e883df393e1c964f8a3fc841358d..595fffe58cbbdd15307073240ddf1228b892320d 100644 (file)
@@ -636,8 +636,13 @@ public class BuildCode {
          outmethod.println("#include \"multicoreruntime.h\"");
          outmethod.println("#include \"runtime_arch.h\"");
     }
-    if (state.THREAD||state.DSM||state.SINGLETM)
-      outmethod.println("#include <thread.h>");
+    if (state.THREAD||state.DSM||state.SINGLETM) {
+      if(state.MGC) {
+        outmethod.println("#include \"thread.h\"");
+      } else {
+        outmethod.println("#include <thread.h>");
+      }
+    }
     if (state.main!=null) {
       outmethod.println("#include <string.h>");
     }
index b21d78d2a8f28ccab9bc0ae2eae00d48b6903371..d376247844cfc04516ead126225db1319ada327c 100644 (file)
@@ -183,6 +183,9 @@ public class BuildCodeMGC extends BuildCode {
     Iterator it_sclasses = sctbl.getDescriptorsIterator();
     while(it_sclasses.hasNext()) {
       ClassDescriptor t_cd = (ClassDescriptor)it_sclasses.next();
+      if(t_cd.getNumStaticFields() != 0) {
+        // TODO may need to invoke static field initialization here
+      }
       MethodDescriptor t_md = (MethodDescriptor)t_cd.getMethodTable().get("staticblocks");
       outmethod.println("   {");
       if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
index 0874728eeaa40ba1326fc65e75fd7834e61a4321..9c7b393ce7f1761fa83d4f8f54288fea99b4d25f 100644 (file)
@@ -148,9 +148,10 @@ public class Main {
        state.MULTICORE=true;
       else if (option.equals("-multicoregc"))
         state.MULTICOREGC=true;
-      else if (option.equals("-mgc"))
+      else if (option.equals("-mgc")) {
         state.MGC = true;
-      else if (option.equals("-ownership"))
+        state.THREAD = true;
+      } else if (option.equals("-ownership"))
        state.OWNERSHIP=true;
       else if (option.equals("-ownallocdepth")) {
        state.OWNERSHIPALLOCDEPTH=Integer.parseInt(args[++i]);
index 9b5528bcfc12d082800ad9c8ea25481924db6ca2..7d322ffb9d63ad67f385cd49017a203200d94bfe 100644 (file)
@@ -6,8 +6,10 @@ public class Counter{
     this.count = 0;
   }
 
-  public synchronized void add(long value){
-    this.count += value;
+  public add(long value){
+       synchronized (this) {
+      this.count += value;
+       }
   }
   
   public synchronized long getCounter() {