Fix profiler crash with large heap
parent
f94596af57
commit
2c76171c8a
21
vm/data_gc.c
21
vm/data_gc.c
|
@ -821,3 +821,24 @@ DEFINE_PRIMITIVE(become)
|
||||||
|
|
||||||
gc();
|
gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CELL find_all_words(void)
|
||||||
|
{
|
||||||
|
GROWABLE_ARRAY(words);
|
||||||
|
|
||||||
|
begin_scan();
|
||||||
|
|
||||||
|
CELL obj;
|
||||||
|
while((obj = next_object()) != F)
|
||||||
|
{
|
||||||
|
if(type_of(obj) == WORD_TYPE)
|
||||||
|
GROWABLE_ADD(words,obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End heap scan */
|
||||||
|
gc_off = false;
|
||||||
|
|
||||||
|
GROWABLE_TRIM(words);
|
||||||
|
|
||||||
|
return words;
|
||||||
|
}
|
||||||
|
|
|
@ -365,3 +365,5 @@ DLLEXPORT void simple_gc(void);
|
||||||
DECLARE_PRIMITIVE(gc);
|
DECLARE_PRIMITIVE(gc);
|
||||||
DECLARE_PRIMITIVE(gc_time);
|
DECLARE_PRIMITIVE(gc_time);
|
||||||
DECLARE_PRIMITIVE(become);
|
DECLARE_PRIMITIVE(become);
|
||||||
|
|
||||||
|
CELL find_all_words(void);
|
||||||
|
|
15
vm/factor.c
15
vm/factor.c
|
@ -38,21 +38,8 @@ void do_stage1_init(void)
|
||||||
fprintf(stderr,"*** Stage 2 early init... ");
|
fprintf(stderr,"*** Stage 2 early init... ");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
GROWABLE_ARRAY(words);
|
CELL words = find_all_words();
|
||||||
|
|
||||||
begin_scan();
|
|
||||||
|
|
||||||
CELL obj;
|
|
||||||
while((obj = next_object()) != F)
|
|
||||||
{
|
|
||||||
if(type_of(obj) == WORD_TYPE)
|
|
||||||
GROWABLE_ADD(words,obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End heap scan */
|
|
||||||
gc_off = false;
|
|
||||||
|
|
||||||
GROWABLE_TRIM(words);
|
|
||||||
REGISTER_ROOT(words);
|
REGISTER_ROOT(words);
|
||||||
|
|
||||||
CELL i;
|
CELL i;
|
||||||
|
|
|
@ -61,17 +61,19 @@ void set_profiling(bool profiling)
|
||||||
and allocate profiling blocks if necessary */
|
and allocate profiling blocks if necessary */
|
||||||
gc();
|
gc();
|
||||||
|
|
||||||
/* Update word XTs and saved callstack objects */
|
CELL words = find_all_words();
|
||||||
begin_scan();
|
|
||||||
|
|
||||||
CELL obj;
|
REGISTER_ROOT(words);
|
||||||
while((obj = next_object()) != F)
|
|
||||||
|
CELL i;
|
||||||
|
CELL length = array_capacity(untag_object(words));
|
||||||
|
for(i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if(type_of(obj) == WORD_TYPE)
|
F_WORD *word = untag_word(array_nth(untag_array(words),i));
|
||||||
update_word_xt(untag_object(obj));
|
update_word_xt(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
gc_off = false; /* end heap scan */
|
UNREGISTER_ROOT(words);
|
||||||
|
|
||||||
/* Update XTs in code heap */
|
/* Update XTs in code heap */
|
||||||
iterate_code_heap(relocate_code_block);
|
iterate_code_heap(relocate_code_block);
|
||||||
|
|
Loading…
Reference in New Issue