From 925b581c273ef0ce3e1fd895ff63a3b4c84d7596 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 6 Apr 2009 20:35:53 +0000 Subject: [PATCH] get rid of compile errors --- Robust/src/ClassLibrary/JavaSTM/Object.java | 3 +- Robust/src/IR/Flat/BuildCode.java | 6 +- Robust/src/Runtime/STM/stm.c | 1 - Robust/src/Runtime/STM/tm.h | 78 +++++++++++---------- 4 files changed, 45 insertions(+), 43 deletions(-) diff --git a/Robust/src/ClassLibrary/JavaSTM/Object.java b/Robust/src/ClassLibrary/JavaSTM/Object.java index 4968cfa3..fecc4cd1 100644 --- a/Robust/src/ClassLibrary/JavaSTM/Object.java +++ b/Robust/src/ClassLibrary/JavaSTM/Object.java @@ -1,7 +1,8 @@ public class Object { public int cachedCode; //first field has to be a primitive public boolean cachedHash; - + public Object objlocation; + public int objstatus; public native int nativehashCode(); public int hashCode() { diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 141a899d..36218790 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -31,7 +31,7 @@ public class BuildCode { String localsprefix="___locals___"; String fcrevert="___fcrevert___"; String paramsprefix="___params___"; - String oidstr="___nextobject___"; + String oidstr=state.DSM?"___nextobject___":"___objlocation___"; String nextobjstr="___nextobject___"; String localcopystr="___localcopy___"; public static boolean GENERATEPRECISEGC=false; @@ -2152,7 +2152,7 @@ public class BuildCode { output.println("int srcoid=("+src+"!=NULL?((int)"+src+"->"+oidstr+"):0);"); } if (wb.needBarrier(fsfn)) - output.println("*((unsigned int *)&("+dst+"->___localcopy___))|=DIRTY;"); + output.println("*((unsigned int *)&("+dst+"->___objstatus___))|=DIRTY;"); if (srcptr) { output.println("*((unsigned int *)&("+dst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); output.println("}"); @@ -2296,7 +2296,7 @@ public class BuildCode { if (state.SINGLETM && locality.getAtomic(lb).get(fsen).intValue()>0) { //Transaction set element case if (wb.needBarrier(fsen)) - output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___localcopy___))|=DIRTY;"); + output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___objstatus___))|=DIRTY;"); if (fsen.getSrc().getType().isPtr()) { output.println("{"); String src=generateTemp(fm, fsen.getSrc(), lb); diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 75e84dfa..79f15a93 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -61,7 +61,6 @@ objheader_t *transCreateObj(unsigned int size) { objheader_t *tmp = (objheader_t *) objstrAlloc(&t_cache, (sizeof(objheader_t) + size)); OID(tmp) = getNewOID(); tmp->version = 1; - tmp->rcount = 1; STATUS(tmp) = NEW; t_chashInsert(OID(tmp), tmp); diff --git a/Robust/src/Runtime/STM/tm.h b/Robust/src/Runtime/STM/tm.h index 60d21cad..86f80d79 100644 --- a/Robust/src/Runtime/STM/tm.h +++ b/Robust/src/Runtime/STM/tm.h @@ -38,6 +38,46 @@ #define NEW 0x02 #define LOCK 0x04 +#ifdef COMPILER +#include "structdefs.h" +typedef struct objheader { + threadlist_t *notifylist; + unsigned int version; +} objheader_t; + +#define OID(x) \ + (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objlocation___)) + +#define COMPOID(x) \ + ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___objlocation___)) : 0)) + +#define STATUS(x) \ + *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objstatus___)) + +#define STATUSPTR(x) \ + ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___objstatus___)) + +#define TYPE(x) \ + ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type + +#define GETSIZE(size, x) { \ + int type=TYPE(x); \ + if (type___length___+sizeof(struct ArrayObject); \ + } \ +} + +#else +#define OID(x) x->oid +#define TYPE(x) x->type +#define STATUS(x) x->status +#define STATUSPTR(x) &x->status +#define GETSIZE(size, x) size=classsize[TYPE(x)] +#endif + + /* ================================ * Constants * ================================ @@ -73,44 +113,6 @@ typedef struct newObjCreated { unsigned int *oidcreated; } newObjCreated_t; -#ifdef COMPILER -typedef struct objheader { - threadlist_t *notifylist; - unsigned short version; - unsigned short rcount; -} objheader_t; - -#define OID(x) \ - (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___)) - -#define COMPOID(x) \ - ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___nextobject___)) : 0)) - -#define STATUS(x) \ - *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___)) - -#define STATUSPTR(x) \ - ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___)) - -#define TYPE(x) \ - ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type - -#define GETSIZE(size, x) { \ - int type=TYPE(x); \ - if (type___length___+sizeof(struct ArrayObject); \ - } \ -} - -#else -#define OID(x) x->oid -#define TYPE(x) x->type -#define STATUS(x) x->status -#define STATUSPTR(x) &x->status -#define GETSIZE(size, x) size=classsize[TYPE(x)] -#endif /* ================================ * Functions used -- 2.34.1