changes
authorbdemsky <bdemsky>
Tue, 20 Oct 2009 23:42:29 +0000 (23:42 +0000)
committerbdemsky <bdemsky>
Tue, 20 Oct 2009 23:42:29 +0000 (23:42 +0000)
Robust/src/ClassLibrary/String.java
Robust/src/ClassLibrary/System.java
Robust/src/Runtime/STM/sandbox.c
Robust/src/Runtime/runtime.c

index 163dce00003dc23e844ccef53d486fc0c9f95d63..5acb4954ba3bb04446c0e0712c6e89b7dcc4cd91 100644 (file)
@@ -289,7 +289,7 @@ public class String {
   }
 
   public static String valueOf(double val) {
-    char[] chararray=new char[10];
+    char[] chararray=new char[20];
     String s=new String();
     s.offset=0;
     s.count=convertdoubletochar(val, chararray);
index b1dd8f7f0a0aceadb4266bd596b3f62e4f438e06..a0b847a87b4025812b442b48d69375affa1be665 100644 (file)
@@ -66,6 +66,8 @@ public class System {
 
   public static native void deepArrayCopy(Object dst, Object src);
 
+  public static native void Assert(boolean status);
+
   /* Only used for microbenchmark testing of SingleTM version */
   public static native void logevent(int event);
   public static native void logevent();
@@ -75,5 +77,4 @@ public class System {
 
   public static native void flushToFile(int threadid);
   /* Only used for microbenchmark testing of SingleTM version */
-
 }
index 25194ed3431d87c9582700d426cda3a44d8468fb..084332fae00f568a2a7e3b60fc93519a20d3781a 100644 (file)
@@ -1,6 +1,8 @@
 #include "sandbox.h"
 #include "tm.h"
 #include <stdio.h>
+#include "methodheaders.h"
+#include "runtime.h"
 __thread int transaction_check_counter;
 __thread jmp_buf aborttrans;
 __thread int abortenabled;
@@ -36,6 +38,36 @@ void checkObjects() {
   transaction_check_counter=*counter_reset_pointer;
 }
 
+#ifdef D___System______Assert____Z
+CALL11(___System______Assert____Z, int ___status___, int ___status___) {
+  if (!___status___) {
+    if (abortenabled&&checktrans()) {
+#ifdef TRANSSTATS
+      numTransAbort++;
+#endif
+      freenewobjs();
+      objstrReset();
+      t_chashreset();
+#ifdef READSET
+      rd_t_chashreset();
+#endif
+#ifdef DELAYCOMP
+      dc_t_chashreset();
+      ptrstack.count=0;
+      primstack.count=0;
+      branchstack.count=0;
+#ifdef STMARRAY
+      arraystack.count=0;
+#endif
+#endif
+      _longjmp(aborttrans, 1);
+    }
+    printf("Assertion violation\n");
+    *((int *)(NULL)); //force stack trace error                         
+  }
+}
+#endif
+
 /* Do sandboxing */
 void errorhandler(int sig, struct sigcontext ctx) {
   //  printf("Error\n");
index 142e1204299a04799632a0c1cc3b33acc04356df..245fe9f357261b18af2bbe1f60b3cb21a7aac34f 100644 (file)
@@ -688,3 +688,14 @@ void abort_task() {
   exit(-1);
 #endif
 }
+
+#ifndef SANDBOX
+#ifdef D___System______Assert____Z
+ void CALL11(___System______Assert____Z, int ___status___, int ___status___) {
+   if (!___status___) {
+     printf("Assertion violation\n");
+     *((int *)(NULL)); //force stack trace error
+   }
+ }
+#endif
+#endif