Image save doesn't write the large free block at the end
parent
003d7cc91b
commit
f55cfd918a
|
@ -4,8 +4,7 @@
|
|||
- test alien-indirect
|
||||
- code GC:
|
||||
- discard the free block at the end of the code heap on save
|
||||
- minor GC takes too long now
|
||||
- icache slowdown
|
||||
- minor GC takes too long now, card mark
|
||||
|
||||
+ ui:
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void dump_cell(CELL cell)
|
|||
fprintf(stderr," -- F");
|
||||
else if(cell < TYPE_COUNT<<TAG_BITS)
|
||||
fprintf(stderr," -- header: %ld",cell>>TAG_BITS);
|
||||
else if(cell >= heap_start && cell < heap_end)
|
||||
else if(cell >= data_heap_start && cell < data_heap_end)
|
||||
{
|
||||
CELL header = get(UNTAG(cell));
|
||||
CELL type = header>>TAG_BITS;
|
||||
|
|
|
@ -147,3 +147,12 @@ CELL heap_free_space(HEAP *heap)
|
|||
|
||||
return size;
|
||||
}
|
||||
|
||||
CELL heap_size(HEAP *heap)
|
||||
{
|
||||
CELL start = heap->base;
|
||||
F_BLOCK *scan = (F_BLOCK *)start;
|
||||
while(next_block(heap,scan))
|
||||
scan = next_block(heap,scan);
|
||||
return (CELL)scan - (CELL)start;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ void build_free_list(HEAP *heap, CELL size);
|
|||
CELL heap_allot(HEAP *heap, CELL size);
|
||||
void free_unmarked(HEAP *heap);
|
||||
CELL heap_free_space(HEAP *heap);
|
||||
CELL heap_size(HEAP *heap);
|
||||
|
||||
INLINE F_BLOCK *next_block(HEAP *heap, F_BLOCK *block)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ bool save_image(const char* filename)
|
|||
h.bignum_zero = bignum_zero;
|
||||
h.bignum_pos_one = bignum_pos_one;
|
||||
h.bignum_neg_one = bignum_neg_one;
|
||||
h.code_size = compiling.limit - compiling.base;
|
||||
h.code_size = heap_size(&compiling);
|
||||
h.code_relocation_base = compiling.base;
|
||||
fwrite(&h,sizeof(HEADER),1,file);
|
||||
|
||||
|
|
10
vm/memory.c
10
vm/memory.c
|
@ -293,7 +293,7 @@ we need to save its contents and re-initialize it when entering a callback,
|
|||
and restore its contents when leaving the callback. see stack.c */
|
||||
void update_cards_offset(void)
|
||||
{
|
||||
cards_offset = (CELL)cards - (heap_start >> CARD_BITS);
|
||||
cards_offset = (CELL)cards - (data_heap_start >> CARD_BITS);
|
||||
}
|
||||
|
||||
/* input parameters must be 8 byte aligned */
|
||||
|
@ -316,14 +316,14 @@ void init_arena(CELL gens, CELL young_size, CELL aging_size)
|
|||
gen_count = gens;
|
||||
generations = safe_malloc(sizeof(ZONE) * gen_count);
|
||||
|
||||
heap_start = (CELL)(alloc_bounded_block(total_size)->start);
|
||||
heap_end = heap_start + total_size;
|
||||
data_heap_start = (CELL)(alloc_bounded_block(total_size)->start);
|
||||
data_heap_end = data_heap_start + total_size;
|
||||
|
||||
cards = safe_malloc(cards_size);
|
||||
cards_end = cards + cards_size;
|
||||
update_cards_offset();
|
||||
|
||||
alloter = heap_start;
|
||||
alloter = data_heap_start;
|
||||
|
||||
alloter = init_zone(&tenured,aging_size,alloter);
|
||||
alloter = init_zone(&prior,aging_size,alloter);
|
||||
|
@ -333,7 +333,7 @@ void init_arena(CELL gens, CELL young_size, CELL aging_size)
|
|||
|
||||
clear_cards(NURSERY,TENURED);
|
||||
|
||||
if(alloter != heap_start + total_size)
|
||||
if(alloter != data_heap_start + total_size)
|
||||
fatal_error("Oops",alloter);
|
||||
|
||||
heap_scan = false;
|
||||
|
|
|
@ -101,8 +101,8 @@ void primitive_begin_scan(void);
|
|||
void primitive_next_object(void);
|
||||
void primitive_end_scan(void);
|
||||
|
||||
CELL heap_start;
|
||||
CELL heap_end;
|
||||
CELL data_heap_start;
|
||||
CELL data_heap_end;
|
||||
|
||||
/* card marking write barrier. a card is a byte storing a mark flag,
|
||||
and the offset (in cells) of the first object in the card.
|
||||
|
|
Loading…
Reference in New Issue