add likely/unlikely branch hints
[IRC.git] / Robust / src / Runtime / runtime.h
index 76c169264901344f136660ddb64abf9080856d51..d3dcc04a1fd3d1680d1e926d3516a3f4e4219574 100644 (file)
@@ -7,7 +7,11 @@ extern int instructioncount;
 extern int failurecount;
 #endif
 #ifdef DSTM
-#include "dstm.h"
+#ifdef RECOVERY
+#include "DSTM/interface_recovery/dstm.h"
+#else
+#include "DSTM/interface/dstm.h"
+#endif
 #endif
 
 #ifndef INTPTR
@@ -21,6 +25,10 @@ extern int failurecount;
 extern void * curr_heapbase;
 extern void * curr_heaptop;
 
+#define likely(x) __builtin_expect((x),1)
+#define unlikely(x) __builtin_expect((x),0)
+
+
 #define TAGARRAYINTERVAL 10
 #define OBJECTARRAYINTERVAL 10
 
@@ -52,6 +60,11 @@ __attribute__((malloc)) void * allocate_new(void *, int type);
 __attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
 __attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
+#elif defined MULTICORE_GC
+__attribute__((malloc)) void * allocate_new(void *, int type);
+__attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
+__attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
+__attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
 #else
 __attribute__((malloc)) void * allocate_new(int type);
 __attribute__((malloc)) struct ArrayObject * allocate_newarray(int type, int length);
@@ -121,7 +134,6 @@ struct transObjInfo {
   int * queues;
   int length;
 };
-struct RuntimeHash * lockRedirectTbl;
 #endif
 
 #ifdef FASTCHECK
@@ -130,16 +142,20 @@ extern struct ___Object___ * ___fcrevert___;
 
 #ifdef MULTICORE
 inline void run(void * arg);
+#ifdef MULTICORE_GC
+inline void setupsmemmode(void);
+#endif
 int receiveObject(void);
 void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length);
 void flagorandinit(void * ptr, int ormask, int andmask);
-void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length);
+void enqueueObject(void * ptr, struct parameterwrapper ** queues,int length);
 #ifdef PROFILE
 inline void setTaskExitIndex(int index);
 inline void addNewObjInfo(void * nobj);
 #endif
 int * getAliasLock(void ** ptrs, int length, struct RuntimeHash * tbl);
 void addAliasLock(void * ptr, int lock);
+void * smemalloc(int coren, int size, int * allocsize);
 #else
 void flagorand(void * ptr, int ormask, int andmask);
 void flagorandinit(void * ptr, int ormask, int andmask);