+#include <setjmp.h>
+extern jmp_buf error_handler;
+extern int instructioncount;
+extern int failurecount;
+#ifdef DSTM
+#include "dstm.h"
+#endif
+
+#ifndef INTPTR
+#ifdef BIT64
+#define INTPTR long
+#else
+#define INTPTR int
+#endif
+#endif
+
+extern void * curr_heapbase;
+extern void * curr_heaptop;
+
+#define TAGARRAYINTERVAL 10
+#define OBJECTARRAYINTERVAL 10
+
+#define ARRAYSET(array, type, index, value) \
+ ((type *)(& (& array->___length___)[1]))[index]=value
+
+#define ARRAYGET(array, type, index) \
+ ((type *)(& (& array->___length___)[1]))[index]
+
+#ifdef OPTIONAL
+#define OPTARG(x) , x
+#else
+#define OPTARG(x)
+#endif
+
+#ifdef DSTM
+__attribute__((malloc)) void * allocate_newglobal(int type);
+__attribute__((malloc)) struct ArrayObject * allocate_newarrayglobal(int type, int length);
+#endif
+
+#ifdef STM
+__attribute__((malloc)) void * allocate_newtrans(void * ptr, int type);
+__attribute__((malloc)) struct ArrayObject * allocate_newarraytrans(void * ptr, int type, int length);
+#endif
+
+#ifdef PRECISE_GC
+#include "garbage.h"
+__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);
+__attribute__((malloc)) struct ___String___ * NewString(const char *str,int length);
+__attribute__((malloc)) struct ___TagDescriptor___ * allocate_tag(int index);
+#endif
+
+
+
+void initializeexithandler();
+void failedboundschk();
+void failednullptr();
+void abort_task();
+void injectinstructionfailure();
+void createstartupobject();
+
+#ifdef PRECISE_GC
+#define VAR(name) ___params___->name
+#define CALL00(name) name(struct name ## _params * ___params___)
+#define CALL01(name, alt) name(struct name ## _params * ___params___)
+#define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___)
+#define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest)
+#define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest)
+#define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2)
+#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2)
+#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2)
+#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3)
+#else
+#define VAR(name) name
+#define CALL00(name) name()
+#define CALL01(name, alt) name(alt)
+#define CALL02(name, alt1, alt2) name(alt1, alt2)
+#define CALL11(name,rest, alt) name(alt)
+#define CALL12(name,rest, alt1, alt2) name(alt1, alt2)
+#define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2)
+#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3)
+#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
+#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4)
+#endif
+
+#ifdef TASK
+#include "SimpleHash.h"
+#include "chash.h"
+#ifndef MULTICORE
+#include "ObjectHash.h"
+#include "structdefs.h"
+#endif
+#include "task.h"
+#ifdef OPTIONAL
+#include "optionalstruct.h"
+#endif
+
+#ifdef OPTIONAL
+struct failedtasklist {
+ struct taskdescriptor *task;
+ int index;
+ int numflags;
+ int *flags;
+ struct failedtasklist *next;
+};
+#endif
+
+#ifdef MULTICORE
+struct transObjInfo {
+ void * objptr;
+ int targetcore;
+ int * queues;
+ int length;
+};
+#ifdef RAW
+struct RuntimeHash * lockRedirectTbl;
+#endif
+#endif