diff --git a/core/compiler/constants/constants.factor b/core/compiler/constants/constants.factor index 9594cf7b23..8610f490ec 100755 --- a/core/compiler/constants/constants.factor +++ b/core/compiler/constants/constants.factor @@ -4,8 +4,8 @@ USING: math kernel layouts system ; IN: compiler.constants ! These constants must match vm/memory.h -: card-bits 6 ; -: deck-bits 12 ; +: card-bits 8 ; +: deck-bits 18 ; : card-mark HEX: 40 HEX: 80 bitor ; ! These constants must match vm/layouts.h diff --git a/vm/data_gc.c b/vm/data_gc.c index f44b8a7a05..c12c65aaff 100755 --- a/vm/data_gc.c +++ b/vm/data_gc.c @@ -59,6 +59,8 @@ F_DATA_HEAP *alloc_data_heap(CELL gens, return NULL; /* can't happen */ } + total_size += DECK_SIZE; + data_heap->segment = alloc_segment(total_size); data_heap->generations = safe_malloc(sizeof(F_ZONE) * data_heap->gen_count); @@ -75,7 +77,7 @@ F_DATA_HEAP *alloc_data_heap(CELL gens, data_heap->decks = safe_malloc(decks_size); data_heap->decks_end = data_heap->decks + decks_size; - CELL alloter = data_heap->segment->start; + CELL alloter = (data_heap->segment->start + DECK_SIZE - 1) & ~(DECK_SIZE - 1); alloter = init_zone(&data_heap->generations[TENURED],tenured_size,alloter); alloter = init_zone(&data_heap->semispaces[TENURED],tenured_size,alloter); @@ -92,7 +94,7 @@ F_DATA_HEAP *alloc_data_heap(CELL gens, alloter = init_zone(&data_heap->semispaces[NURSERY],0,alloter); } - if(alloter != data_heap->segment->end) + if(data_heap->segment->end - alloter > DECK_SIZE) critical_error("Bug in alloc_data_heap",alloter); return data_heap; @@ -163,6 +165,10 @@ void gc_reset(void) int i; for(i = 0; i < MAX_GEN_COUNT; i++) memset(&gc_stats[i],0,sizeof(F_GC_STATS)); + + cards_scanned = 0; + decks_scanned = 0; + code_heap_scans = 0; } void init_data_heap(CELL gens, @@ -182,10 +188,6 @@ void init_data_heap(CELL gens, secure_gc = secure_gc_; gc_reset(); - - cards_scanned = 0; - decks_scanned = 0; - code_heap_scans = 0; } /* Size of the object pointed to by a tagged pointer */ diff --git a/vm/data_gc.h b/vm/data_gc.h index 20692c14e6..301821bb7a 100755 --- a/vm/data_gc.h +++ b/vm/data_gc.h @@ -68,13 +68,11 @@ the offset of the first object is set by the allocator. */ #define CARD_POINTS_TO_NURSERY 0x80 #define CARD_POINTS_TO_AGING 0x40 #define CARD_MARK_MASK (CARD_POINTS_TO_NURSERY | CARD_POINTS_TO_AGING) -#define CARD_BASE_MASK 0x3f +#define CARD_BASE_MASK 0xff typedef u8 F_CARD; -/* A card is 64 bytes. 6 bits is sufficient to represent every -offset within the card */ -#define CARD_SIZE 64 -#define CARD_BITS 6 +#define CARD_BITS 8 +#define CARD_SIZE (1<> CARD_BITS) + cards_offset) #define CARD_TO_ADDR(c) (CELL*)(((CELL)(c) - cards_offset)<