data_forwarding_map->compute_forwarding();
code_forwarding_map->compute_forwarding();
- const object* data_finger = tenured->first_block();
- const code_block* code_finger = code->allocator->first_block();
+ const object* data_finger = (object*)tenured->start;
+ const code_block* code_finger = (code_block*)code->allocator->start;
{
compaction_fixup fixup(data_forwarding_map, code_forwarding_map, &data_finger,
mark_bits* code_forwarding_map = &code->allocator->state;
code_forwarding_map->compute_forwarding();
- const code_block* code_finger = code->allocator->first_block();
+ const code_block* code_finger = (code_block*)code->allocator->start;
code_compaction_fixup fixup(code_forwarding_map, &code_finger);
slot_visitor<code_compaction_fixup> data_forwarder(this, fixup);
free_list_allocator(cell size, cell start);
void initial_free_list(cell occupied);
bool contains_p(Block* block);
- Block* first_block();
- Block* last_block();
- Block* next_block_after(Block* block);
Block* next_allocated_block_after(Block* block);
bool can_allot_p(cell size);
Block* allot(cell size);
return ((cell)block - start) < size;
}
-template <typename Block> Block* free_list_allocator<Block>::first_block() {
- return (Block*)start;
-}
-
-template <typename Block> Block* free_list_allocator<Block>::last_block() {
- return (Block*)end;
-}
-
-template <typename Block>
-Block* free_list_allocator<Block>::next_block_after(Block* block) {
- return (Block*)((cell)block + block->size());
-}
-
template <typename Block>
Block* free_list_allocator<Block>::next_allocated_block_after(Block* block) {
- while (block != this->last_block() && block->free_p()) {
+ while ((cell)block != this->end && block->free_p()) {
free_heap_block* free_block = (free_heap_block*)block;
block = (object*)((cell)free_block + free_block->size());
}
- if (block == this->last_block())
+ if ((cell)block == this->end)
return NULL;
else
return block;
void free_list_allocator<Block>::sweep(Iterator& iter) {
free_blocks.clear_free_list();
- cell start = (cell)this->first_block();
- cell end = (cell)this->last_block();
+ cell start = this->start;
+ cell end = this->end;
while (start != end) {
/* find next unmarked block */
template <typename Iterator, typename Fixup>
void free_list_allocator<Block>::compact(Iterator& iter, Fixup fixup,
const Block** finger) {
- heap_compactor<Block, Iterator> compactor(&state, first_block(), iter,
- finger);
+ heap_compactor<Block, Iterator> compactor(&state, (Block*)start, iter, finger);
iterate(compactor, fixup);
/* Now update the free list; there will be a single free block at
template <typename Block>
template <typename Iterator, typename Fixup>
void free_list_allocator<Block>::iterate(Iterator& iter, Fixup fixup) {
- Block* scan = first_block();
- Block* end = last_block();
+ Block* scan = (Block*)this->start;
+ Block* end = (Block*)this->end;
while (scan != end) {
cell size = fixup.size(scan);
if (h->code_size != 0) {
size_t bytes_read =
- safe_fread(code->allocator->first_block(), 1, h->code_size, file);
+ safe_fread((void*)code->allocator->start, 1, h->code_size, file);
if (bytes_read != h->code_size) {
std::cout << "truncated image: " << bytes_read << " bytes read, ";
std::cout << h->code_size << " bytes expected\n";
ok = false;
if (safe_fwrite((void*)data->tenured->start, h.data_size, 1, file) != 1)
ok = false;
- if (safe_fwrite(code->allocator->first_block(), h.code_size, 1, file) != 1)
+ if (safe_fwrite((void*)code->allocator->start, h.code_size, 1, file) != 1)
ok = false;
safe_fclose(file);