This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 #ifndef RUNTIME
2 #define RUNTIME
3 #include <setjmp.h>
4 extern jmp_buf error_handler;
5 extern int instructioncount;
6 extern int failurecount;
7
8 #define TAGARRAYINTERVAL 10
9 #define OBJECTARRAYINTERVAL 10
10
11 #define ARRAYSET(array, type, index, value) \
12 ((type *)(&(& array->___length___)[1]))[index]=value
13
14 #define ARRAYGET(array, type, index) \
15 ((type *)(&(& array->___length___)[1]))[index]
16
17 #ifdef PRECISE_GC
18 #include "garbage.h"
19 void * allocate_new(void *, int type);
20 struct ArrayObject * allocate_newarray(void *, int type, int length);
21 struct ___String___ * NewString(void *, const char *str,int length);
22 struct ___TagDescriptor___ * allocate_tag(void *ptr, int index);
23 #else
24 void * allocate_new(int type);
25 struct ArrayObject * allocate_newarray(int type, int length);
26 struct ___String___ * NewString(const char *str,int length);
27 struct ___TagDescriptor___ * allocate_tag(int index);
28 #endif
29
30
31
32 void initializeexithandler();
33 void failedboundschk();
34 void failednullptr();
35 void abort_task();
36 void injectinstructionfailure();
37 void createstartupobject();
38
39 #ifdef PRECISE_GC
40 #define VAR(name) ___params___->name
41 #define CALL00(name) name(struct name ## _params * ___params___)
42 #define CALL01(name, alt) name(struct name ## _params * ___params___)
43 #define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___)
44 #define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest)
45 #define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest)
46 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2)
47 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2)
48 #else
49 #define VAR(name) name
50 #define CALL00(name) name()
51 #define CALL01(name, alt) name(alt)
52 #define CALL02(name, alt1, alt2) name(alt1, alt2)
53 #define CALL11(name,rest, alt) name(alt)
54 #define CALL12(name,rest, alt1, alt2) name(alt1, alt2)
55 #define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3)
56 #define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
57 #endif
58
59 #ifdef TASK
60 #include "SimpleHash.h"
61 #include "task.h"
62 #include "structdefs.h"
63
64 void flagorand(void * ptr, int ormask, int andmask);
65 void flagorandinit(void * ptr, int ormask, int andmask);
66 void executetasks();
67 void processtasks();
68
69 struct tagobjectiterator {
70   int istag; /* 0 if object iterator, 1 if tag iterator */
71   struct RuntimeIterator it; /* Object iterator */
72   struct RuntimeHash * objectset;
73   int slot;
74   int tagobjindex; /* Index for tag or object depending on use */
75   /*if tag we have an object binding */
76   int tagid;
77   int tagobjectslot;
78   /*if object, we may have one or more tag bindings */
79   int numtags;
80   int tagbindings[MAXTASKPARAMS-1]; /* list slots */
81 };
82
83 struct parameterwrapper {
84   struct parameterwrapper *next;
85   struct RuntimeHash * objectset;
86   int numberofterms;
87   int * intarray;
88   int numbertags;
89   int * tagarray;
90   struct taskdescriptor * task;
91   int slot;
92   struct tagobjectiterator iterators[MAXTASKPARAMS-1];
93 };
94
95 struct taskparamdescriptor {
96   struct taskdescriptor * task;
97   int numParameters;
98   void ** parameterArray;
99 };
100
101 int hashCodetpd(struct taskparamdescriptor *);
102 int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *);
103
104 void toiReset(struct tagobjectiterator * it);
105 int toiHasNext(struct tagobjectiterator *it, void ** objectarray);
106 void toiNext(struct tagobjectiterator *it , void ** objectarray);
107 void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams);
108 void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams);
109 void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter);
110 void enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr);
111
112 #endif
113
114 #endif