if (state.SINGLETM) {
//Single machine transaction case
String dst=generateTemp(fm, fen.getDst(),lb);
- if (!state.STMARRAY||wb.needBarrier(fen)||locality.getNodePreTempInfo(lb, fen).get(fen.getSrc())==LocalityAnalysis.SCRATCH) {
+ if ((!state.STMARRAY)||(!wb.needBarrier(fen))||locality.getNodePreTempInfo(lb, fen).get(fen.getSrc())==LocalityAnalysis.SCRATCH||locality.getAtomic(lb).get(fen).intValue()==0) {
output.println(dst +"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];");
} else {
output.println("STMGETARRAY("+dst+", "+ generateTemp(fm,fen.getSrc(),lb)+", "+generateTemp(fm, fen.getIndex(),lb)+", "+type+");");
} else {
output.println("INTPTR srcoid=(INTPTR)"+src+";");
}
- if (state.STMARRAY&&locality.getNodePreTempInfo(lb, fsen).get(fsen.getDst())!=LocalityAnalysis.SCRATCH&&wb.needBarrier(fsen)) {
+ if (state.STMARRAY&&locality.getNodePreTempInfo(lb, fsen).get(fsen.getDst())!=LocalityAnalysis.SCRATCH&&wb.needBarrier(fsen)&&locality.getAtomic(lb).get(fsen).intValue()>0) {
output.println("STMSETARRAY("+generateTemp(fm, fsen.getDst(),lb)+", "+generateTemp(fm, fsen.getIndex(),lb)+", srcoid, INTPTR);");
} else {
output.println("((INTPTR*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;");
}
output.println("}");
} else {
- if (state.STMARRAY&&locality.getNodePreTempInfo(lb, fsen).get(fsen.getDst())!=LocalityAnalysis.SCRATCH&&wb.needBarrier(fsen)) {
+ if (state.STMARRAY&&locality.getNodePreTempInfo(lb, fsen).get(fsen.getDst())!=LocalityAnalysis.SCRATCH&&wb.needBarrier(fsen)&&locality.getAtomic(lb).get(fsen).intValue()>0) {
output.println("STMSETARRAY("+generateTemp(fm, fsen.getDst(),lb)+", "+generateTemp(fm, fsen.getIndex(),lb)+", "+ generateTemp(fm, fsen.getSrc(), lb) +", "+type+");");
} else {
output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";");
dirwrlocked[numoidwrlocked++] = objptr; \
} \
if (addrdobject) { \
- rdlockedarray[numoidrdlockedarray++]=objptr; \
+ oidrdlockedarray[numoidrdlockedarray++]=objptr; \
} \
} else
#define READARRAYS \
for(i=0; i<numoidrdlockedarray; i++) { \
- objheader_t * transheader=oidrdlockedarray[i]; \
- struct ArrayObject * transao=(struct ArrayObject *)&transheader[1]; \
- objheader_t * mainheader=OID(transheader); \
- struct ArrayObject * mainao=(struct ArrayObject *)&transheader[1]; \
+ struct ArrayObject * transao=(struct ArrayObject *) oidrdlockedarray[i]; \
+ struct ArrayObject * mainao=(struct ArrayObject *) transao->___objlocation___; \
int lowoffset=(transao->lowindex)>>INDEXSHIFT; \
int highoffset=(transao->highindex)>>INDEXSHIFT; \
int j; \
freearrays; \
return TRANS_ABORT; \
} \
+ } else { \
+ unsigned int localversion; \
+ unsigned int remoteversion; \
+ GETVERSIONVAL(localversion, transao, j); \
+ GETVERSIONVAL(remoteversion, mainao, j); \
+ if (localversion==remoteversion) \
+ softabort=1; \
+ transAbortProcess(oidwrlocked, NUMWRTOTAL); \
+ freearrays; \
+ if (softabort) \
+ return TRANS_SOFT_ABORT; \
+ else \
+ return TRANS_ABORT; \
} \
} \
} \
#endif
//THIS IS THE SERIALIZATION END POINT (START POINT IS END OF EXECUTION)*****
-
READARRAYS;
for(i=0; i<numoidrdlocked; i++) {