3 #include "runtime_arch.h"
18 __thread struct lockvector lvector;
19 __thread int mythreadid;
25 #ifdef D___Object______hashCode____
26 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
27 return VAR(___this___)->hashcode;
31 #ifdef D___Object______getType____
32 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
33 return ((int *)VAR(___this___))[0];
38 #ifdef D___Object______MonitorEnter____
39 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
42 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
43 int self=(int)(long)pthread_getspecific(macthreadid);
45 struct lockvector *lptr=&lvector;
48 struct lockpair *lpair=&lptr->locks[lptr->index++];
49 lpair->object=VAR(___this___);
51 if (self==VAR(___this___)->tid) {
56 if (VAR(___this___)->tid==0) {
57 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
63 if (unlikely(needtocollect))
64 checkcollect((struct garbagelist *)___params___);
74 #ifdef D___Object______notify____
75 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
76 VAR(___this___)->notifycount++;
80 #ifdef D___Object______notifyAll____
81 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
82 VAR(___this___)->notifycount++;
86 #ifdef D___Object______wait____
87 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
89 int self=(int)(long)pthread_getspecific(macthreadid);
93 int notifycount=VAR(___this___)->notifycount;
95 VAR(___this___)->tid=0;
98 while(notifycount==VAR(___this___)->notifycount) {
100 if (unlikely(needtocollect))
101 checkcollect((struct garbagelist *)___params___);
106 if (VAR(___this___)->tid==0) {
107 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
113 if (unlikely(needtocollect))
114 checkcollect((struct garbagelist *)___params___);
120 #ifdef D___Object______MonitorExit____
121 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
124 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
126 struct lockvector *lptr=&lvector;
128 struct lockpair *lpair=&lptr->locks[--lptr->index];
130 if (lpair->islastlock) {
132 lpair->object->tid=0;