3 #include "runtime_arch.h"
17 __thread struct lockvector lvector;
18 __thread int mythreadid;
23 #ifdef D___Object______nativehashCode____
24 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
25 return (int)((INTPTR) VAR(___this___));
29 #ifdef D___Object______hashCode____
30 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
31 if (!VAR(___this___)->___cachedHash___) {
32 VAR(___this___)->___cachedHash___=1;
33 VAR(___this___)->___cachedCode___=(int)((INTPTR)VAR(___this___));
35 return VAR(___this___)->___cachedCode___;
39 #ifdef D___Object______getType____
40 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
41 return ((int *)VAR(___this___))[0];
46 #ifdef D___Object______MonitorEnter____
47 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
49 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
50 int self=(int)(long)pthread_getspecific(macthreadid);
52 struct lockvector *lptr=&lvector;
55 struct lockpair *lpair=&lptr->locks[lptr->index++];
56 lpair->object=VAR(___this___);
58 if (self==VAR(___this___)->tid) {
63 if (VAR(___this___)->tid==0) {
64 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
70 if (unlikely(needtocollect))
71 checkcollect((struct garbagelist *)___params___);
80 #ifdef D___Object______notify____
81 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
82 VAR(___this___)->notifycount++;
86 #ifdef D___Object______notifyAll____
87 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
88 VAR(___this___)->notifycount++;
92 #ifdef D___Object______wait____
93 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
95 int self=(int)(long)pthread_getspecific(macthreadid);
99 int notifycount=VAR(___this___)->notifycount;
101 VAR(___this___)->tid=0;
104 while(notifycount==VAR(___this___)->notifycount) {
106 if (unlikely(needtocollect))
107 checkcollect((struct garbagelist *)___params___);
112 if (VAR(___this___)->tid==0) {
113 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
119 if (unlikely(needtocollect))
120 checkcollect((struct garbagelist *)___params___);
126 #ifdef D___Object______MonitorExit____
127 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
129 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
131 struct lockvector *lptr=&lvector;
133 struct lockpair *lpair=&lptr->locks[--lptr->index];
135 if (lpair->islastlock) {
137 lpair->object->tid=0;