This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: cleanup for new GC
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: cleanup for new GC
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 01 Nov 1999 17:13:31 -0700
- Reply-To: tromey at cygnus dot com
I'm checking in the appended patch. It makes libgcj operate more
smoothly with the newly imported GC.
1999-11-01 Tom Tromey <tromey@cygnus.com>
* boehm.cc (_Jv_InitGC): Set GC_java_finalization.
(sum_blocks): Removed.
(_Jv_GCFreeMemory): Use GC_get_free_bytes.
Tom
Index: boehm.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/boehm.cc,v
retrieving revision 1.8
diff -u -r1.8 boehm.cc
--- boehm.cc 1999/10/22 19:43:39 1.8
+++ boehm.cc 1999/11/01 23:17:41
@@ -368,28 +368,10 @@
return GC_get_heap_size ();
}
-/* Sum size of each hblk. */
-static void
-sum_blocks (struct hblk *h, word arg)
-{
- long *sump = (long *) arg;
- /* This evil computation is from boehm-gc/checksums.c. */
- hdr *hhdr = HDR (h);
- int bytes = WORDS_TO_BYTES (hhdr->hb_sz);
- bytes += HDR_BYTES + HBLKSIZE - 1;
- bytes &= ~ (HBLKSIZE - 1);
- *sump += bytes;
-}
-
-/* This turns out to be expensive to implement. For now, we don't
- care. We could make it less expensive, perhaps, but that would
- require some changes to the collector. */
long
_Jv_GCFreeMemory (void)
{
- long sum = 0;
- GC_apply_to_all_blocks (sum_blocks, &sum);
- return sum;
+ return GC_get_free_bytes ();
}
void
@@ -422,6 +404,8 @@
return;
}
initialized = 1;
+
+ GC_java_finalization = 1;
// Set up state for marking and allocation of Java objects.
obj_free_list = (ptr_t *) GC_generic_malloc_inner ((MAXOBJSZ + 1)