summaryrefslogtreecommitdiff
path: root/reclaim.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 18:18:03 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 18:18:03 +0200
commit64040040407b11d8740516fad2438109e7f22c02 (patch)
tree6d18a075ceb6f63855730afe630e50b0afa7ed32 /reclaim.c
parente35a4171fe47dfbf847e08988ea6cec4dfc8d124 (diff)
gc7.0alpha2 tarball importgc7_0alpha2
Diffstat (limited to 'reclaim.c')
-rw-r--r--reclaim.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/reclaim.c b/reclaim.c
index 279b75b..6cb8b47 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -332,13 +332,14 @@ int GC_n_set_marks(hdr *hhdr)
{
int result = 0;
int i;
- int n_objs = HBLK_OBJS(hhdr -> hb_sz);
-
- if (0 == n_objs) n_objs = 1;
- for (i = 0; i < n_objs; i++) {
+ size_t sz = hhdr -> hb_sz;
+ int offset = MARK_BIT_OFFSET(sz);
+ int limit = FINAL_MARK_BIT(sz);
+
+ for (i = 0; i < limit; i += offset) {
result += hhdr -> hb_marks[i];
}
- GC_ASSERT(hhdr -> hb_marks[n_objs]);
+ GC_ASSERT(hhdr -> hb_marks[limit]);
return(result);
}
@@ -362,16 +363,24 @@ int GC_n_set_marks(hdr *hhdr)
{
int result = 0;
int i;
- int n_objs = HBLK_OBJS(hhdr -> hb_sz);
int n_mark_words;
+# ifdef MARK_BIT_PER_OBJ
+ int n_objs = HBLK_OBJS(hhdr -> hb_sz);
- if (0 == n_objs) n_objs = 1;
- n_mark_words = divWORDSZ(n_objs + WORDSZ - 1);
+ if (0 == n_objs) n_objs = 1;
+ n_mark_words = divWORDSZ(n_objs + WORDSZ - 1);
+# else /* MARK_BIT_PER_GRANULE */
+ n_mark_words = MARK_BITS_SZ;
+# endif
for (i = 0; i < n_mark_words - 1; i++) {
result += set_bits(hhdr -> hb_marks[i]);
}
- result += set_bits((hhdr -> hb_marks[n_mark_words])
- << (n_mark_words * WORDSZ - n_objs));
+# ifdef MARK_BIT_PER_OBJ
+ result += set_bits((hhdr -> hb_marks[n_mark_words - 1])
+ << (n_mark_words * WORDSZ - n_objs));
+# else
+ result += set_bits(hhdr -> hb_marks[n_mark_words - 1]);
+# endif
return(result - 1);
}
@@ -405,7 +414,7 @@ void GC_print_block_list()
{
struct Print_stats pstats;
- GC_printf("(kind(0=ptrfree,1=normal,2=unc.,3=stubborn):size_in_bytes, #_marks_set)\n");
+ GC_printf("(kind(0=ptrfree,1=normal,2=unc.):size_in_bytes, #_marks_set)\n");
pstats.number_of_blocks = 0;
pstats.total_bytes = 0;
GC_apply_to_all_blocks(GC_print_block_descr, (word)&pstats);