From ccacc1ad595218a93fb0b379fbf77c3cb4f47a30 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 12 Apr 2006 19:51:47 +0000 Subject: [PATCH] Conservative GC support --- Robust/src/Runtime/runtime.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index 3d23c43a..5b6afb19 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -1,6 +1,12 @@ #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___; @@ -21,13 +27,13 @@ void ___System______printString____L___String___(struct ___String___ * s) { 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; -- 2.34.1