6 void factorvm::init_profiler()
11 /* Allocates memory */
12 code_block *factorvm::compile_profiling_stub(cell word_)
14 gc_root<word> word(word_,this);
16 jit jit(WORD_TYPE,word.value(),this);
17 jit.emit_with(userenv[JIT_PROFILING],word.value());
19 return jit.to_code_block();
22 /* Allocates memory */
23 void factorvm::set_profiling(bool profiling)
25 if(profiling == profiling_p)
28 profiling_p = profiling;
30 /* Push everything to tenured space so that we can heap scan
31 and allocate profiling blocks if necessary */
34 gc_root<array> words(find_all_words(),this);
37 cell length = array_capacity(words.untagged());
38 for(i = 0; i < length; i++)
40 tagged<word> word(array_nth(words.untagged(),i));
42 word->counter = tag_fixnum(0);
43 update_word_xt(word.value());
46 /* Update XTs in code heap */
47 iterate_code_heap(factor::relocate_code_block);
50 inline void factorvm::primitive_profiling()
52 set_profiling(to_boolean(dpop()));
57 PRIMITIVE_GETVM()->primitive_profiling();