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 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
33 return ((int *)VAR(___this___))[0];
37 int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
39 pthread_t self=pthread_self();
40 if (self==VAR(___this___)->tid) {
41 atomic_inc(&VAR(___this___)->lockcount);
44 if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
45 VAR(___this___)->___prevlockobject___=NULL;
46 VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
47 if (VAR(___this___)->___nextlockobject___!=NULL)
48 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
49 pthread_setspecific(threadlocks, VAR(___this___));
50 VAR(___this___)->tid=self;
51 pthread_mutex_unlock(&objlock);
57 stopforgc((struct garbagelist *)___params___);
68 #ifdef D___Object______notify____
69 void CALL01(___Object______notify____, struct ___Object___ * ___this___) {
72 #ifdef D___Object______notifyAll____
73 void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) {
76 #ifdef D___Object______wait____
77 void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
78 pthread_t self=pthread_self();
79 int lockcount=VAR(___this___)->lockcount;
81 if (VAR(___this___)->___prevlockobject___==NULL) {
82 pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
84 VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
85 if (VAR(___this___)->___nextlockobject___!=NULL)
86 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
87 VAR(___this___)->___nextlockobject___=NULL;
88 VAR(___this___)->___prevlockobject___=NULL;
89 //VAR(___this___)->lockentry=NULL;
90 VAR(___this___)->tid=0;
93 VAR(___this___)->lockcount=0;
97 stopforgc((struct garbagelist *)___params___);
105 if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) {
106 VAR(___this___)->___prevlockobject___=NULL;
107 VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
108 if (VAR(___this___)->___nextlockobject___!=NULL)
109 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
110 pthread_setspecific(threadlocks, VAR(___this___));
111 VAR(___this___)->tid=self;
112 pthread_mutex_unlock(&objlock);
118 stopforgc((struct garbagelist *)___params___);
128 int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
130 pthread_t self=pthread_self();
131 if (self==VAR(___this___)->tid) {
132 //release one lock...
134 if (VAR(___this___)->lockcount==1) {
135 if (VAR(___this___)->___prevlockobject___==NULL) {
136 pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
138 VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
139 if (VAR(___this___)->___nextlockobject___!=NULL)
140 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
141 VAR(___this___)->___nextlockobject___=NULL;
142 VAR(___this___)->___prevlockobject___=NULL;
143 //VAR(___this___)->lockentry=NULL;
144 VAR(___this___)->tid=0;
146 atomic_dec(&VAR(___this___)->lockcount);
151 printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n");