4 extern jmp_buf error_handler;
5 extern int instructioncount;
6 extern int failurecount;
11 extern void * curr_heapbase;
12 extern void * curr_heaptop;
14 #define TAGARRAYINTERVAL 10
15 #define OBJECTARRAYINTERVAL 10
17 #define ARRAYSET(array, type, index, value) \
18 ((type *)(& (& array->___length___)[1]))[index]=value
20 #define ARRAYGET(array, type, index) \
21 ((type *)(& (& array->___length___)[1]))[index]
30 __attribute__((malloc)) void * allocate_newglobal(int type);
31 __attribute__((malloc)) struct ArrayObject * allocate_newarrayglobal(int type, int length);
35 __attribute__((malloc)) void * allocate_newtrans(void * ptr, int type);
36 __attribute__((malloc)) struct ArrayObject * allocate_newarraytrans(void * ptr, int type, int length);
41 __attribute__((malloc)) void * allocate_new(void *, int type);
42 __attribute__((malloc)) struct ArrayObject * allocate_newarray(void *, int type, int length);
43 __attribute__((malloc)) struct ___String___ * NewString(void *, const char *str,int length);
44 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
46 __attribute__((malloc)) void * allocate_new(int type);
47 __attribute__((malloc)) struct ArrayObject * allocate_newarray(int type, int length);
48 __attribute__((malloc)) struct ___String___ * NewString(const char *str,int length);
49 __attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(int index);
54 void initializeexithandler();
55 void failedboundschk();
58 void injectinstructionfailure();
59 void createstartupobject();
62 #define VAR(name) ___params___->name
63 #define CALL00(name) name(struct name ## _params * ___params___)
64 #define CALL01(name, alt) name(struct name ## _params * ___params___)
65 #define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___)
66 #define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest)
67 #define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest)
68 #define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2)
69 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2)
70 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2)
71 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3)
73 #define VAR(name) name
74 #define CALL00(name) name()
75 #define CALL01(name, alt) name(alt)
76 #define CALL02(name, alt1, alt2) name(alt1, alt2)
77 #define CALL11(name,rest, alt) name(alt)
78 #define CALL12(name,rest, alt1, alt2) name(alt1, alt2)
79 #define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2)
80 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3)
81 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
82 #define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
86 #include "SimpleHash.h"
89 #include "ObjectHash.h"
90 #include "structdefs.h"
94 #include "optionalstruct.h"
98 struct failedtasklist {
99 struct taskdescriptor *task;
103 struct failedtasklist *next;
108 struct transObjInfo {
115 struct RuntimeHash * lockRedirectTbl;
120 extern struct ___Object___ * ___fcrevert___;
124 void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length);
125 void flagorandinit(void * ptr, int ormask, int andmask);
126 void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length);
128 void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length);
130 inline void setTaskExitIndex(int index);
131 inline void addNewObjInfo(void * nobj);
134 int * getAliasLock(void ** ptrs, int length, struct RuntimeHash * tbl);
135 void addAliasLock(void * ptr, int lock);
137 void flagorand(void * ptr, int ormask, int andmask);
138 void flagorandinit(void * ptr, int ormask, int andmask);
139 void enqueueObject(void * ptr);
145 void transferObject(struct transObjInfo * transObj);
149 struct tagobjectiterator {
150 int istag; /* 0 if object iterator, 1 if tag iterator */
151 struct ObjectIterator it; /* Object iterator */
152 struct ObjectHash * objectset;
157 int tagobjindex; /* Index for tag or object depending on use */
158 /*if tag we have an object binding */
161 /*if object, we may have one or more tag bindings */
163 int tagbindings[MAXTASKPARAMS-1]; /* list slots */
166 struct parameterwrapper {
167 struct parameterwrapper *next;
168 struct ObjectHash * objectset;
173 struct taskdescriptor * task;
175 struct tagobjectiterator iterators[MAXTASKPARAMS-1];
179 struct taskparamdescriptor {
180 struct taskdescriptor * task;
182 void ** parameterArray;
188 int hashCodetpd(struct taskparamdescriptor *);
189 int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *);
191 void toiReset(struct tagobjectiterator * it);
192 int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
193 void toiNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed));
194 void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams);
195 void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams);
196 void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter);
197 int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags);
199 int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags);