From 39d2c686c658c24b48b5201ba36f5f9de5820429 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 20 Oct 2009 23:42:29 +0000 Subject: [PATCH] changes --- Robust/src/ClassLibrary/String.java | 2 +- Robust/src/ClassLibrary/System.java | 3 ++- Robust/src/Runtime/STM/sandbox.c | 32 +++++++++++++++++++++++++++++ Robust/src/Runtime/runtime.c | 11 ++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Robust/src/ClassLibrary/String.java b/Robust/src/ClassLibrary/String.java index 163dce00..5acb4954 100644 --- a/Robust/src/ClassLibrary/String.java +++ b/Robust/src/ClassLibrary/String.java @@ -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); diff --git a/Robust/src/ClassLibrary/System.java b/Robust/src/ClassLibrary/System.java index b1dd8f7f..a0b847a8 100644 --- a/Robust/src/ClassLibrary/System.java +++ b/Robust/src/ClassLibrary/System.java @@ -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 */ - } diff --git a/Robust/src/Runtime/STM/sandbox.c b/Robust/src/Runtime/STM/sandbox.c index 25194ed3..084332fa 100644 --- a/Robust/src/Runtime/STM/sandbox.c +++ b/Robust/src/Runtime/STM/sandbox.c @@ -1,6 +1,8 @@ #include "sandbox.h" #include "tm.h" #include +#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"); diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index 142e1204..245fe9f3 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -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 -- 2.34.1