OSDN Git Service

* genrecog.c (write_switch): Avoid outputting of switch for
[pf3gnuchains/gcc-fork.git] / libjava / nogc.cc
index 10d4f80..0829671 100644 (file)
@@ -1,4 +1,4 @@
-// nogc.cc - Code to implement no GC.
+// nogc.cc - Implement null garbage collector.
 
 /* Copyright (C) 1998, 1999, 2000  Free Software Foundation
 
@@ -19,18 +19,30 @@ details.  */
 // Total amount of memory allocated.
 static long total = 0;
 
+#ifdef INTERPRETER
 void *
-_Jv_AllocObj (jsize size)
+_Jv_BuildGCDescr(jclass klass)
+{
+  return 0;
+}
+#endif
+
+void *
+_Jv_AllocObj (jsize size, jclass klass)
 {
   total += size;
-  return calloc (size, 1);
+  void *obj = calloc (size, 1);
+  *((_Jv_VTable **) obj) = klass->vtable;
+  return obj;
 }
 
 void *
-_Jv_AllocArray (jsize size)
+_Jv_AllocArray (jsize size, jclass klass)
 {
   total += size;
-  return calloc (size, 1);
+  void *obj = calloc (size, 1);
+  *((_Jv_VTable **) obj) = klass->vtable;
+  return obj;
 }
 
 void *