3 #include "runtime_arch.h"
17 __thread struct lockvector lvector;
18 __thread int mythreadid;
23 #ifdef D___Object______hashCode____
24 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
25 return VAR(___this___)->hashcode;
29 #ifdef D___Object______getType____
30 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
31 return ((int *)VAR(___this___))[0];
36 #ifdef D___Object______MonitorEnter____
37 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
39 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
40 int self=(int)(long)pthread_getspecific(macthreadid);
42 struct lockvector *lptr=&lvector;
45 struct lockpair *lpair=&lptr->locks[lptr->index++];
46 lpair->object=VAR(___this___);
48 if (self==VAR(___this___)->tid) {
53 if (VAR(___this___)->tid==0) {
54 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
60 if (unlikely(needtocollect))
61 checkcollect((struct garbagelist *)___params___);
70 #ifdef D___Object______notify____
71 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
72 VAR(___this___)->notifycount++;
76 #ifdef D___Object______notifyAll____
77 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
78 VAR(___this___)->notifycount++;
82 #ifdef D___Object______wait____
83 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
85 int self=(int)(long)pthread_getspecific(macthreadid);
89 int notifycount=VAR(___this___)->notifycount;
91 VAR(___this___)->tid=0;
94 while(notifycount==VAR(___this___)->notifycount) {
96 if (unlikely(needtocollect))
97 checkcollect((struct garbagelist *)___params___);
102 if (VAR(___this___)->tid==0) {
103 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
109 if (unlikely(needtocollect))
110 checkcollect((struct garbagelist *)___params___);
116 #ifdef D___Object______MonitorExit____
117 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
119 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
121 struct lockvector *lptr=&lvector;
123 struct lockpair *lpair=&lptr->locks[--lptr->index];
125 if (lpair->islastlock) {
127 lpair->object->tid=0;