4 extern jmp_buf error_handler;
5 extern int instructioncount;
6 extern int failurecount;
19 extern void * curr_heapbase;
20 extern void * curr_heaptop;
22 #define TAGARRAYINTERVAL 10
23 #define OBJECTARRAYINTERVAL 10
25 #define ARRAYSET(array, type, index, value) \
26 ((type *)(& (& array->___length___)[1]))[index]=value
28 #define ARRAYGET(array, type, index) \
29 ((type *)(& (& array->___length___)[1]))[index]
38 __attribute__((malloc)) void * allocate_newglobal(int type);
39 __attribute__((malloc)) struct ArrayObject * allocate_newarrayglobal(int type, int length);
43 __attribute__((malloc)) void * allocate_newtrans(void * ptr, int type);
44 __attribute__((malloc)) struct ArrayObject * allocate_newarraytrans(void * ptr, int type, int length);
49 __attribute__((malloc)) void * allocate_new(void *, int type);
50 __attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
51 __attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
52 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
54 __attribute__((malloc)) void * allocate_new(int type);
55 __attribute__((malloc)) struct ArrayObject * allocate_newarray(int type, int length);
56 __attribute__((malloc)) struct ___String___ * NewString(const char *str,int length);
57 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(int index);
62 void initializeexithandler();
63 void failedboundschk();
66 void injectinstructionfailure();
67 void createstartupobject();
70 #define VAR(name) ___params___->name
71 #define CALL00(name) name(struct name ## _params * ___params___)
72 #define CALL01(name, alt) name(struct name ## _params * ___params___)
73 #define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___)
74 #define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest)
75 #define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest)
76 #define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2)
77 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2)
78 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2)
79 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3)
81 #define VAR(name) name
82 #define CALL00(name) name()
83 #define CALL01(name, alt) name(alt)
84 #define CALL02(name, alt1, alt2) name(alt1, alt2)
85 #define CALL11(name,rest, alt) name(alt)
86 #define CALL12(name,rest, alt1, alt2) name(alt1, alt2)
87 #define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2)
88 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3)
89 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
90 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
94 #include "SimpleHash.h"
97 #include "ObjectHash.h"
98 #include "structdefs.h"
102 #include "optionalstruct.h"
106 struct failedtasklist {
107 struct taskdescriptor *task;
111 struct failedtasklist *next;
116 struct transObjInfo {
123 struct RuntimeHash * lockRedirectTbl;
128 extern struct ___Object___ * ___fcrevert___;
132 void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length);
133 void flagorandinit(void * ptr, int ormask, int andmask);
134 void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length);
136 void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length);
138 inline void setTaskExitIndex(int index);
139 inline void addNewObjInfo(void * nobj);
142 int * getAliasLock(void ** ptrs, int length, struct RuntimeHash * tbl);
143 void addAliasLock(void * ptr, int lock);
145 void flagorand(void * ptr, int ormask, int andmask);
146 void flagorandinit(void * ptr, int ormask, int andmask);
147 void enqueueObject(void * ptr);
153 void transferObject(struct transObjInfo * transObj);
157 struct tagobjectiterator {
158 int istag; /* 0 if object iterator, 1 if tag iterator */
159 struct ObjectIterator it; /* Object iterator */
160 struct ObjectHash * objectset;
165 int tagobjindex; /* Index for tag or object depending on use */
166 /*if tag we have an object binding */
169 /*if object, we may have one or more tag bindings */
171 int tagbindings[MAXTASKPARAMS-1]; /* list slots */
174 struct parameterwrapper {
175 struct parameterwrapper *next;
176 struct ObjectHash * objectset;
181 struct taskdescriptor * task;
183 struct tagobjectiterator iterators[MAXTASKPARAMS-1];
187 struct taskparamdescriptor {
188 struct taskdescriptor * task;
190 void ** parameterArray;
196 int hashCodetpd(struct taskparamdescriptor *);
197 int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *);
199 void toiReset(struct tagobjectiterator * it);
200 int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
201 void toiNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
202 void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams);
203 void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams);
204 void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter);
205 int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags);
207 int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags);