#include "runtime.h"
#include "structdefs.h"
extern int classsize[];
+#ifdef BOEHM_GC
+#include "gc.h"
+#define FREEMALLOC(x) GC_malloc(x)
+#else
+#define FREEMALLOC(x) calloc(1,x)
+#endif
int ___Object______hashcode____(struct ___Object___ * ___this___) {
return (int) ___this___;
void * allocate_new(int type) {
- void * v=calloc(1,classsize[type]);
+ void * v=FREEMALLOC(classsize[type]);
*((int *)v)=type;
return v;
}
void * allocate_newarray(int type, int length) {
- void * v=calloc(1,sizeof(struct ArrayObject)+length*classsize[type]);
+ void * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]);
*((int *)v)=type;
((struct ArrayObject *)v)->___length___=length;
return v;