[kaffe] CVS kaffe (dalibor): Made gc_heap_total static
Kaffe CVS
cvs-commits at kaffe.org
Fri Sep 3 04:16:32 PDT 2004
PatchSet 5139
Date: 2004/09/03 11:12:36
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Made gc_heap_total static
2004-09-03 Dalibor Topic <robilad at kaffe.org>
* kaffe/kaffevm/kaffe-gc/gc-incremental.c: Use gc_get_heap_total.
* kaffe/kaffevm/kaffe-gc/gc-mem.h: (gc_heap_total) Removed.
(gc_get_heap_total) Added.
* kaffe/kaffevm/kaffe-gc/gc-mem.c (gc_get_heap_total):
New function.
Reported by: Michael Franz <developer.franz at verizon.net>
Members:
ChangeLog:1.2695->1.2696
kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.6->1.7
kaffe/kaffevm/kaffe-gc/gc-mem.c:1.11->1.12
kaffe/kaffevm/kaffe-gc/gc-mem.h:1.9->1.10
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2695 kaffe/ChangeLog:1.2696
--- kaffe/ChangeLog:1.2695 Fri Sep 3 10:21:04 2004
+++ kaffe/ChangeLog Fri Sep 3 11:12:36 2004
@@ -1,5 +1,17 @@
2004-09-03 Dalibor Topic <robilad at kaffe.org>
+ * kaffe/kaffevm/kaffe-gc/gc-incremental.c: Use gc_get_heap_total.
+
+ * kaffe/kaffevm/kaffe-gc/gc-mem.h: (gc_heap_total) Removed.
+ (gc_get_heap_total) Added.
+
+ * kaffe/kaffevm/kaffe-gc/gc-mem.c (gc_get_heap_total):
+ New function.
+
+ Reported by: Michael Franz <developer.franz at verizon.net>
+
+2004-09-03 Dalibor Topic <robilad at kaffe.org>
+
* kaffe/kaffevm/kaffe-gc/gc-mem.c: (gc_pgbits)
Made static.
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.6 kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.7
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.6 Fri Sep 3 10:10:53 2004
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c Fri Sep 3 11:12:37 2004
@@ -561,7 +561,7 @@
*
* XXX: make this a run-time configurable parameter.
*/
- if (gcRunning == 1 && gc_heap_total < gc_heap_limit &&
+ if (gcRunning == 1 && gc_get_heap_total() < gc_heap_limit &&
gcStats.allocmem * 4 < gcStats.totalmem * 1) {
DBG(GCSTAT,
dprintf("skipping collection since alloc/total "
@@ -630,13 +630,13 @@
" allocated %dK (#%d), marked %dK, "
"swept %dK (#%d)\n"
" %d objs (%dK) awaiting finalization>\n",
- (int)(gc_heap_total/1024),
+ (int)(gc_get_heap_total()/1024),
gcStats.totalmem/1024,
(gcStats.totalmem-gcStats.freedmem)/1024,
gcStats.totalobj,
gcStats.totalobj-gcStats.freedobj,
(1.0 - ((gcStats.totalmem-gcStats.freedmem)/
- (double)gc_heap_total)) * 100.0,
+ (double)gc_get_heap_total())) * 100.0,
gcStats.allocmem/1024,
gcStats.allocobj,
gcStats.markedmem/1024,
@@ -1059,7 +1059,7 @@
/* Grow the heap */
DBG (GCSYSALLOC, dprintf ("growing heap by %u bytes of type %s (%2.1f%% free)\n",
(unsigned int)size, gcFunctions[fidx].description,
- (1.0 - (gcStats.totalmem / (double)gc_heap_total)) * 100.0); )
+ (1.0 - (gcStats.totalmem / (double)gc_get_heap_total())) * 100.0); )
gc_heap_grow(size);
break;
@@ -1426,7 +1426,7 @@
static uintp
gcGetHeapTotal(Collector *gcif UNUSED)
{
- return gc_heap_total;
+ return gc_get_heap_total();
}
static const char *
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.11 kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.12
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.11 Fri Sep 3 10:21:06 2004
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c Fri Sep 3 11:12:37 2004
@@ -105,8 +105,8 @@
static size_t max_small_object_size;
static size_t gc_heap_allocation_size; /* amount of memory by which to grow heap */
static size_t gc_heap_initial_size; /* amount of memory to initially allocate */
+static size_t gc_heap_total; /* current size of the heap */
-size_t gc_heap_total; /* current size of the heap */
size_t gc_heap_limit; /* maximum size to which heap should grow */
uintp gc_heap_base;
uintp gc_heap_range;
@@ -1234,10 +1234,20 @@
}
/**
- * Evaluates to the gc_block that contains address @M.
+ * Evaluates to the gc_block that contains address @mem.
*
*/
gc_block *
-gc_mem2block(const void * mem) {
+gc_mem2block(const void * mem)
+{
return (KGC_BLOCKS + ( ( ((uintp) (mem)) - gc_heap_base) >> gc_pgbits));
+}
+
+/**
+ * Gets current heap size.
+ */
+size_t
+gc_get_heap_total(void)
+{
+ return gc_heap_total;
}
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.h
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.h:1.9 kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.h:1.10
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.h:1.9 Fri Sep 3 10:21:06 2004
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.h Fri Sep 3 11:12:37 2004
@@ -20,7 +20,6 @@
#define ALIGNMENT_OF_SIZE(S) (S)
#endif
-extern size_t gc_heap_total;
extern size_t gc_heap_limit;
#ifdef KAFFE_VMDEBUG
@@ -65,6 +64,7 @@
extern void gc_heap_free(void*);
extern void* gc_heap_grow(size_t);
+extern size_t gc_get_heap_total(void);
/**
* One block of the heap managed by kaffe's gc.
More information about the kaffe
mailing list