Fix obscure bug in profiprofiler

db4
Slava Pestov 2008-07-05 22:19:16 -05:00
parent a26e66e413
commit a9adf82e70
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,6 @@
IN: tools.profiler.tests IN: tools.profiler.tests
USING: accessors tools.profiler tools.test kernel memory math USING: accessors tools.profiler tools.test kernel memory math
threads alien tools.profiler.private sequences ; threads alien tools.profiler.private sequences compiler.units ;
[ t ] [ [ t ] [
\ length counter>> \ length counter>>
@ -42,3 +42,15 @@ threads alien tools.profiler.private sequences ;
[ 1 ] [ \ foobaz counter>> ] unit-test [ 1 ] [ \ foobaz counter>> ] unit-test
[ 2 ] [ \ fooblah counter>> ] unit-test [ 2 ] [ \ fooblah counter>> ] unit-test
: recompile-while-profiling-test ( -- ) ;
[ ] [
[
333 [ recompile-while-profiling-test ] times
{ recompile-while-profiling-test } compile
333 [ recompile-while-profiling-test ] times
] profile
] unit-test
[ 666 ] [ \ recompile-while-profiling-test counter>> ] unit-test

View File

@ -35,8 +35,6 @@ void update_word_xt(F_WORD *word)
/* If we just enabled the profiler, reset call count */ /* If we just enabled the profiler, reset call count */
if(profiling_p) if(profiling_p)
{ {
word->counter = tag_fixnum(0);
if(!word->profiling) if(!word->profiling)
{ {
REGISTER_UNTAGGED(word); REGISTER_UNTAGGED(word);
@ -71,6 +69,8 @@ void set_profiling(bool profiling)
for(i = 0; i < length; i++) for(i = 0; i < length; i++)
{ {
F_WORD *word = untag_word(array_nth(untag_array(words),i)); F_WORD *word = untag_word(array_nth(untag_array(words),i));
if(profiling)
word->counter = tag_fixnum(0);
update_word_xt(word); update_word_xt(word);
} }