- 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:
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;
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;
+}
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)
{
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);
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 */
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);
clear_cards(NURSERY,TENURED);
- if(alloter != heap_start + total_size)
+ if(alloter != data_heap_start + total_size)
fatal_error("Oops",alloter);
heap_scan = false;
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.