3 #include "runtime_arch.h"
13 int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) {
14 return (int)((INTPTR) VAR(___this___));
17 int CALL01(___Object______getType____, struct ___Object___ * ___this___) {
18 return ((int *)VAR(___this___))[0];
22 int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
23 pthread_t self=pthread_self();
24 if (self==VAR(___this___)->tid) {
25 VAR(___this___)->lockcount++;
28 stopforgc((struct garbagelist *)___params___);
30 pthread_mutex_lock(&objlock);
35 if (VAR(___this___)->tid==0) {
36 VAR(___this___)->___prevlockobject___=NULL;
37 VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks);
38 if (VAR(___this___)->___nextlockobject___!=NULL)
39 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___);
40 pthread_setspecific(threadlocks, VAR(___this___));
41 VAR(___this___)->lockcount=1;
42 VAR(___this___)->tid=self;
43 pthread_mutex_unlock(&objlock);
48 stopforgc((struct garbagelist *)___params___);
50 pthread_cond_wait(&objcond, &objlock);
59 int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
60 pthread_t self=pthread_self();
61 if (self==VAR(___this___)->tid) {
62 VAR(___this___)->lockcount--;
63 if (VAR(___this___)->lockcount==0) {
64 if (VAR(___this___)->___prevlockobject___==NULL) {
65 pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___);
67 VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___;
68 if (VAR(___this___)->___nextlockobject___!=NULL)
69 VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___;
70 VAR(___this___)->lockentry=NULL;
71 VAR(___this___)->tid=0;
73 pthread_mutex_lock(&objlock);
74 pthread_cond_broadcast(&objcond);
75 pthread_mutex_unlock(&objlock);
80 printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n");