! See http://factor.sf.net/license.txt for BSD license.
IN: memory
USING: errors generic hashtables kernel kernel-internals lists
-math namespaces prettyprint sequences stdio unparser vectors
-words ;
+math namespaces prettyprint sequences stdio strings unparser
+vectors words ;
: save
#! Save the current image.
! Printing an overview of heap usage.
-: kb. 1024 /i unparse write " KB" write ;
+: kb. 1024 /i unparse 6 CHAR: \s pad write " KB" write ;
: (room.) ( free total -- )
2dup swap - swap ( free used total )
: room. ( -- )
room
0 swap [
- "Generation " write over unparse write ": " write
+ "Generation " write over unparse write ":" write
uncons (room.) 1 +
] each drop
- "Code space: " write (room.) ;
+ "Semi-space: " write kb. terpri
+ "Cards: " write kb. terpri
+ "Code space: " write (room.) ;
! Some words for iterating through the heap.
int i;
for(i = 0; i < GC_GENERATIONS; i++)
{
- fprintf(stderr,"Generation %d: base=%d, size=%d, here=%d\n",
+ fprintf(stderr,"Generation %d: base=%lu, size=%lu, here=%lu\n",
i,
generations[i].base,
generations[i].limit - generations[i].base,
generations[i].here);
}
- fprintf(stderr,"Semispace: base=%d, size=%d, here=%d\n",
+ fprintf(stderr,"Semispace: base=%lu, size=%lu, here=%lu\n",
prior.base,
prior.limit - prior.base,
prior.here);
- fprintf(stderr,"Cards: base=%d, size=%d\n",cards,cards_end - cards);
+ fprintf(stderr,"Cards: base=%lu, size=%lu\n",(CELL)cards,
+ (CELL)(cards_end - cards));
}
CELL init_zone(ZONE *z, CELL size, CELL base)
gc_in_progress = false;
heap_scan = false;
gc_time = 0;
-
- dump_generations();
}
void allot_profile_step(CELL a)
int gen;
box_signed_cell(compiling.limit - compiling.here);
box_signed_cell(compiling.limit - compiling.base);
+ box_signed_cell(cards_end - cards);
+ box_signed_cell(prior.limit - prior.base);
for(gen = GC_GENERATIONS - 1; gen >= 0; gen--)
{
ZONE *z = &generations[gen];
data_fixup(&userenv[BOOT_ENV]);
data_fixup(&userenv[GLOBAL_ENV]);
- printf("%d\n",T);
- printf("%d\n",bignum_zero);
- printf("%d\n",bignum_pos_one);
- printf("%d\n",bignum_neg_one);
data_fixup(&T);
data_fixup(&bignum_zero);
data_fixup(&bignum_pos_one);