public void generateInsideTransCode(FlatMethod fm, LocalityBinding lb,PrintWriter output,PrefetchPair pp,Vector oids, Vector fieldoffset,Vector endoffset, int tuplecount){
int i,j;
short offsetcount = 0;
+ String test = new String();
Object newdesc = pp.desc.get(0);
if(newdesc instanceof FieldDescriptor) {
tstlbl += generateTemp(fm, id.getTempDescAt(i), lb) + "+";
}
tstlbl += id.offset.toString();
- output.println(" int flag_" + flagcount + "= 0;");
output.println("if ("+tstlbl+"< 0 || "+tstlbl+" >= "+
generateTemp(fm, pp.base, lb) + "->___length___) {");
- output.println(" flag_" + flagcount+" = 1;");
- output.println("}");
-
- output.println("if (flag_"+flagcount+") {");
+ output.println(" failedboundschk();");
output.println("}");
TypeDescriptor elementtype = pp.base.getType().dereference();
type=elementtype.getSafeSymbol()+" ";
String oid = new String("(unsigned int) (" + generateTemp(fm, pp.base, lb) + " != NULL ? " + "((" + type + "*)(((char *) &("+ generateTemp(fm, pp.base, lb)+ "->___length___))+sizeof(int)))["+tstlbl+"] : 0)");
+
+ /*
+ test = "(("+tstlbl+"< 0) || ("+tstlbl+" >= "+ generateTemp(fm, pp.base, lb) + "->___length___))";
+ String oid = new String("(unsigned int) (" +genarateTemp(fm, pp.base, lb) + " != NULL ? (" +test+ " ? 0 : ((" + type + "*)(((char *) &("+ generateTemp(fm, pp.base, lb)+ "->___length___))+sizeof(int)))["+tstlbl+"]) : 0);");
+ */
+
oids.add(oid);
}
/* This function finds the location of the objects involved in a transaction
* and returns the pointer to the object if found in a remote location */
-objheader_t *transRead(transrecord_t *record, unsigned int oid) {
+objheader_t *transRead(transrecord_t *record, unsigned int oid) {
unsigned int machinenumber;
objheader_t *tmp, *objheader;
objheader_t *objcopy;
}
/* Get the object from the remote location */
- machinenumber = lhashSearch(oid);
+ if((machinenumber = lhashSearch(oid)) == 0) {
+ printf("Error: %s() No machine found for oid =% %s,%dx\n",__func__, machinenumber, __FILE__, __LINE__);
+ return NULL;
+ }
+
objcopy = getRemoteObj(record, machinenumber, oid);
if(objcopy == NULL) {
printf("Error: Object not found in Remote location %s, %d\n", __FILE__, __LINE__);
char buffer[RECEIVE_BUFFER_SIZE], control, recvcontrol;
char machineip[16], retval;
-
tdata = (thread_data_array_t *) threadarg;
/* Send Trans Request */
close(sd);
pthread_exit(NULL);
}
+
/* Send list of machines involved in the transaction */
{
int size=sizeof(unsigned int)*tdata->buffer->f.mcount;
pthread_exit(NULL);
}
}
+
/* Send oids and version number tuples for objects that are read */
{
int size=(sizeof(unsigned int)+sizeof(short))*tdata->buffer->f.numread;
+
if (send(sd, tdata->buffer->objread, size, MSG_NOSIGNAL) < size) {
perror("Error sending tuples for thread\n");
close(sd);
pthread_exit(NULL);
}
}
+
/* Send objects that are modified */
for(i = 0; i < tdata->buffer->f.nummod ; i++) {
int size;
if((qnode = pre_dequeue()) == NULL) {
printf("Error: No node returned %s, %d\n", __FILE__, __LINE__);
pthread_mutex_unlock(&pqueue.qlock);
- pthread_exit(NULL);
+ continue;
}
pthread_mutex_unlock(&pqueue.qlock);
/* and group requests by remote machine ids by calling the makePreGroups() */
if((pilehead = foundLocal(qnode)) == NULL) {
printf("Error: No node created for serving prefetch request %s %d\n", __FILE__, __LINE__);
- pthread_exit(NULL);
+ pre_enqueue(qnode);
+ continue;
}
ptr = pilehead;
if((mcpilenode = mcpiledequeue()) == NULL) {
printf("Dequeue Error: No node returned %s %d\n", __FILE__, __LINE__);
pthread_mutex_unlock(&mcqueue.qlock);
- pthread_exit(NULL);
+ continue;
}
/* Unlock mutex */
pthread_mutex_unlock(&mcqueue.qlock);
/*Initiate connection to remote host and send request */
/* Process Request */
- if(mcpilenode->mid != myIpAddr)
+ if(mcpilenode->mid != myIpAddr) {
sendPrefetchReq(mcpilenode);
+ }
/* Deallocate the machine queue pile node */
mcdealloc(mcpilenode);
index += sizeof(unsigned int);
/* For each object found add to Prefetch Cache */
objsize = *((int *)(buffer+index));
- index+=sizeof(int);
+ index += sizeof(int);
pthread_mutex_lock(&prefetchcache_mutex);
if ((modptr = objstrAlloc(prefetchcache, objsize)) == NULL) {
printf("Error: objstrAlloc error for copying into prefetch cache %s, %d\n", __FILE__, __LINE__);
//FIXME currently all oids belong to one machine
oid = oidarry[0];
- mid = lhashSearch(oid);
+ if((mid = lhashSearch(oid)) == 0) {
+ printf("Error: %s() No such machine found for oid =%x\n",__func__, oid);
+ return;
+ }
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){
perror("reqNotify():socket()");