3 #include "runtime_arch.h"
17 __thread struct lockvector lvector;
18 __thread int mythreadid;
21 #ifdef D___Object______nativehashCode____
22 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
23 return (int)((INTPTR) VAR(___this___));
27 #ifdef D___Object______hashCode____
28 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
29 if (!VAR(___this___)->___cachedHash___) {
30 VAR(___this___)->___cachedHash___=1;
31 VAR(___this___)->___cachedCode___=(int)((INTPTR)VAR(___this___));
33 return VAR(___this___)->___cachedCode___;
37 #ifdef D___Object______getType____
38 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
39 return ((int *)VAR(___this___))[0];
44 #ifdef D___Object______MonitorEnter____
45 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
47 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
48 int self=pthread_getspecific(macthreadid);
50 struct lockvector *lptr=&lvector;
53 struct lockpair *lpair=&lptr->locks[lptr->index++];
54 lpair->object=VAR(___this___);
56 if (self==VAR(___this___)->tid) {
61 if (VAR(___this___)->tid==0) {
62 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
68 if (unlikely(needtocollect))
69 checkcollect((struct garbagelist *)___params___);
78 #ifdef D___Object______notify____
79 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
80 VAR(___this___)->notifycount++;
84 #ifdef D___Object______notifyAll____
85 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
86 VAR(___this___)->notifycount++;
90 #ifdef D___Object______wait____
91 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
93 int self=pthread_getspecific(macthreadid);
97 pthread_t self=pthread_self();
98 int notifycount=VAR(___this___)->notifycount;
100 VAR(___this___)->tid=0;
103 while(notifycount==VAR(___this___)->notifycount) {
105 if (unlikely(needtocollect))
106 checkcollect((struct garbagelist *)___params___);
111 if (VAR(___this___)->tid==0) {
112 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
118 if (unlikely(needtocollect))
119 checkcollect((struct garbagelist *)___params___);
125 #ifdef D___Object______MonitorExit____
126 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
128 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
130 struct lockvector *lptr=&lvector;
132 struct lockpair *lpair=&lptr->locks[--lptr->index];
134 if (lpair->islastlock) {
136 lpair->object->tid=0;