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___) {
41 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
42 int self=(int)(long)pthread_getspecific(macthreadid);
44 struct lockvector *lptr=&lvector;
47 struct lockpair *lpair=&lptr->locks[lptr->index++];
48 lpair->object=VAR(___this___);
50 if (self==VAR(___this___)->tid) {
55 if (VAR(___this___)->tid==0) {
56 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
62 if (unlikely(needtocollect))
63 checkcollect((struct garbagelist *)___params___);
72 #ifdef D___Object______notify____
73 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
74 VAR(___this___)->notifycount++;
78 #ifdef D___Object______notifyAll____
79 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
80 VAR(___this___)->notifycount++;
84 #ifdef D___Object______wait____
85 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
87 int self=(int)(long)pthread_getspecific(macthreadid);
91 int notifycount=VAR(___this___)->notifycount;
93 VAR(___this___)->tid=0;
96 while(notifycount==VAR(___this___)->notifycount) {
98 if (unlikely(needtocollect))
99 checkcollect((struct garbagelist *)___params___);
104 if (VAR(___this___)->tid==0) {
105 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
111 if (unlikely(needtocollect))
112 checkcollect((struct garbagelist *)___params___);
118 #ifdef D___Object______MonitorExit____
119 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
121 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
123 struct lockvector *lptr=&lvector;
125 struct lockpair *lpair=&lptr->locks[--lptr->index];
127 if (lpair->islastlock) {
129 lpair->object->tid=0;