Bug fix. Now the SPECjbb2005 can run with small workload that does not invoke gc
authorjzhou <jzhou>
Wed, 16 Mar 2011 23:18:16 +0000 (23:18 +0000)
committerjzhou <jzhou>
Wed, 16 Mar 2011 23:18:16 +0000 (23:18 +0000)
Robust/src/ClassLibrary/MGC/System.java
Robust/src/ClassLibrary/MGC/Thread.java
Robust/src/ClassLibrary/MGC/gnu/Collections.java
Robust/src/ClassLibrary/MGC/gnu/DecimalFormat.java
Robust/src/ClassLibrary/MGC/gnu/File.java
Robust/src/ClassLibrary/MGC/gnu/Float.java
Robust/src/ClassLibrary/MGC/gnu/Logger.java
Robust/src/ClassLibrary/MGC/gnu/Properties.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/bamboo/multicoremem.c
Robust/src/Runtime/bamboo/multicoreruntime.c

index 01d46c8149e7d7038a6359cf49808a1cddb17a08..45da9df3f587e8bea8ffba5a462786c6614cad82 100644 (file)
@@ -95,7 +95,11 @@ public class System {
   public static void genReach();
   
   private static Properties props;
-  private static native Properties initProperties(Properties props);
+  private static native Properties initProperties();
+  
+  static {
+    initProperties();
+  }
   
   public static Properties getProperties() {
     return props;
index 14ed23e539a67f83bc537b8ec92da028745b00e6..f329774e0ff49a82a538b3ca2bcc7e9aad10a85b 100644 (file)
@@ -18,6 +18,7 @@ public class Thread implements Runnable {
 
   private static void staticStart(Thread t) {
     t.run();
+    t.finished = true;
   }
 
   public static native void yield();
@@ -34,10 +35,13 @@ public class Thread implements Runnable {
     if(target != null) {
       target.run();
     }
+    this.finished = true;
   }
 
   private native void nativeCreate();
   
-  public final native boolean isAlive();
+  public final boolean isAlive() {
+    return !this.finished;
+  }
 
 }
index 4ce8db7670ce863ddad7b0b109221c34c01310d4..416d9b184455dfdf18128f3c38b235317588ebd2 100644 (file)
@@ -94,6 +94,6 @@ public class Collections
        i.next();
        i.set(a[pos]);
       }*/
-    System.println("Collections.sort() invoked");
+    //TODO System.println("Collections.sort() invoked");
   }
 } // class Collections
index 5cafa937c3021f9e347e22ac3ac97e35fb5d057c..bfd245c2e4082806081060eb3a3c3fb30b8e21f0 100644 (file)
@@ -305,12 +305,12 @@ public class DecimalFormat //extends NumberFormat
   }*/
   
   public StringBuffer format(long l) {
-    System.println("Unimplemented DecimalFormat.format(long)");
+    // TODO System.println("Unimplemented DecimalFormat.format(long)");
     return new StringBuffer("");
   }
   
   public StringBuffer format(double l) {
-    System.println("Unimplemented DecimalFormat.format(double)");
+    // TODO System.println("Unimplemented DecimalFormat.format(double)");
     return new StringBuffer("");
   }
   
index 5ecf4d322fa6ca93d2026c0f43df6192cb37cd76..0e11599cc5fdfa685fddbea0e7cb641cac8777c3 100644 (file)
@@ -38,7 +38,7 @@ public class File {
   }
   
   public boolean delete() {
-    System.println("Unimplemented File.delete()");
+    // TODO System.println("Unimplemented File.delete()");
     return false;
   }
   
@@ -54,7 +54,7 @@ public class File {
       }
     }
     return (String[])(v.toArray(new String[0]));*/
-    System.println("Unimplemented File.list()");
+    // TODO System.println("Unimplemented File.list()");
     return null;
   }
 }
index 12515b7f43a0691c6fed74c2eb1346990c1b1790..360145afe0bf011318657b3f5ce2a37853d1267f 100644 (file)
@@ -355,7 +355,7 @@ public final class Float
   public static float parseFloat(String str)
   {
     //return VMFloat.parseFloat(str);
-    return (float)Double.parseDouble(str);
+    return (float)(Long.parseLong(str));
   }
 
   /**
index d173b7d50d5bed2a61a20c0a680919224ce0be88..d3f4b9b4b93909dd3fc5a96af460bf6a53af8f33 100644 (file)
@@ -533,7 +533,7 @@ public class Logger
    */
   public void log(LogRecord record)
   {
-    System.println("Unimplemented Logger.log(LogRecord)");
+    // TODO System.println("Unimplemented Logger.log(LogRecord)");
     /*synchronized (lock)
       {
         if (!isLoggable(record.getLevel()))
@@ -980,7 +980,7 @@ public class Logger
    */
   public void addHandler(StreamHandler handler) //throws SecurityException
   {
-    System.println("Unimplemented Logger.addHandler(StreamHandler)");
+    // TODO System.println("Unimplemented Logger.addHandler(StreamHandler)");
     /*synchronized (lock)
       {
         if (handler == null)
@@ -1051,7 +1051,7 @@ public class Logger
          */
         /*return (Handler[]) handlerList.toArray(new Handler[handlerList.size()]);
       }*/
-    System.println("Unimplemented Logger.getHandlers()");
+    // TODO System.println("Unimplemented Logger.getHandlers()");
     return new Handler[0];
   }
 
@@ -1180,7 +1180,7 @@ public class Logger
       index++;
 
     return index < stackTrace.length ? stackTrace[index] : null;*/
-    System.println("Logger.getCallerStackFrame() invoked");
+    // TODO System.println("Logger.getCallerStackFrame() invoked");
     return null;
   }
 
index e71684aa25ef14bb3c0fa064ab470cd3ca4e0feb..7dc2d4b0df68fc1a9e57a3e61bb6fa2a98aab1b1 100644 (file)
@@ -359,7 +359,7 @@ label   = Name:\\u0020</pre>
   public void load(InputStream inStream) throws IOException
   {
     //load(new InputStreamReader(inStream, "ISO-8859-1"));
-    System.println("Properties.load(InputStream) invoked");
+    //TODO System.println("Properties.load(InputStream) invoked");
   }
 
   /**
index 9f683f77ffdb81da7982e5670ee846535fa3e28d..beb4593a2137609d0782d477a46658ee846b54b8 100644 (file)
@@ -318,7 +318,7 @@ public class BuildCode {
    * initialization.*/
   protected void outputStaticBlocks(PrintWriter outmethod) {
     //  execute all the static blocks and all the static field initializations
-        // execute all the static blocks and all the static field initializations
+    // execute all the static blocks and all the static field initializations
     SymbolTable sctbl = this.state.getSClassSymbolTable();
     Iterator it_sclasses = sctbl.getDescriptorsIterator();
     if(it_sclasses.hasNext()) {
@@ -650,7 +650,7 @@ public class BuildCode {
     if(state.MGC) {
       outclassdefs.println("  int mutex;");
       outclassdefs.println("  volatile int notifycount;");
-      outclassdefs.println("  int objlock;");
+      outclassdefs.println("  volatile int objlock;");
       if(state.MULTICOREGC) {
        outclassdefs.println("  int marked;");
       }
@@ -706,7 +706,7 @@ public class BuildCode {
       if(state.MGC) {
        outclassdefs.println("  int mutex;");
        outclassdefs.println("  volatile int notifycount;");
-       outclassdefs.println("  int objlock;");
+       outclassdefs.println("  volatile int objlock;");
        if(state.MULTICOREGC) {
          outclassdefs.println("  int marked;");
        }
@@ -1641,7 +1641,7 @@ public class BuildCode {
     if (state.MGC) {
       classdefout.println("  int mutex;");
       classdefout.println("  volatile int notifycount;");
-      classdefout.println("  int objlock;");
+      classdefout.println("  volatile int objlock;");
       if(state.MULTICOREGC) {
        classdefout.println("  int marked;");
       }
index f0747f8b48d8c73f804044dc1dbdb6e2413ad318..61d79cf9735e983870a12cc9980928760414a137 100644 (file)
@@ -682,7 +682,6 @@ void * smemalloc_I(int coren,
        }
        return NULL;
 #else
-    BAMBOO_DEBUGPRINT(0xe003);
     BAMBOO_EXIT(0xe003);
 #endif
   }
index 359cad9173ee67284dfc9a4ebd77a70146e7ee98..7b2034f77f8965cdd555b23e3f9a8a95d95d4f20 100644 (file)
@@ -9,6 +9,7 @@
 #include "mem.h"
 #ifndef RAW
 #include <stdio.h>
+#include <stdlib.h>
 #endif
 
 #ifndef INLINE
@@ -82,7 +83,7 @@ void injectinstructionfailure() {
 
 #ifdef D___Double______nativeparsedouble____L___String___
 double CALL01(___Double______nativeparsedouble____L___String___,struct ___String___ * ___str___) {
-  /*int length=VAR(___str___)->___count___;
+  int length=VAR(___str___)->___count___;
   int maxlength=(length>60) ? 60 : length;
   char str[maxlength+1];
   struct ArrayObject * chararray=VAR(___str___)->___value___;
@@ -92,16 +93,14 @@ double CALL01(___Double______nativeparsedouble____L___String___,struct ___String
     str[i]=((short *)(((char *)&chararray->___length___)+sizeof(int)))[i+offset];
   }
   str[i]=0;
-  double d=atof(str);*/
-  printf("Unimplemented Double.nativeparsedouble(S) \n");
-  double d = 0.0;
+  double d=0.0; //atof(str); TODO Unimplemented nativeparsedoulbe
   return d;
 }
 #endif
 
 #ifdef D___Double______nativeparsedouble_____AR_B_I_I 
 double CALL23(___Double______nativeparsedouble_____AR_B_I_I, int start, int length,int start,int length,struct ArrayObject * ___str___) {
-  /*int maxlength=(length>60)?60:length;
+  int maxlength=(length>60)?60:length;
   char str[maxlength+1];
   struct ArrayObject * bytearray=VAR(___str___);
   int i;
@@ -109,9 +108,7 @@ double CALL23(___Double______nativeparsedouble_____AR_B_I_I, int start, int leng
     str[i]=(((char *)&bytearray->___length___)+sizeof(int))[i+start];
   }
   str[i]=0;
-  double d=atof(str);*/
-  printf("Unimplemented Double.nativeparsedouble() \n");
-  double d = 0.0;
+  double d=0.0; //atof(str); TODO Unimplemented nativeparsedouble
   return d;
 }
 #endif
@@ -302,6 +299,27 @@ void CALL01(___System______printString____L___String___,struct ___String___ * __
 #endif // MGC
 }
 
+#ifdef D___System______initProperties____
+struct ___Properties___ * CALL00(___System______initProperties____) {
+#ifdef MGC
+   struct ___Properties___ * ___srctmp31736___;
+  struct ___String___ * ___arg42781___;
+  struct ___String___ * ___arg42782___;
+  struct ___String___ * ___s42780___;
+  ___srctmp31736___=allocate_new(76);
+   {
+       ___Properties______Properties____((struct ___Properties___ *) ___srctmp31736___);
+   }
+   global_defs_p->___System______props___ = ___srctmp31736___;
+   ___arg42781___=NewString("line.separator",14);
+   ___arg42782___=NewString("\n",1);
+   {
+       ___s42780___=___System______setProperty____L___String____L___String___((struct ___String___ *) ___arg42781___, (struct ___String___ *) ___arg42782___);
+   }
+#endif // MGC
+}
+#endif
+
 /* Object allocation function */
 
 #ifdef MULTICORE_GC