3 #include "runtime_arch.h"
17 __thread struct lockvector lvector;
18 __thread int mythreadid;
21 #ifdef D___Object______nativehashCode____
22 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
23 return (int)((INTPTR) VAR(___this___));
27 #ifdef D___Object______hashCode____
28 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
29 if (!VAR(___this___)->___cachedHash___) {
30 VAR(___this___)->___cachedHash___=1;
31 VAR(___this___)->___cachedCode___=(int)((INTPTR)VAR(___this___));
33 return VAR(___this___)->___cachedCode___;
37 #ifdef D___Object______getType____
38 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
39 return ((int *)VAR(___this___))[0];
44 #ifdef D___Object______MonitorEnter____
45 void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
47 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
48 int self=pthread_getspecific(macthreadid);
50 struct lockvector *lptr=&lvector;
53 struct lockpair *lpair=&lptr->locks[lptr->index++];
54 lpair->object=VAR(___this___);
56 if (self==VAR(___this___)->tid) {
61 if (VAR(___this___)->tid==0) {
62 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
68 if (unlikely(needtocollect))
69 checkcollect((struct garbagelist *)___params___);
78 #ifdef D___Object______notify____
79 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
80 VAR(___this___)->notifycount++;
84 #ifdef D___Object______notifyAll____
85 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
86 VAR(___this___)->notifycount++;
90 #ifdef D___Object______wait____
91 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
93 int self=pthread_getspecific(macthreadid);
97 int notifycount=VAR(___this___)->notifycount;
99 VAR(___this___)->tid=0;
102 while(notifycount==VAR(___this___)->notifycount) {
104 if (unlikely(needtocollect))
105 checkcollect((struct garbagelist *)___params___);
110 if (VAR(___this___)->tid==0) {
111 if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
117 if (unlikely(needtocollect))
118 checkcollect((struct garbagelist *)___params___);
124 #ifdef D___Object______MonitorExit____
125 void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
127 struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
129 struct lockvector *lptr=&lvector;
131 struct lockpair *lpair=&lptr->locks[--lptr->index];
133 if (lpair->islastlock) {
135 lpair->object->tid=0;