3 #if defined(DELAYCOMP)&&(!defined(STMARRAY)||defined(DUALVIEW))
6 #define CHECKREADS(x) 0
10 #define TRANSWRAP(x) x
15 #define LIGHTWEIGHTCOMMIT(commitmethod, primitives, locals, params, label) \
16 if (GETLOCKS()||CHECKREADS()) { \
17 TRANSWRAP(numTransAbort++;); \
18 if (unlikely(needtocollect)) checkcollect(&___locals___); \
21 ptrstack.maxcount=0; \
23 branchstack.count=0; \
24 commitmethod(params, locals, primitives); \
27 TRANSWRAP(numTransCommit++;);
31 static inline int CHECKREADS() {
32 rdchashlistnode_t *rd_curr=rd_c_list;
34 rdchashlistnode_t *ptr=rd_c_table;
35 rdchashlistnode_t *top=&ptr[rd_c_size];
37 while(likely(rd_curr!=NULL)) {
38 unsigned int version=rd_curr->version;
39 struct ___Object___ * objptr=rd_curr->key;
40 objheader_t *header=(objheader_t *)(((char *)objptr)-sizeof(objheader_t));
41 if(likely(header->lock>0)) {//doesn't matter what type of lock...
42 if(unlikely(version!=header->version)) {
46 if(likely(version==header->version)) {
47 dchashlistnode_t *node = &dc_c_table[(((unsigned INTPTR)objptr) & dc_c_mask)>>4];
49 if(node->key == objptr) {
58 if (likely(rd_curr>=ptr&&rd_curr<top)) {
63 rd_curr=rd_curr->lnext;
66 if (unlikely(retval)) {
67 while(likely(rd_curr!=NULL)) {
68 if (likely(rd_curr>=ptr&&rd_curr<top)) {
73 rd_curr=rd_curr->lnext;
75 while(rd_c_structs->next!=NULL) {
76 rdcliststruct_t *next=rd_c_structs->next;
80 rd_c_structs->num = 0;
88 while(rd_c_structs->next!=NULL) {
89 rdcliststruct_t *next=rd_c_structs->next;
93 rd_c_structs->num = 0;
101 static inline void FREELIST() {
102 dchashlistnode_t *ptr = dc_c_table;
103 dchashlistnode_t *top=&ptr[dc_c_size];
104 dchashlistnode_t *tmpptr=dc_c_list;
105 while(tmpptr!=NULL) {
106 dchashlistnode_t *next=tmpptr->lnext;
107 if (tmpptr>=ptr&&tmpptr<top) {
114 while(dc_c_structs->next!=NULL) {
115 dcliststruct_t *next=dc_c_structs->next;
119 dc_c_structs->num = 0;
120 dc_c_numelements = 0;
124 static inline void RELEASELOCKS() {
125 dchashlistnode_t *dc_curr = dc_c_list;
126 while(likely(dc_curr!=NULL)) {
127 struct ___Object___ * objptr=dc_curr->key;
128 objheader_t *header=&((objheader_t *)objptr)[-1];
130 if (objptr->type>=NUMCLASSES) {
131 ((struct ArrayObject *)objptr)->arrayversion++;
133 rwwrite_unlock(&header->lock);
137 write_unlock(&header->lock);
141 dc_curr=dc_curr->lnext;
148 static inline int GETLOCKS() {
149 dchashlistnode_t *dc_curr = dc_c_list;
150 while(likely(dc_curr!=NULL)) {
151 struct ___Object___ * objptr=dc_curr->key;
152 objheader_t *header=&((objheader_t *)objptr)[-1];
154 if (objptr->type>=NUMCLASSES) {
155 if (unlikely(!rwwrite_trylock(&header->lock))) {
164 if(unlikely(!write_trylock(&header->lock))) {
171 dc_curr=dc_curr->lnext;