3 #include "runtime_arch.h"
17 __thread struct lockvector lvector;
20 #ifdef D___Object______nativehashCode____
21 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
22 return (int)((INTPTR) VAR(___this___));
26 #ifdef D___Object______hashCode____
27 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
28 if (!VAR(___this___)->___cachedHash___) {
29 VAR(___this___)->___cachedHash___=1;
30 VAR(___this___)->___cachedCode___=(int)((INTPTR)VAR(___this___));
32 return VAR(___this___)->___cachedCode___;
36 #ifdef D___Object______getType____
37 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
38 return ((int *)VAR(___this___))[0];
43 #ifdef D___Object______MonitorEnter____
44 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
46 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
48 struct lockvector *lptr=&lvector;
50 struct lockpair *lpair=&lptr->locks[lptr->index++];
51 pthread_t self=pthread_self();
52 lpair->object=VAR(___this___);
54 if (self==VAR(___this___)->tid) {
59 if (VAR(___this___)->tid==0) {
60 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
66 if (unlikely(needtocollect))
67 checkcollect((struct garbagelist *)___params___);
76 #ifdef D___Object______notify____
77 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
78 VAR(___this___)->notifycount++;
82 #ifdef D___Object______notifyAll____
83 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
84 VAR(___this___)->notifycount++;
88 #ifdef D___Object______wait____
89 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
90 pthread_t self=pthread_self();
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;