31 |
#include <string.h> |
#include <string.h> |
32 |
#include <stdlib.h> |
#include <stdlib.h> |
33 |
#include "include.h" |
#include "include.h" |
34 |
|
#include "page.h" |
35 |
|
|
36 |
|
|
37 |
#ifdef SGC |
#ifdef SGC |
67 |
*/ |
*/ |
68 |
#define BBITS_CHAR 3 |
#define BBITS_CHAR 3 |
69 |
|
|
70 |
#if SIZEOF_LONG_P == 4 |
#if SIZEOF_LONG == 4 |
71 |
#define BBYTES_LONG 2 |
#define BBYTES_LONG 2 |
72 |
#elif SIZEOF_LONG_P == 8 |
#elif SIZEOF_LONG == 8 |
73 |
#define BBYTES_LONG 3 |
#define BBYTES_LONG 3 |
74 |
#else |
#else |
75 |
#error Do not recognize SIZEOF_LONG_P |
#error Do not recognize SIZEOF_LONG |
76 |
|
#endif |
77 |
|
|
78 |
|
#if CPTR_ALIGN == 8 |
79 |
|
#define BBYTES_CONTBLOCK 3 |
80 |
|
#elif CPTR_ALIGN == 16 |
81 |
|
#define BBYTES_CONTBLOCK 4 |
82 |
|
#else |
83 |
|
#error Do not recognize CPTR_ALIGN |
84 |
#endif |
#endif |
85 |
|
|
86 |
#define BBITS_LONG (BBYTES_LONG+BBITS_CHAR) |
#define BBITS_LONG (BBYTES_LONG+BBITS_CHAR) |
87 |
#define BCHARS_TABLE (BBITS_LONG+BBYTES_LONG) |
#define BCHARS_TABLE (BBITS_LONG+BBYTES_CONTBLOCK) |
88 |
|
|
89 |
#define Shamt(x) (((((unsigned long) x) >> BBYTES_LONG) & ~(~0 << BBITS_LONG))) |
#define Shamt(x) (((((unsigned long) x) >> BBYTES_CONTBLOCK) & ~(~0 << BBITS_LONG))) |
90 |
#define Madr(x) (mark_table+((((unsigned long) x) - ((unsigned long)DBEGIN)) >> (BCHARS_TABLE))) |
#define Madr(x) (mark_table+((((unsigned long) x) - ((unsigned long)DBEGIN)) >> (BCHARS_TABLE))) |
91 |
#define get_mark_bit(x) (*(Madr(x)) >> Shamt(x) & 1) |
#define get_mark_bit(x) (*(Madr(x)) >> Shamt(x) & 1) |
92 |
#define set_mark_bit(x) ((*(Madr(x))) |= ((unsigned long)1 << Shamt(x))) |
#define set_mark_bit(x) ((*(Madr(x))) |= ((unsigned long)1 << Shamt(x))) |
113 |
|
|
114 |
static char *copy_relblock(char *p, int s); |
static char *copy_relblock(char *p, int s); |
115 |
|
|
|
#include "page.h" |
|
116 |
|
|
117 |
extern bool saving_system; |
extern bool saving_system; |
118 |
extern long real_maxpage; |
extern long real_maxpage; |
170 |
} mark_origin_block[MARK_ORIGIN_BLOCK_MAX]; |
} mark_origin_block[MARK_ORIGIN_BLOCK_MAX]; |
171 |
int mark_origin_block_max; |
int mark_origin_block_max; |
172 |
|
|
173 |
|
/* must be a long * to match with SIZEOF_LONG usage above*/ |
174 |
long *mark_table; |
long *mark_table; |
175 |
|
|
176 |
enum type what_to_collect; |
enum type what_to_collect; |
1104 |
maxpage = page(heap_end); |
maxpage = page(heap_end); |
1105 |
|
|
1106 |
if ((int)t >= (int)t_contiguous) { |
if ((int)t >= (int)t_contiguous) { |
1107 |
j = maxpage*(PAGESIZE/(sizeof(int)*sizeof(int)*CHAR_SIZE)) ; |
j = maxpage*(PAGESIZE/(CPTR_ALIGN*SIZEOF_LONG*CHAR_SIZE)) ; |
1108 |
/* |
/* |
1109 |
(PAGESIZE / sizeof(int)) = x * (sizeof(int)*CHAR_SIZE) |
(PAGESIZE / sizeof(int)) = x * (sizeof(int)*CHAR_SIZE) |
1110 |
eg if PAGESIZE = 2048 x=16 |
eg if PAGESIZE = 2048 x=16 |
1424 |
mark_contblock(void *p, int s) { |
mark_contblock(void *p, int s) { |
1425 |
|
|
1426 |
STATIC char *q; |
STATIC char *q; |
1427 |
STATIC int *x, *y; |
STATIC char *x, *y; |
1428 |
|
|
1429 |
if (!MAYBE_DATA_P(p) || (enum type)type_map[page(p)] != t_contiguous) |
if (!MAYBE_DATA_P(p) || (enum type)type_map[page(p)] != t_contiguous) |
1430 |
return; |
return; |
1431 |
q = p + s; |
q = p + s; |
1432 |
/* SGC cont pages: contblock pages must be no smaller than |
/* SGC cont pages: contblock pages must be no smaller than |
1433 |
sizeof(struct contblock). CM 20030827 */ |
sizeof(struct contblock). CM 20030827 */ |
1434 |
x = (int *)ROUND_DOWN_PTR_CONT(p); |
x = (char *)ROUND_DOWN_PTR_CONT(p); |
1435 |
y = (int *)ROUND_UP_PTR_CONT(q); |
y = (char *)ROUND_UP_PTR_CONT(q); |
1436 |
for (; x < y; x++) |
for (; x < y; x+=CPTR_ALIGN) |
1437 |
set_mark_bit(x); |
set_mark_bit(x); |
1438 |
} |
} |
1439 |
|
|