-See the wiki page at http://demsky.eecs.uci.edu/compiler/
\ No newline at end of file
+See the wiki page at http://demsky.eecs.uci.edu/compiler/
+
void randomdelay(void);
transrecord_t *transStart();
objheader_t *transRead(transrecord_t *, unsigned int);
-objheader_t *transCreateObj(transrecord_t *, unsigned short); //returns oid
+objheader_t *transCreateObj(transrecord_t *, unsigned int); //returns oid
int transCommit(transrecord_t *record); //return 0 if successful
void *transRequest(void *); //the C routine that the thread will execute when TRANS_REQUEST begins
void *handleLocalReq(void *); //the C routine that the local m/c thread will execute
}
/* This function creates objects in the transaction record */
-objheader_t *transCreateObj(transrecord_t *record, unsigned short type)
+objheader_t *transCreateObj(transrecord_t *record, unsigned int size)
{
- objheader_t *tmp = (objheader_t *) objstrAlloc(record->cache, (sizeof(objheader_t) + classsize[type]));
- OID(tmp) = getNewOID();
- TYPE(tmp) = type;
- tmp->version = 1;
- tmp->rcount = 1;
- STATUS(tmp) = NEW;
- chashInsert(record->lookupTable, OID(tmp), tmp);
- return tmp;
+ objheader_t *tmp = (objheader_t *) objstrAlloc(record->cache, (sizeof(objheader_t) + size));
+ OID(tmp) = getNewOID();
+ tmp->version = 1;
+ tmp->rcount = 1;
+ STATUS(tmp) = NEW;
+ chashInsert(record->lookupTable, OID(tmp), tmp);
+ return tmp;
}
/* This function creates machine piles based on all machines involved in a
#ifdef DSTM
void * allocate_newglobal(transrecord_t *trans, int type) {
- struct ___Object___ * v=(struct ___Object___ *) dstmalloc(trans, classsize[type]);
+ struct ___Object___ * v=(struct ___Object___ *) transCreateObj(trans, classsize[type]);
v->type=type;
#ifdef THREADS
v->tid=0;
/* Array allocation function */
struct ArrayObject * allocate_newarrayglobal(transrecord_t *trans, int type, int length) {
- struct ArrayObject * v=(struct ArrayObject *)dstmalloc(trans, classsize[type]);
- v->type=type;
+ struct ArrayObject * v=(struct ArrayObject *)transCreateObj(trans, sizeof(struct ArrayObject)+length*classsize[type]);
if (length<0) {
printf("ERROR: negative array\n");
return NULL;
}
+ v->type=type;
v->___length___=length;
#ifdef THREADS
v->tid=0;