From bdd3011f61049a3e2ba13e2e63fd198386c05e85 Mon Sep 17 00:00:00 2001 From: adash Date: Thu, 31 Jul 2008 07:33:12 +0000 Subject: [PATCH] small changes for improving prefetch --- Robust/src/IR/Flat/BuildCode.java | 17 +++++++++-------- Robust/src/Runtime/DSTM/interface/trans.c | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index c59d216e..e2292f00 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1495,6 +1495,8 @@ public class BuildCode { output.println("/* prefetchid_" + fpn.siteid + " */"); output.println("void * prefptr;"); output.println("int tmpindex;"); + + output.println("if((evalPrefetch["+fpn.siteid+"].operMode) || (evalPrefetch["+fpn.siteid+"].retrycount <= 0)) {"); /*Create C code for oid array */ output.print(" unsigned int oidarray_[] = {"); boolean needcomma=false; @@ -1528,14 +1530,13 @@ public class BuildCode { } output.println("};"); /* make the prefetch call to Runtime */ - output.println(" if(evalPrefetch["+fpn.siteid+"].operMode) {"); - output.println(" prefetch("+fpn.siteid+" ,"+tuplecount+", oidarray_, endoffsetarry_, fieldarry_);"); - output.println(" } else if(evalPrefetch["+fpn.siteid+"].retrycount <= 0) {"); - output.println(" prefetch("+fpn.siteid+" ,"+tuplecount+", oidarray_, endoffsetarry_, fieldarry_);"); - output.println(" evalPrefetch["+fpn.siteid+"].retrycount = RETRYINTERVAL;"); - output.println(" } else {"); - output.println(" evalPrefetch["+fpn.siteid+"].retrycount--;"); - output.println(" }"); + output.println(" if(!evalPrefetch["+fpn.siteid+"].operMode) {"); + output.println(" evalPrefetch["+fpn.siteid+"].retrycount = RETRYINTERVAL;"); + output.println(" }"); + output.println(" prefetch("+fpn.siteid+" ,"+tuplecount+", oidarray_, endoffsetarry_, fieldarry_);"); + output.println(" } else {"); + output.println(" evalPrefetch["+fpn.siteid+"].retrycount--;"); + output.println(" }"); output.println("}"); } } diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 2316f7df..d706678b 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -853,6 +853,7 @@ int updatePrefetchCache(thread_data_array_t* tdata, int numoid, char oidType) { } pthread_mutex_lock(&prefetchcache_mutex); header = (objheader_t *) chashSearch(tdata->rec->lookupTable, oid); + header->version += 1; //copy object into prefetch cache GETSIZE(size, header); if ((newAddr = prefetchobjstrAlloc(size + sizeof(objheader_t))) == NULL) { @@ -1085,7 +1086,7 @@ int transAbortProcess(local_thread_data_array_t *localtdata) { return 0; } -/*This function completes the COMMIT process is the transaction is commiting*/ +/*This function completes the COMMIT process if the transaction is commiting*/ int transComProcess(local_thread_data_array_t *localtdata) { objheader_t *header, *tcptr; int i, nummod, tmpsize, numcreated, numlocked; -- 2.34.1