3 #include "runtime_arch.h"
16 #ifdef D___Object______nativehashCode____
17 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
18 return (int)((INTPTR) VAR(___this___));
22 #ifdef D___Object______hashCode____
23 int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) {
24 if (!VAR(___this___)->___cachedHash___) {
25 VAR(___this___)->___cachedHash___=1;
26 VAR(___this___)->___cachedCode___=(int)((INTPTR)VAR(___this___));
28 return VAR(___this___)->___cachedCode___;
32 #ifdef D___Object______getType____
33 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
34 return ((int *)VAR(___this___))[0];
39 #ifdef D___Object______MonitorEnter____
40 int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
42 pthread_t self=pthread_self();
43 if (self==VAR(___this___)->tid) {
44 atomic_inc(&VAR(___this___)->lockcount);
47 if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
48 VAR(___this___)->___prevlockobject___=NULL;
49 VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
50 if (VAR(___this___)->___nextlockobject___!=NULL)
51 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
52 pthread_setspecific(threadlocks, VAR(___this___));
53 VAR(___this___)->tid=self;
54 pthread_mutex_unlock(&objlock);
60 stopforgc((struct garbagelist *)___params___);
73 #ifdef D___Object______notify____
74 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
78 #ifdef D___Object______notifyAll____
79 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
83 #ifdef D___Object______wait____
84 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
85 pthread_t self=pthread_self();
86 int lockcount=VAR(___this___)->lockcount;
88 if (VAR(___this___)->___prevlockobject___==NULL) {
89 pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
91 VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
92 if (VAR(___this___)->___nextlockobject___!=NULL)
93 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
94 VAR(___this___)->___nextlockobject___=NULL;
95 VAR(___this___)->___prevlockobject___=NULL;
96 //VAR(___this___)->lockentry=NULL;
97 VAR(___this___)->tid=0;
100 VAR(___this___)->lockcount=0;
104 stopforgc((struct garbagelist *)___params___);
112 if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) {
113 VAR(___this___)->___prevlockobject___=NULL;
114 VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
115 if (VAR(___this___)->___nextlockobject___!=NULL)
116 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
117 pthread_setspecific(threadlocks, VAR(___this___));
118 VAR(___this___)->tid=self;
119 pthread_mutex_unlock(&objlock);
125 stopforgc((struct garbagelist *)___params___);
135 #ifdef D___Object______MonitorExit____
136 int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
138 pthread_t self=pthread_self();
139 if (self==VAR(___this___)->tid) {
140 //release one lock...
142 if (VAR(___this___)->lockcount==1) {
143 if (VAR(___this___)->___prevlockobject___==NULL) {
144 pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
146 VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
147 if (VAR(___this___)->___nextlockobject___!=NULL)
148 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
149 VAR(___this___)->___nextlockobject___=NULL;
150 VAR(___this___)->___prevlockobject___=NULL;
151 //VAR(___this___)->lockentry=NULL;
152 VAR(___this___)->tid=0;
154 atomic_dec(&VAR(___this___)->lockcount);
159 printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n");