7 void factorvm::init_profiler()
13 /* Allocates memory */
14 code_block *factorvm::compile_profiling_stub(cell word_)
16 gc_root<word> word(word_,this);
18 jit jit(WORD_TYPE,word.value(),this);
19 jit.emit_with(userenv[JIT_PROFILING],word.value());
21 return jit.to_code_block();
25 /* Allocates memory */
26 void factorvm::set_profiling(bool profiling)
28 if(profiling == profiling_p)
31 profiling_p = profiling;
33 /* Push everything to tenured space so that we can heap scan
34 and allocate profiling blocks if necessary */
37 gc_root<array> words(find_all_words(),this);
40 cell length = array_capacity(words.untagged());
41 for(i = 0; i < length; i++)
43 tagged<word> word(array_nth(words.untagged(),i));
45 word->counter = tag_fixnum(0);
46 update_word_xt(word.value());
49 /* Update XTs in code heap */
50 iterate_code_heap(factor::relocate_code_block);
54 inline void factorvm::vmprim_profiling()
56 set_profiling(to_boolean(dpop()));
61 PRIMITIVE_GETVM()->vmprim_profiling();