From: bdemsky <bdemsky>
Date: Wed, 12 Apr 2006 19:51:47 +0000 (+0000)
Subject: Conservative GC support
X-Git-Tag: preEdgeChange~926
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ccacc1ad595218a93fb0b379fbf77c3cb4f47a30;p=IRC.git

Conservative GC support
---

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;