int count = 0;
for (i = 0; i < last_free_page; i++)
- if ((page_table[i].allocated != FREE_PAGE)
+ if ((page_table[i].allocated != FREE_PAGE_FLAG)
&& (page_table[i].gen == generation)
&& (page_table[i].write_protected == 1))
count++;
/* Count the number of boxed pages within the given
* generation. */
- if (page_table[j].allocated & BOXED_PAGE) {
+ if (page_table[j].allocated & BOXED_PAGE_FLAG) {
if (page_table[j].large_object)
large_boxed_cnt++;
else
if(page_table[j].dont_move) pinned_cnt++;
/* Count the number of unboxed pages within the given
* generation. */
- if (page_table[j].allocated & UNBOXED_PAGE) {
+ if (page_table[j].allocated & UNBOXED_PAGE_FLAG) {
if (page_table[j].large_object)
large_unboxed_cnt++;
else
/* The first page may have already been in use. */
if (page_table[first_page].bytes_used == 0) {
if (unboxed)
- page_table[first_page].allocated = UNBOXED_PAGE;
+ page_table[first_page].allocated = UNBOXED_PAGE_FLAG;
else
- page_table[first_page].allocated = BOXED_PAGE;
+ page_table[first_page].allocated = BOXED_PAGE_FLAG;
page_table[first_page].gen = gc_alloc_generation;
page_table[first_page].large_object = 0;
page_table[first_page].first_object_offset = 0;
}
if (unboxed)
- gc_assert(page_table[first_page].allocated == UNBOXED_PAGE);
+ gc_assert(page_table[first_page].allocated == UNBOXED_PAGE_FLAG);
else
- gc_assert(page_table[first_page].allocated == BOXED_PAGE);
- page_table[first_page].allocated |= OPEN_REGION_PAGE;
+ gc_assert(page_table[first_page].allocated == BOXED_PAGE_FLAG);
+ page_table[first_page].allocated |= OPEN_REGION_PAGE_FLAG;
gc_assert(page_table[first_page].gen == gc_alloc_generation);
gc_assert(page_table[first_page].large_object == 0);
for (i = first_page+1; i <= last_page; i++) {
if (unboxed)
- page_table[i].allocated = UNBOXED_PAGE;
+ page_table[i].allocated = UNBOXED_PAGE_FLAG;
else
- page_table[i].allocated = BOXED_PAGE;
+ page_table[i].allocated = BOXED_PAGE_FLAG;
page_table[i].gen = gc_alloc_generation;
page_table[i].large_object = 0;
/* This may not be necessary for unboxed regions (think it was
* broken before!) */
page_table[i].first_object_offset =
alloc_region->start_addr - page_address(i);
- page_table[i].allocated |= OPEN_REGION_PAGE ;
+ page_table[i].allocated |= OPEN_REGION_PAGE_FLAG ;
}
/* Bump up last_free_page. */
if (last_page+1 > last_free_page) {
* first_object_offset. */
if (page_table[first_page].bytes_used == 0)
gc_assert(page_table[first_page].first_object_offset == 0);
- page_table[first_page].allocated &= ~(OPEN_REGION_PAGE);
+ page_table[first_page].allocated &= ~(OPEN_REGION_PAGE_FLAG);
if (unboxed)
- gc_assert(page_table[first_page].allocated == UNBOXED_PAGE);
+ gc_assert(page_table[first_page].allocated == UNBOXED_PAGE_FLAG);
else
- gc_assert(page_table[first_page].allocated == BOXED_PAGE);
+ gc_assert(page_table[first_page].allocated == BOXED_PAGE_FLAG);
gc_assert(page_table[first_page].gen == gc_alloc_generation);
gc_assert(page_table[first_page].large_object == 0);
* first_object_offset pointer to the start of the region, and set
* the bytes_used. */
while (more) {
- page_table[next_page].allocated &= ~(OPEN_REGION_PAGE);
+ page_table[next_page].allocated &= ~(OPEN_REGION_PAGE_FLAG);
if (unboxed)
- gc_assert(page_table[next_page].allocated == UNBOXED_PAGE);
+ gc_assert(page_table[next_page].allocated==UNBOXED_PAGE_FLAG);
else
- gc_assert(page_table[next_page].allocated == BOXED_PAGE);
+ gc_assert(page_table[next_page].allocated == BOXED_PAGE_FLAG);
gc_assert(page_table[next_page].bytes_used == 0);
gc_assert(page_table[next_page].gen == gc_alloc_generation);
gc_assert(page_table[next_page].large_object == 0);
} else {
/* There are no bytes allocated. Unallocate the first_page if
* there are 0 bytes_used. */
- page_table[first_page].allocated &= ~(OPEN_REGION_PAGE);
+ page_table[first_page].allocated &= ~(OPEN_REGION_PAGE_FLAG);
if (page_table[first_page].bytes_used == 0)
- page_table[first_page].allocated = FREE_PAGE;
+ page_table[first_page].allocated = FREE_PAGE_FLAG;
}
/* Unallocate any unused pages. */
while (next_page <= alloc_region->last_page) {
gc_assert(page_table[next_page].bytes_used == 0);
- page_table[next_page].allocated = FREE_PAGE;
+ page_table[next_page].allocated = FREE_PAGE_FLAG;
next_page++;
}
release_spinlock(&free_pages_lock);
* first_object_offset. */
if (page_table[first_page].bytes_used == 0) {
if (unboxed)
- page_table[first_page].allocated = UNBOXED_PAGE;
+ page_table[first_page].allocated = UNBOXED_PAGE_FLAG;
else
- page_table[first_page].allocated = BOXED_PAGE;
+ page_table[first_page].allocated = BOXED_PAGE_FLAG;
page_table[first_page].gen = gc_alloc_generation;
page_table[first_page].first_object_offset = 0;
page_table[first_page].large_object = 1;
}
if (unboxed)
- gc_assert(page_table[first_page].allocated == UNBOXED_PAGE);
+ gc_assert(page_table[first_page].allocated == UNBOXED_PAGE_FLAG);
else
- gc_assert(page_table[first_page].allocated == BOXED_PAGE);
+ gc_assert(page_table[first_page].allocated == BOXED_PAGE_FLAG);
gc_assert(page_table[first_page].gen == gc_alloc_generation);
gc_assert(page_table[first_page].large_object == 1);
* first_object_offset pointer to the start of the region, and
* set the bytes_used. */
while (more) {
- gc_assert(page_table[next_page].allocated == FREE_PAGE);
+ gc_assert(page_table[next_page].allocated == FREE_PAGE_FLAG);
gc_assert(page_table[next_page].bytes_used == 0);
if (unboxed)
- page_table[next_page].allocated = UNBOXED_PAGE;
+ page_table[next_page].allocated = UNBOXED_PAGE_FLAG;
else
- page_table[next_page].allocated = BOXED_PAGE;
+ page_table[next_page].allocated = BOXED_PAGE_FLAG;
page_table[next_page].gen = gc_alloc_generation;
page_table[next_page].large_object = 1;
first_page = restart_page;
if (large_p)
while ((first_page < NUM_PAGES)
- && (page_table[first_page].allocated != FREE_PAGE))
+ && (page_table[first_page].allocated != FREE_PAGE_FLAG))
first_page++;
else
while (first_page < NUM_PAGES) {
- if(page_table[first_page].allocated == FREE_PAGE)
+ if(page_table[first_page].allocated == FREE_PAGE_FLAG)
break;
if((page_table[first_page].allocated ==
- (unboxed ? UNBOXED_PAGE : BOXED_PAGE)) &&
+ (unboxed ? UNBOXED_PAGE_FLAG : BOXED_PAGE_FLAG)) &&
(page_table[first_page].large_object == 0) &&
(page_table[first_page].gen == gc_alloc_generation) &&
(page_table[first_page].bytes_used < (PAGE_BYTES-32)) &&
while (((bytes_found < nbytes)
|| (!large_p && (num_pages < 2)))
&& (last_page < (NUM_PAGES-1))
- && (page_table[last_page+1].allocated == FREE_PAGE)) {
+ && (page_table[last_page+1].allocated == FREE_PAGE_FLAG)) {
last_page++;
num_pages++;
bytes_found += PAGE_BYTES;
remaining_bytes = nwords*4;
while (remaining_bytes > PAGE_BYTES) {
gc_assert(page_table[next_page].gen == from_space);
- gc_assert(page_table[next_page].allocated == BOXED_PAGE);
+ gc_assert(page_table[next_page].allocated == BOXED_PAGE_FLAG);
gc_assert(page_table[next_page].large_object);
gc_assert(page_table[next_page].first_object_offset==
-PAGE_BYTES*(next_page-first_page));
gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
page_table[next_page].gen = new_space;
- gc_assert(page_table[next_page].allocated == BOXED_PAGE);
+ gc_assert(page_table[next_page].allocated == BOXED_PAGE_FLAG);
/* Adjust the bytes_used. */
old_bytes_used = page_table[next_page].bytes_used;
next_page++;
while ((old_bytes_used == PAGE_BYTES) &&
(page_table[next_page].gen == from_space) &&
- (page_table[next_page].allocated == BOXED_PAGE) &&
+ (page_table[next_page].allocated == BOXED_PAGE_FLAG) &&
page_table[next_page].large_object &&
(page_table[next_page].first_object_offset ==
-(next_page - first_page)*PAGE_BYTES)) {
gc_assert(page_table[next_page].write_protected == 0);
old_bytes_used = page_table[next_page].bytes_used;
- page_table[next_page].allocated = FREE_PAGE;
+ page_table[next_page].allocated = FREE_PAGE_FLAG;
page_table[next_page].bytes_used = 0;
bytes_freed += old_bytes_used;
next_page++;
remaining_bytes = nwords*4;
while (remaining_bytes > PAGE_BYTES) {
gc_assert(page_table[next_page].gen == from_space);
- gc_assert((page_table[next_page].allocated == UNBOXED_PAGE)
- || (page_table[next_page].allocated == BOXED_PAGE));
+ gc_assert((page_table[next_page].allocated == UNBOXED_PAGE_FLAG)
+ || (page_table[next_page].allocated == BOXED_PAGE_FLAG));
gc_assert(page_table[next_page].large_object);
gc_assert(page_table[next_page].first_object_offset==
-PAGE_BYTES*(next_page-first_page));
gc_assert(page_table[next_page].bytes_used == PAGE_BYTES);
page_table[next_page].gen = new_space;
- page_table[next_page].allocated = UNBOXED_PAGE;
+ page_table[next_page].allocated = UNBOXED_PAGE_FLAG;
remaining_bytes -= PAGE_BYTES;
next_page++;
}
gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
page_table[next_page].gen = new_space;
- page_table[next_page].allocated = UNBOXED_PAGE;
+ page_table[next_page].allocated = UNBOXED_PAGE_FLAG;
/* Adjust the bytes_used. */
old_bytes_used = page_table[next_page].bytes_used;
next_page++;
while ((old_bytes_used == PAGE_BYTES) &&
(page_table[next_page].gen == from_space) &&
- ((page_table[next_page].allocated == UNBOXED_PAGE)
- || (page_table[next_page].allocated == BOXED_PAGE)) &&
+ ((page_table[next_page].allocated == UNBOXED_PAGE_FLAG)
+ || (page_table[next_page].allocated == BOXED_PAGE_FLAG)) &&
page_table[next_page].large_object &&
(page_table[next_page].first_object_offset ==
-(next_page - first_page)*PAGE_BYTES)) {
gc_assert(page_table[next_page].write_protected == 0);
old_bytes_used = page_table[next_page].bytes_used;
- page_table[next_page].allocated = FREE_PAGE;
+ page_table[next_page].allocated = FREE_PAGE_FLAG;
page_table[next_page].bytes_used = 0;
bytes_freed += old_bytes_used;
next_page++;
lispobj *start;
/* The address may be invalid, so do some checks. */
- if ((page_index == -1) || (page_table[page_index].allocated == FREE_PAGE))
+ if ((page_index == -1) ||
+ (page_table[page_index].allocated == FREE_PAGE_FLAG))
return NULL;
start = (lispobj *)((void *)page_address(page_index)
+ page_table[page_index].first_object_offset);
/* Check whether it's a vector or bignum object. */
switch (widetag_of(where[0])) {
case SIMPLE_VECTOR_WIDETAG:
- boxed = BOXED_PAGE;
+ boxed = BOXED_PAGE_FLAG;
break;
case BIGNUM_WIDETAG:
case SIMPLE_BASE_STRING_WIDETAG:
#ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
case SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG:
#endif
- boxed = UNBOXED_PAGE;
+ boxed = UNBOXED_PAGE_FLAG;
break;
default:
return;
remaining_bytes = nwords*4;
while (remaining_bytes > PAGE_BYTES) {
gc_assert(page_table[next_page].gen == from_space);
- gc_assert((page_table[next_page].allocated == BOXED_PAGE)
- || (page_table[next_page].allocated == UNBOXED_PAGE));
+ gc_assert((page_table[next_page].allocated == BOXED_PAGE_FLAG)
+ || (page_table[next_page].allocated == UNBOXED_PAGE_FLAG));
gc_assert(page_table[next_page].large_object);
gc_assert(page_table[next_page].first_object_offset ==
-PAGE_BYTES*(next_page-first_page));
next_page++;
while ((old_bytes_used == PAGE_BYTES) &&
(page_table[next_page].gen == from_space) &&
- ((page_table[next_page].allocated == UNBOXED_PAGE)
- || (page_table[next_page].allocated == BOXED_PAGE)) &&
+ ((page_table[next_page].allocated == UNBOXED_PAGE_FLAG)
+ || (page_table[next_page].allocated == BOXED_PAGE_FLAG)) &&
page_table[next_page].large_object &&
(page_table[next_page].first_object_offset ==
-(next_page - first_page)*PAGE_BYTES)) {
gc_assert(page_table[next_page].write_protected == 0);
old_bytes_used = page_table[next_page].bytes_used;
- page_table[next_page].allocated = FREE_PAGE;
+ page_table[next_page].allocated = FREE_PAGE_FLAG;
page_table[next_page].bytes_used = 0;
bytes_freed += old_bytes_used;
next_page++;
/* quick check 1: Address is quite likely to have been invalid. */
if ((addr_page_index == -1)
- || (page_table[addr_page_index].allocated == FREE_PAGE)
+ || (page_table[addr_page_index].allocated == FREE_PAGE_FLAG)
|| (page_table[addr_page_index].bytes_used == 0)
|| (page_table[addr_page_index].gen != from_space)
/* Skip if already marked dont_move. */
|| (page_table[addr_page_index].dont_move != 0))
return;
- gc_assert(!(page_table[addr_page_index].allocated & OPEN_REGION_PAGE));
+ gc_assert(!(page_table[addr_page_index].allocated&OPEN_REGION_PAGE_FLAG));
/* (Now that we know that addr_page_index is in range, it's
* safe to index into page_table[] with it.) */
region_allocation = page_table[addr_page_index].allocated;
* free area in which case it's ignored here. Note it gets
* through the valid pointer test above because the tail looks
* like conses. */
- if ((page_table[addr_page_index].allocated == FREE_PAGE)
+ if ((page_table[addr_page_index].allocated == FREE_PAGE_FLAG)
|| (page_table[addr_page_index].bytes_used == 0)
/* Check the offset within the page. */
|| (((unsigned)addr & (PAGE_BYTES - 1))
/* Check whether this is the last page in this contiguous block.. */
if ((page_table[i].bytes_used < PAGE_BYTES)
/* ..or it is PAGE_BYTES and is the last in the block */
- || (page_table[i+1].allocated == FREE_PAGE)
+ || (page_table[i+1].allocated == FREE_PAGE_FLAG)
|| (page_table[i+1].bytes_used == 0) /* next page free */
|| (page_table[i+1].gen != from_space) /* diff. gen */
|| (page_table[i+1].first_object_offset == 0))
int num_words = page_table[page].bytes_used / 4;
/* Shouldn't be a free page. */
- gc_assert(page_table[page].allocated != FREE_PAGE);
+ gc_assert(page_table[page].allocated != FREE_PAGE_FLAG);
gc_assert(page_table[page].bytes_used != 0);
/* Skip if it's already write-protected, pinned, or unboxed */
if (page_table[page].write_protected
|| page_table[page].dont_move
- || (page_table[page].allocated & UNBOXED_PAGE))
+ || (page_table[page].allocated & UNBOXED_PAGE_FLAG))
return (0);
/* Scan the page for pointers to younger generations or the
/* Check that it's in the dynamic space */
if (index != -1)
if (/* Does it point to a younger or the temp. generation? */
- ((page_table[index].allocated != FREE_PAGE)
+ ((page_table[index].allocated != FREE_PAGE_FLAG)
&& (page_table[index].bytes_used != 0)
&& ((page_table[index].gen < gen)
|| (page_table[index].gen == NUM_GENERATIONS)))
#endif
for (i = 0; i < last_free_page; i++) {
- if ((page_table[i].allocated & BOXED_PAGE)
+ if ((page_table[i].allocated & BOXED_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == generation)) {
int last_page,j;
write_protected && page_table[last_page].write_protected;
if ((page_table[last_page].bytes_used < PAGE_BYTES)
/* Or it is PAGE_BYTES and is the last in the block */
- || (!(page_table[last_page+1].allocated & BOXED_PAGE))
+ || (!(page_table[last_page+1].allocated & BOXED_PAGE_FLAG))
|| (page_table[last_page+1].bytes_used == 0)
|| (page_table[last_page+1].gen != generation)
|| (page_table[last_page+1].first_object_offset == 0))
/* Check that none of the write_protected pages in this generation
* have been written to. */
for (i = 0; i < NUM_PAGES; i++) {
- if ((page_table[i].allocation ! =FREE_PAGE)
+ if ((page_table[i].allocation != FREE_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == generation)
&& (page_table[i].write_protected_cleared != 0)) {
generation));
for (i = 0; i < last_free_page; i++) {
/* Note that this skips over open regions when it encounters them. */
- if ((page_table[i].allocated & BOXED_PAGE)
+ if ((page_table[i].allocated & BOXED_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == generation)
&& ((page_table[i].write_protected == 0)
* contiguous block */
if ((page_table[last_page].bytes_used < PAGE_BYTES)
/* Or it is PAGE_BYTES and is the last in the block */
- || (!(page_table[last_page+1].allocated & BOXED_PAGE))
+ || (!(page_table[last_page+1].allocated & BOXED_PAGE_FLAG))
|| (page_table[last_page+1].bytes_used == 0)
|| (page_table[last_page+1].gen != generation)
|| (page_table[last_page+1].first_object_offset == 0))
/* Check that none of the write_protected pages in this generation
* have been written to. */
for (i = 0; i < NUM_PAGES; i++) {
- if ((page_table[i].allocation != FREE_PAGE)
+ if ((page_table[i].allocation != FREE_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == generation)
&& (page_table[i].write_protected_cleared != 0)
int i;
for (i = 0; i < last_free_page; i++) {
- if ((page_table[i].allocated != FREE_PAGE)
+ if ((page_table[i].allocated != FREE_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == from_space)) {
void *page_start;
do {
/* Find a first page for the next region of pages. */
while ((first_page < last_free_page)
- && ((page_table[first_page].allocated == FREE_PAGE)
+ && ((page_table[first_page].allocated == FREE_PAGE_FLAG)
|| (page_table[first_page].bytes_used == 0)
|| (page_table[first_page].gen != from_space)))
first_page++;
bytes_freed += page_table[last_page].bytes_used;
generations[page_table[last_page].gen].bytes_allocated -=
page_table[last_page].bytes_used;
- page_table[last_page].allocated = FREE_PAGE;
+ page_table[last_page].allocated = FREE_PAGE_FLAG;
page_table[last_page].bytes_used = 0;
/* Remove any write-protection. We should be able to rely
last_page++;
}
while ((last_page < last_free_page)
- && (page_table[last_page].allocated != FREE_PAGE)
+ && (page_table[last_page].allocated != FREE_PAGE_FLAG)
&& (page_table[last_page].bytes_used != 0)
&& (page_table[last_page].gen == from_space));
if (page_index != -1) {
/* If it's within the dynamic space it should point to a used
* page. XX Could check the offset too. */
- if ((page_table[page_index].allocated != FREE_PAGE)
+ if ((page_table[page_index].allocated != FREE_PAGE_FLAG)
&& (page_table[page_index].bytes_used == 0))
lose ("Ptr %x @ %x sees free page.", thing, start);
/* Check that it doesn't point to a forwarding pointer! */
int i;
for (i = 0; i < last_free_page; i++) {
- if ((page_table[i].allocated != FREE_PAGE)
+ if ((page_table[i].allocated != FREE_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& (page_table[i].gen == generation)) {
int last_page;
int page;
for (page = 0; page < last_free_page; page++) {
- if (page_table[page].allocated == FREE_PAGE) {
+ if (page_table[page].allocated == FREE_PAGE_FLAG) {
/* The whole page should be zero filled. */
int *start_addr = (int *)page_address(page);
int size = 1024;
gc_assert(generation < NUM_GENERATIONS);
for (i = 0; i < last_free_page; i++)
- if ((page_table[i].allocated == BOXED_PAGE)
+ if ((page_table[i].allocated == BOXED_PAGE_FLAG)
&& (page_table[i].bytes_used != 0)
&& !page_table[i].dont_move
&& (page_table[i].gen == generation)) {
int i;
for (i = 0; i < NUM_PAGES; i++)
- if ((page_table[i].allocated != FREE_PAGE)
+ if ((page_table[i].allocated != FREE_PAGE_FLAG)
&& (page_table[i].bytes_used != 0))
last_page = i;
for (page = 0; page < NUM_PAGES; page++) {
/* Skip free pages which should already be zero filled. */
- if (page_table[page].allocated != FREE_PAGE) {
+ if (page_table[page].allocated != FREE_PAGE_FLAG) {
void *page_start, *addr;
/* Mark the page free. The other slots are assumed invalid
- * when it is a FREE_PAGE and bytes_used is 0 and it
+ * when it is a FREE_PAGE_FLAG and bytes_used is 0 and it
* should not be write-protected -- except that the
* generation is used for the current region but it sets
* that up. */
- page_table[page].allocated = FREE_PAGE;
+ page_table[page].allocated = FREE_PAGE_FLAG;
page_table[page].bytes_used = 0;
/* Zero the page. */
} else if (gencgc_zero_check_during_free_heap) {
/* Double-check that the page is zero filled. */
int *page_start, i;
- gc_assert(page_table[page].allocated == FREE_PAGE);
+ gc_assert(page_table[page].allocated == FREE_PAGE_FLAG);
gc_assert(page_table[page].bytes_used == 0);
page_start = (int *)page_address(page);
for (i=0; i<1024; i++) {
/* Initialize each page structure. */
for (i = 0; i < NUM_PAGES; i++) {
/* Initialize all pages as free. */
- page_table[i].allocated = FREE_PAGE;
+ page_table[i].allocated = FREE_PAGE_FLAG;
page_table[i].bytes_used = 0;
/* Pages are not write-protected at startup. */
do {
lispobj *first,*ptr= (lispobj *)page_address(page);
- page_table[page].allocated = BOXED_PAGE;
+ page_table[page].allocated = BOXED_PAGE_FLAG;
page_table[page].gen = 0;
page_table[page].bytes_used = PAGE_BYTES;
page_table[page].large_object = 0;