9 #define TRANS_DISAGREE 11
10 #define TRANS_SOFT_ABORT 12
11 #define TRANS_ABORT 13
12 #define TRANS_COMMIT 14
14 #define THREAD_NOTIFY 16
15 #define THREAD_RESPONSE 17
18 /* ========================
19 * Library header files
20 * ========================
28 #include "threadnotify.h"
32 /* ==================================
33 * Bit designation for status field
35 * ==================================
41 /* ================================
43 * ================================
45 #define DEFAULT_OBJ_STORE_SIZE 1048510 //1MB
46 #define OSUSED(x) (((unsigned int)(x)->top)-((unsigned int) (x+1)))
47 #define OSFREE(x) ((x)->size-OSUSED(x))
48 #define TRANSREAD(x,y) { \
49 unsigned int inputvalue;\
50 if ((inputvalue=(unsigned int)y)==0) x=NULL;\
52 chashlistnode_t * cnodetmp=&c_table[(inputvalue&c_mask)>>1]; \
54 if (cnodetmp->key==inputvalue) {x=(void *)&((objheader_t*)cnodetmp->val)[1];break;} \
55 cnodetmp=cnodetmp->next;\
56 if (cnodetmp==NULL) {x=(void *)transRead(inputvalue); asm volatile("":"=m"(c_table),"=m"(c_mask));break;} \
60 /* =================================
62 * =================================
64 typedef struct objstr {
65 unsigned int size; //this many bytes are allocated after this header
71 typedef struct newObjCreated {
72 unsigned int numcreated;
73 unsigned int *oidcreated;
77 typedef struct objheader {
78 threadlist_t *notifylist;
79 unsigned short version;
80 unsigned short rcount;
84 (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___))
87 ((void*)((((void *) x )!=NULL) ? (*((unsigned int *)&((struct ___Object___ *) x)->___nextobject___)) : 0))
90 *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))
92 #define STATUSPTR(x) \
93 ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___))
96 ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type
98 #define GETSIZE(size, x) { \
100 if (type<NUMCLASSES) { \
101 size=classsize[type]; \
103 size=classsize[type]*((struct ArrayObject *)&((objheader_t *)x)[1])->___length___+sizeof(struct ArrayObject); \
108 #define OID(x) x->oid
109 #define TYPE(x) x->type
110 #define STATUS(x) x->status
111 #define STATUSPTR(x) &x->status
112 #define GETSIZE(size, x) size=classsize[TYPE(x)]
115 /* ================================
117 * ================================
120 objstr_t *objstrCreate(unsigned int size);
122 objheader_t *transCreateObj(unsigned int size);
123 unsigned int getNewOID(void);
124 void *objstrAlloc(objstr_t **osptr, unsigned int size);
125 __attribute__((pure)) objheader_t *transRead(unsigned int oid);
127 char traverseCache(char *treplyretry);
128 char decideResponse(objheader_t *, unsigned int *, int *, unsigned int *, int *, unsigned int*, int *,
129 int *, int *, int *, int*, int*);
130 int transAbortProcess(unsigned int *, int *, unsigned int *, int *);
131 int transCommmitProcess(unsigned int *, int *, unsigned int *, int *, unsigned int *, int *);