code changes
authorbdemsky <bdemsky>
Thu, 16 Aug 2007 23:02:13 +0000 (23:02 +0000)
committerbdemsky <bdemsky>
Thu, 16 Aug 2007 23:02:13 +0000 (23:02 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/DSTM/interface/dstm.h
Robust/src/Runtime/DSTM/interface/trans.c
Robust/src/Runtime/runtime.c
Robust/src/Runtime/runtime.h

index 387a327ef63661a8f3f0fffca393ec63d03cefb3..7a5ddc6f8414ed70d4f438f72439ef716a9cda02 100644 (file)
@@ -1785,21 +1785,22 @@ public class BuildCode {
     }
 
     private void generateFlatNew(FlatMethod fm, LocalityBinding lb, FlatNew fn, PrintWriter output) {
-       String isglobal="";
-       if (fn.isGlobal())
-           isglobal="global";
        if (fn.getType().isArray()) {
            int arrayid=state.getArrayNumber(fn.getType())+state.numClasses();
-           if (GENERATEPRECISEGC) {
-               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray"+isglobal+"(&"+localsprefix+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
+           if (fn.isGlobal()) {
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarrayglobal(trans, "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
+           } else if (GENERATEPRECISEGC) {
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray(&"+localsprefix+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
            } else {
-               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray"+isglobal+"("+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray("+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
            }
        } else {
-           if (GENERATEPRECISEGC) {
-               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new"+isglobal+"(&"+localsprefix+", "+fn.getType().getClassDesc().getId()+");");
+           if (fn.isGlobal()) {
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newglobal(trans, "+fn.getType().getClassDesc().getId()+");");
+           } else if (GENERATEPRECISEGC) {
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new(&"+localsprefix+", "+fn.getType().getClassDesc().getId()+");");
            } else {
-               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new"+isglobal+"("+fn.getType().getClassDesc().getId()+");");
+               output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new("+fn.getType().getClassDesc().getId()+");");
            }
        }
     }
index 8fbc6edd094337894f4a3c7789d604971a6df5b0..e3ccbc02f0fb24f49d20eecf5957fbf747869eb0 100644 (file)
@@ -216,7 +216,7 @@ int transCommitProcess(trans_commit_data_t *, int);
 
 int dstmStartup(const char *);
 void transInit();
-void * dstmalloc(int size);
+void * dstmalloc(transrecord_t *trans, int size);
 
 void randomdelay(void);
 transrecord_t *transStart();
index 338c718e6fcd4e76c84b07a117fc00b7d710fa1a..963f324f083172098214559785c6b6671446ae56 100644 (file)
@@ -80,15 +80,13 @@ void prefetch(int ntuples, unsigned int *oids, short *endoffsets, short *arrayfi
        pthread_mutex_unlock(&pqueue.qlock);
 }
 
-static int objid=1;
-/* This function allocates an object */
-void * dstmalloc(int size) {
-  objheader_t * newobj=(objheader_t *)objstrAlloc(mainobjstore, size+sizeof(objheader_t));
-  OID(newobj)=objid;
-  newobj->version=1;
-  newobj->rcount=0;
-  STATUS(newobj)=NEW;
-  objid+=2;
+/* This function allocates an object on the local machine */
+//FIXME
+
+void * dstmalloc(transrecord_t *trans, int size) {
+  objheader_t * newobj=(objheader_t *)objstrAlloc(trans->cache, size+sizeof(objheader_t));
+  //Need to assign OID
+
   return newobj;
 }
 
index 803f19db429a3933e305e6ec2ed1cc7683a8f826..f9f7e2a58b60889fb42b34b02da5f9607a452895 100644 (file)
@@ -90,8 +90,8 @@ void CALL01(___System______printString____L___String___,struct ___String___ * __
 /* Object allocation function */
 
 #ifdef DSTM
-void * allocate_newglobal(void * ptr, int type) {
-  struct ___Object___ * v=(struct ___Object___ *) dstmalloc(classsize[type]);
+void * allocate_newglobal(transrecord_t *trans, int type) {
+  struct ___Object___ * v=(struct ___Object___ *) dstmalloc(trans, classsize[type]);
   v->type=type;
 #ifdef THREADS
   v->tid=0;
@@ -103,8 +103,8 @@ void * allocate_newglobal(void * ptr, int type) {
 
 /* Array allocation function */
 
-struct ArrayObject * allocate_newarrayglobal(void * ptr, int type, int length) {
-  struct ArrayObject * v=(struct ArrayObject *)dstmalloc(classsize[type]);
+struct ArrayObject * allocate_newarrayglobal(transrecord_t *trans, int type, int length) {
+  struct ArrayObject * v=(struct ArrayObject *)dstmalloc(trans, classsize[type]);
   v->type=type;
   if (length<0) {
     printf("ERROR: negative array\n");
index aa92815416cae64137a8eb368f9b5ddd09a0a9ac..a90508fb07f91501e0f85dc00fcdbebaf8253c16 100644 (file)
@@ -4,6 +4,9 @@
 extern jmp_buf error_handler;
 extern int instructioncount;
 extern int failurecount;
+#ifdef DSTM
+#include "dstm.h"
+#endif
 
 #define TAGARRAYINTERVAL 10
 #define OBJECTARRAYINTERVAL 10
@@ -14,21 +17,18 @@ extern int failurecount;
 #define ARRAYGET(array, type, index) \
 ((type *)(&(& array->___length___)[1]))[index]
 
-#ifdef PRECISE_GC
-#include "garbage.h"
 #ifdef DSTM
-void * allocate_newglobal(void *, int type);
-struct ArrayObject * allocate_newarrayglobal(void *, int type, int length);
+void * allocate_newglobal(transrecord_t *, int type);
+struct ArrayObject * allocate_newarrayglobal(transrecord_t *, int type, int length);
 #endif
+
+#ifdef PRECISE_GC
+#include "garbage.h"
 void * allocate_new(void *, int type);
 struct ArrayObject * allocate_newarray(void *, int type, int length);
 struct ___String___ * NewString(void *, const char *str,int length);
 struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
 #else
-#ifdef DSTM
-void * allocate_newglobal(int type);
-struct ArrayObject * allocate_newarrayglobal(int type, int length);
-#endif
 void * allocate_new(int type);
 struct ArrayObject * allocate_newarray(int type, int length);
 struct ___String___ * NewString(const char *str,int length);