Go to the documentation of this file.00001
00002
00003
00004
00005 #include <stdio.h>
00006 #include "external_markbits.h"
00007 #include "rgc_utils.h"
00008
00009 #define bit_table_error(str)
00010
00011 unsigned int hmin, hmax;
00012 static char *bit_table;
00013 unsigned int mingcheap, maxgcheap;
00014
00015 void set_heap_range(unsigned int min, unsigned int max)
00016 {
00017 if(mingcheap == 0 || min < mingcheap) mingcheap = min;
00018 if(maxgcheap == 0 || max > maxgcheap) maxgcheap = max;
00019 }
00020
00021 void allocate_bit_table()
00022 {
00023 int size;
00024
00025 ASSERT(mingcheap != maxgcheap);
00026
00027 size = (maxgcheap-mingcheap+3)>>2;
00028
00029 hmin = mingcheap;
00030 hmax = mingcheap + (size<<2);
00031
00032 bit_table = (char *)malloc(size);
00033
00034 ASSERT(bit_table);
00035 }
00036
00037 __inline__ void set_bit(unsigned int addr)
00038 {
00039 ASSERT(hmin <= addr && addr < hmax);
00040
00041
00042
00043
00044
00045
00046 bit_table[(addr - hmin) >> 2] = 1;
00047 }
00048
00049 __inline__ char read_bit(unsigned int addr)
00050 {
00051 ASSERT(hmin <= addr && addr < hmax);
00052
00053
00054
00055
00056
00057
00058
00059 return bit_table[(addr - hmin) >> 2];
00060 }
00061
00062
00063
00064
00065
00066
00067 void clear_bit_table()
00068 {
00069 memset(&bit_table[0], 0, (hmax-hmin+3)>>2);
00070 }
00071
00072 void print_bit_table()
00073 {
00074 int i, size, prod;
00075 size = (hmax-hmin+3)>>2;
00076 prod = 0;
00077 DPRINT2("bit-table size=%d", size);
00078 for(i = 0; i < size; i++){
00079 if(!(i&0xff)){
00080 fprintf(stderr, "%d", prod);
00081 prod = 0;
00082 }
00083 prod |= bit_table[i];
00084 if(!(i%(80*256))) fprintf(stderr, "\n");
00085 }
00086 }