6 #define CHECKREADS(x) 0
9 #define LIGHTWEIGHTCOMMIT(commitmethod, primitives, locals, params, label) \
10 if (GETLOCKS()||CHECKREADS()) { \
11 if (unlikely(needtocollect)) checkcollect(&___locals___); \
14 ptrstack.maxcount=0; \
16 branchstack.count=0; \
17 commitmethod(params, locals, primitives); \
22 static inline int CHECKREADS() {
23 rdchashlistnode_t *rd_curr=rd_c_list;
25 rdchashlistnode_t *ptr=rd_c_table;
26 rdchashlistnode_t *top=&ptr[rd_c_size];
28 while(likely(rd_curr!=NULL)) {
29 unsigned int version=rd_curr->version;
30 struct ___Object___ * objptr=rd_curr->key;
31 objheader_t *header=(objheader_t *)(((char *)objptr)-sizeof(objheader_t));
32 if(likely(header->lock>0)) {//doesn't matter what type of lock...
33 if(unlikely(version!=header->version)) {
37 if(likely(version==header->version)) {
38 dchashlistnode_t *node = &dc_c_table[(((unsigned INTPTR)objptr) & dc_c_mask)>>4];
40 if(node->key == objptr) {
49 if (likely(rd_curr>=ptr&&rd_curr<top)) {
54 rd_curr=rd_curr->lnext;
57 if (unlikely(retval)) {
58 while(likely(rd_curr!=NULL)) {
59 if (likely(rd_curr>=ptr&&rd_curr<top)) {
64 rd_curr=rd_curr->lnext;
66 while(rd_c_structs->next!=NULL) {
67 rdcliststruct_t *next=rd_c_structs->next;
71 rd_c_structs->num = 0;
79 while(rd_c_structs->next!=NULL) {
80 rdcliststruct_t *next=rd_c_structs->next;
84 rd_c_structs->num = 0;
92 static inline void FREELIST() {
93 dchashlistnode_t *ptr = dc_c_table;
94 dchashlistnode_t *top=&ptr[dc_c_size];
95 dchashlistnode_t *tmpptr=dc_c_list;
97 dchashlistnode_t *next=tmpptr->lnext;
98 if (tmpptr>=ptr&&tmpptr<top) {
105 while(dc_c_structs->next!=NULL) {
106 dcliststruct_t *next=dc_c_structs->next;
110 dc_c_structs->num = 0;
111 dc_c_numelements = 0;
115 static inline void RELEASELOCKS() {
116 dchashlistnode_t *dc_curr = dc_c_list;
117 while(likely(dc_curr!=NULL)) {
118 struct ___Object___ * objptr=dc_curr->key;
119 objheader_t *header=&((objheader_t *)objptr)[-1];
121 if (objptr->type>=NUMCLASSES) {
122 rwwrite_unlock(&header->lock);
125 write_unlock(&header->lock);
129 dc_curr=dc_curr->lnext;
136 static inline int GETLOCKS() {
137 dchashlistnode_t *dc_curr = dc_c_list;
138 while(likely(dc_curr!=NULL)) {
139 struct ___Object___ * objptr=dc_curr->key;
140 objheader_t *header=&((objheader_t *)objptr)[-1];
142 if (objptr->type>=NUMCLASSES) {
143 if (unlikely(!rwwrite_trylock(&header->lock))) {
152 if(unlikely(!write_trylock(&header->lock))) {
159 dc_curr=dc_curr->lnext;