5 extern jmp_buf error_handler;
6 extern int instructioncount;
7 extern int failurecount;
11 #include "DSTM/interface_recovery/dstm.h"
13 #include "DSTM/interface/dstm.h"
25 extern void * curr_heapbase;
26 extern void * curr_heaptop;
28 #define TAGARRAYINTERVAL 10
29 #define OBJECTARRAYINTERVAL 10
31 #define ARRAYSET(array, type, index, value) \
32 ((type *)(& (& array->___length___)[1]))[index]=value
34 #define ARRAYGET(array, type, index) \
35 ((type *)(& (& array->___length___)[1]))[index]
44 __attribute__((malloc)) void * allocate_newglobal(int type);
45 __attribute__((malloc)) struct ArrayObject * allocate_newarrayglobal(int type, int length);
49 __attribute__((malloc)) void * allocate_newtrans(void * ptr, int type);
50 __attribute__((malloc)) struct ArrayObject * allocate_newarraytrans(void * ptr, int type, int length);
55 __attribute__((malloc)) void * allocate_new(void *, int type);
56 __attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
57 __attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
58 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
59 #elif defined MULTICORE_GC
60 __attribute__((malloc)) void * allocate_new(void *, int type);
61 __attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
62 __attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
63 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
65 __attribute__((malloc)) void * allocate_new(int type);
66 __attribute__((malloc)) struct ArrayObject * allocate_newarray(int type, int length);
67 __attribute__((malloc)) struct ___String___ * NewString(const char *str,int length);
68 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(int index);
73 void initializeexithandler();
74 void failedboundschk();
77 void injectinstructionfailure();
78 void createstartupobject();
81 #define VAR(name) ___params___->name
82 #define CALL00(name) name(struct name ## _params * ___params___)
83 #define CALL01(name, alt) name(struct name ## _params * ___params___)
84 #define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___)
85 #define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest)
86 #define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest)
87 #define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2)
88 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2)
89 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2)
90 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3)
92 #define VAR(name) name
93 #define CALL00(name) name()
94 #define CALL01(name, alt) name(alt)
95 #define CALL02(name, alt1, alt2) name(alt1, alt2)
96 #define CALL11(name,rest, alt) name(alt)
97 #define CALL12(name,rest, alt1, alt2) name(alt1, alt2)
98 #define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2)
99 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3)
100 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
101 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
105 #include "SimpleHash.h"
108 #include "ObjectHash.h"
109 #include "structdefs.h"
113 #include "optionalstruct.h"
117 struct failedtasklist {
118 struct taskdescriptor *task;
122 struct failedtasklist *next;
127 struct transObjInfo {
136 extern struct ___Object___ * ___fcrevert___;
140 inline void run(void * arg);
141 int receiveObject(void);
142 void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length);
143 void flagorandinit(void * ptr, int ormask, int andmask);
144 void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length);
146 inline void setTaskExitIndex(int index);
147 inline void addNewObjInfo(void * nobj);
149 int * getAliasLock(void ** ptrs, int length, struct RuntimeHash * tbl);
150 void addAliasLock(void * ptr, int lock);
151 void * smemalloc(int size, int * allocsize);
153 void flagorand(void * ptr, int ormask, int andmask);
154 void flagorandinit(void * ptr, int ormask, int andmask);
155 void enqueueObject(void * ptr);
161 struct tagobjectiterator {
162 int istag; /* 0 if object iterator, 1 if tag iterator */
163 struct ObjectIterator it; /* Object iterator */
164 struct ObjectHash * objectset;
169 int tagobjindex; /* Index for tag or object depending on use */
170 /*if tag we have an object binding */
173 /*if object, we may have one or more tag bindings */
175 int tagbindings[MAXTASKPARAMS-1]; /* list slots */
178 struct parameterwrapper {
179 struct parameterwrapper *next;
180 struct ObjectHash * objectset;
185 struct taskdescriptor * task;
187 struct tagobjectiterator iterators[MAXTASKPARAMS-1];
191 struct taskparamdescriptor {
192 struct taskdescriptor * task;
194 void ** parameterArray;
200 int hashCodetpd(struct taskparamdescriptor *);
201 int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *);
203 void toiReset(struct tagobjectiterator * it);
204 int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
205 void toiNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
206 void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams);
207 void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams);
208 void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter);
209 int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags);