more changes...
authorbdemsky <bdemsky>
Thu, 16 Aug 2007 08:45:59 +0000 (08:45 +0000)
committerbdemsky <bdemsky>
Thu, 16 Aug 2007 08:45:59 +0000 (08:45 +0000)
actually can compile programs in dstm mode if they don't use the dsm

Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/DSTM/interface/dstm.h
Robust/src/Runtime/DSTM/interface/trans.c

index ee496ad9f7d3da1dfc44d9634f472ec27dc30b64..e645038d53dd7fa43898822f56b533472f3e5d82 100644 (file)
@@ -179,7 +179,7 @@ public class BuildCode {
        outmethod.println("int main(int argc, const char *argv[]) {");
        outmethod.println("  int i;");
        if (state.DSM) {
-           outmethod.println("if (dstmStart(argv[0])) {");
+           outmethod.println("if (dstmStartup(argv[1])) {");
            if (GENERATEPRECISEGC) {
                outmethod.println("  struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-2);");
            } else {
index c96f14647ab80a26ad2530deb3a44e546870a097..87899bb80f4573fcb8e31a40a86f1b98b37dc35a 100644 (file)
@@ -189,11 +189,6 @@ transrecord_t *record;
 /* Initialize main object store and lookup tables, start server thread. */
 int dstmInit(void);
 
-/* Function called at beginning. Passes in the first parameter. */
-/* Returns 1 if this thread should run the main process */
-
-int dstmStart(char *);
-
 /* Prototypes for object header */
 unsigned int getNewOID(void);
 unsigned int objSize(objheader_t *object);
@@ -216,6 +211,12 @@ int transCommitProcess(trans_commit_data_t *, int);
 /* end server portion */
 
 /* Prototypes for transactions */
+/* Function called at beginning. Passes in the first parameter. */
+/* Returns 1 if this thread should run the main process */
+
+int dstmStartup(char *);
+void transInit();
+
 void randomdelay(void);
 transrecord_t *transStart();
 objheader_t *transRead(transrecord_t *, unsigned int);
index e5c9a06beaf11e66a2e83a0cefc7f069b1235e23..67c56629769a7b96090efb9d68cc983c1e247522 100644 (file)
@@ -80,6 +80,29 @@ void prefetch(int ntuples, unsigned int *oids, short *endoffsets, short *arrayfi
        pthread_mutex_unlock(&pqueue.qlock);
 }
 
+
+/* This function starts up the transaction runtime. */
+int dstmStartup(char * option) {
+  pthread_t thread_Listen;
+  pthread_attr_t attr;
+  int master=strcmp(option, "master")==0;
+
+  dstmInit();
+  transInit();
+
+  if (master) {
+    pthread_attr_init(&attr);
+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+    pthread_create(&thread_Listen, &attr, dstmListen, NULL);
+    return 1;
+  } else {
+    dstmListen();
+    return 0;
+  }
+
+}
+
+
 /* This function initiates the prefetch thread
  * A queue is shared between the main thread of execution
  * and the prefetch thread to process the prefetch call