#include "dmalloc.h"
#endif
-int instanceof(struct ___Object___ *ptr, int type) {
+int instanceof(ObjectPtr ptr, int type) {
int i=ptr->type;
do {
if (i==type)
if (i>NUMCLASSES) {
do {
if (i==type)
- return 1;
+ return 1;
i=typearray2[i-NUMCLASSES];
} while(i!=-1);
}
instaccum+=failurecount;
if ((((double)random())/RAND_MAX)<instfailurechance) {
if (numfailures>0)
- numfailures--;
+ numfailures--;
printf("FAILURE!!! %d\n",numfailures);
longjmp(error_handler,11);
}
instaccum+=failurecount;
if ((((double)random())/RAND_MAX)<instfailurechance) {
if (numfailures>0)
- numfailures--;
+ numfailures--;
printf("FAILURE!!! %d\n",numfailures);
threadexit();
}
struct ___Object___ * ptr=((struct ___Object___**)(((char*) &aosrc->___length___)+sizeof(int)))[i];
int ptrtype=((int *)ptr)[0];
if (ptrtype>=NUMCLASSES) {
- struct ___Object___ * dstptr=((struct ___Object___**)(((char*) &aodst->___length___)+sizeof(int)))[i];
- deepArrayCopy(dstptr,ptr);
+ struct ___Object___ * dstptr=((struct ___Object___**)(((char*) &aodst->___length___)+sizeof(int)))[i];
+ deepArrayCopy(dstptr,ptr);
} else {
- //hit an object
- ((struct ___Object___ **)(((char*) &aodst->___length___)+sizeof(int)))[i]=ptr;
+ //hit an object
+ ((struct ___Object___ **)(((char*) &aodst->___length___)+sizeof(int)))[i]=ptr;
}
}
}
free(to_heapbase);
to_heapbase=malloc(curr_heapsize);
if (to_heapbase==NULL) {
- printf("Error Allocating enough memory\n");
- exit(-1);
+ printf("Error Allocating enough memory\n");
+ exit(-1);
}
to_heaptop=to_heapbase+curr_heapsize;
to_heapptr=to_heapbase;
#else
__attribute__((malloc)) void * allocate_new(void * ptr, int type) {
#endif
- struct ___Object___ * v=(struct ___Object___ *) mygcmalloc((struct garbagelist *) ptr, classsize[type]);
+ ObjectPtr v=(ObjectPtr) mygcmalloc((struct garbagelist *) ptr, classsize[type]);
v->type=type;
v->hashcode=(int)(INTPTR)v;
#ifdef THREADS
#endif
#ifdef MLP
v->oid=oid;
- v->allocsite=allocsite;
+ // v->allocsite=allocsite;
#endif
return v;
}
#else
__attribute__((malloc)) void * allocate_new(int type) {
- struct ___Object___ * v=FREEMALLOC(classsize[type]);
+ ObjectPtr v=FREEMALLOC(classsize[type]);
v->type=type;
v->hashcode=(int)(INTPTR)v;
#ifdef OPTIONAL
/* Converts C character arrays into Java strings */
#ifdef PRECISE_GC
-__attribute__((malloc)) struct ___String___ * NewStringShort(void * ptr, const short *str,int length) {
+__attribute__((malloc)) StringPtr NewStringShort(void * ptr, const short *str,int length) {
#else
-__attribute__((malloc)) struct ___String___ * NewStringShort(const short *str,int length) {
+__attribute__((malloc)) StringPtr NewStringShort(const short *str,int length) {
#endif
int i;
#ifdef PRECISE_GC
struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length);
INTPTR ptrarray[]={1, (INTPTR) ptr, (INTPTR) chararray};
- struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE);
+ StringPtr strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE);
chararray=(struct ArrayObject *) ptrarray[2];
#else
struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
- struct ___String___ * strobj=allocate_new(STRINGTYPE);
+ StringPtr strobj=allocate_new(STRINGTYPE);
#endif
strobj->___value___=chararray;
strobj->___count___=length;
/* Converts C character arrays into Java strings */
#ifdef PRECISE_GC
-__attribute__((malloc)) struct ___String___ * NewString(void * ptr, const char *str,int length) {
+__attribute__((malloc)) StringPtr NewString(void * ptr, const char *str,int length) {
#else
-__attribute__((malloc)) struct ___String___ * NewString(const char *str,int length) {
+__attribute__((malloc)) StringPtr NewString(const char *str,int length) {
#endif
int i;
#ifdef PRECISE_GC
struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length);
INTPTR ptrarray[]={1, (INTPTR) ptr, (INTPTR) chararray};
- struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE);
+ StringPtr strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE);
chararray=(struct ArrayObject *) ptrarray[2];
#else
struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length);
- struct ___String___ * strobj=allocate_new(STRINGTYPE);
+ StringPtr strobj=allocate_new(STRINGTYPE);
#endif
strobj->___value___=chararray;
strobj->___count___=length;
/* Generated code calls this if we fail a bounds check */
-void failedboundschk(int num) {
+ void failedboundschk(int num, int index, struct ArrayObject * ao ) {
#ifndef TASK
- printf("Array out of bounds\n");
+ printf("Array out of bounds at line %u with index %u of object %x with length %u\n", num, index, ao, ao->___length___);
#ifdef THREADS
threadexit();
#else