Conservative GC support
authorbdemsky <bdemsky>
Wed, 12 Apr 2006 19:51:47 +0000 (19:51 +0000)
committerbdemsky <bdemsky>
Wed, 12 Apr 2006 19:51:47 +0000 (19:51 +0000)
Robust/src/Runtime/runtime.c

index 3d23c43aea58fbbaaeeb156b3b332c063bb70e7e..5b6afb19355366ad8164abaedf637dd802311006 100644 (file)
@@ -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;