]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/words.cpp
vm: strip out call-counting profiler
[factor.git] / vm / words.cpp
index af27401935406217d447c9c068f67f16403bdc70..735a92eacfce153d067a993e57d409493ea8c532 100644 (file)
@@ -11,11 +11,11 @@ void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating)
 
        /* Refuse to compile this word more than once, because quot_compiled_p()
        depends on the identity of its code block */
-       if(word->code && word.value() == special_objects[LAZY_JIT_COMPILE_WORD])
+       if(word->entry_point && word.value() == special_objects[LAZY_JIT_COMPILE_WORD])
                return;
 
        code_block *compiled = jit_compile_quot(word.value(),def.value(),relocating);
-       word->code = compiled;
+       word->entry_point = compiled->entry_point();
 
        if(to_boolean(word->pic_def)) jit_compile_quot(word->pic_def,relocating);
        if(to_boolean(word->pic_tail_def)) jit_compile_quot(word->pic_tail_def,relocating);
@@ -35,10 +35,8 @@ void factor_vm::compile_all_words()
        {
                data_root<word> word(array_nth(words.untagged(),i),this);
 
-               if(!word->code || !word->code->optimized_p())
+               if(!word->entry_point || !word->code()->optimized_p())
                        jit_compile_word(word.value(),word->def,false);
-
-               update_word_entry_point(word.untagged());
        }
 }
 
@@ -54,22 +52,12 @@ word *factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_)
        new_word->name = name.value();
        new_word->def = special_objects[OBJ_UNDEFINED];
        new_word->props = false_object;
-       new_word->counter = tag_fixnum(0);
        new_word->pic_def = false_object;
        new_word->pic_tail_def = false_object;
        new_word->subprimitive = false_object;
-       new_word->counting_profiler = NULL;
-       new_word->code = NULL;
+       new_word->entry_point = NULL;
 
        jit_compile_word(new_word.value(),new_word->def,true);
-       if(counting_profiler_p)
-       {
-               code_block *counting_profiler_block = compile_counting_profiler_stub(new_word.value());
-               new_word->counting_profiler = counting_profiler_block;
-               initialize_code_block(new_word->counting_profiler);
-       }
-
-       update_word_entry_point(new_word.untagged());
 
        return new_word.untagged();
 }
@@ -89,30 +77,14 @@ void factor_vm::primitive_word_code()
        data_root<word> w(ctx->pop(),this);
        w.untag_check(this);
 
-       if(counting_profiler_p)
-       {
-               ctx->push(from_unsigned_cell((cell)w->counting_profiler->entry_point()));
-               ctx->push(from_unsigned_cell((cell)w->counting_profiler + w->counting_profiler->size()));
-       }
-       else
-       {
-               ctx->push(from_unsigned_cell((cell)w->code->entry_point()));
-               ctx->push(from_unsigned_cell((cell)w->code + w->code->size()));
-       }
-}
-
-void factor_vm::update_word_entry_point(word *w)
-{
-       if(counting_profiler_p && w->counting_profiler)
-               w->entry_point = w->counting_profiler->entry_point();
-       else
-               w->entry_point = w->code->entry_point();
+       ctx->push(from_unsigned_cell((cell)w->entry_point));
+       ctx->push(from_unsigned_cell((cell)w->code() + w->code()->size()));
 }
 
 void factor_vm::primitive_optimized_p()
 {
        word *w = untag_check<word>(ctx->peek());
-       ctx->replace(tag_boolean(w->code->optimized_p()));
+       ctx->replace(tag_boolean(w->code()->optimized_p()));
 }
 
 void factor_vm::primitive_wrapper()