vm: change "profiler" names to "counting_profiler"
parent
186bf65a00
commit
cdfb1b1b94
|
@ -56,7 +56,7 @@ ifdef CONFIG
|
|||
vm/object_start_map.o \
|
||||
vm/objects.o \
|
||||
vm/primitives.o \
|
||||
vm/profiler.o \
|
||||
vm/counting_profiler.o \
|
||||
vm/quotations.o \
|
||||
vm/run.o \
|
||||
vm/strings.o \
|
||||
|
|
|
@ -60,7 +60,7 @@ DLL_OBJS = $(PLAF_DLL_OBJS) \
|
|||
vm\object_start_map.obj \
|
||||
vm\objects.obj \
|
||||
vm\primitives.obj \
|
||||
vm\profiler.obj \
|
||||
vm\counting_profiler.obj \
|
||||
vm\quotations.obj \
|
||||
vm\run.obj \
|
||||
vm\strings.obj \
|
||||
|
|
|
@ -59,8 +59,8 @@ void code_block_visitor<Fixup>::visit_object_code_block(object *obj)
|
|||
word *w = (word *)obj;
|
||||
if(w->code)
|
||||
w->code = visit_code_block(w->code);
|
||||
if(w->profiling)
|
||||
w->profiling = visit_code_block(w->profiling);
|
||||
if(w->counting_profiler)
|
||||
w->counting_profiler = visit_code_block(w->counting_profiler);
|
||||
|
||||
parent->update_word_entry_point(w);
|
||||
break;
|
||||
|
|
|
@ -3,50 +3,50 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
void factor_vm::init_profiler()
|
||||
void factor_vm::init_counting_profiler()
|
||||
{
|
||||
counting_profiler_p = false;
|
||||
}
|
||||
|
||||
/* Allocates memory */
|
||||
code_block *factor_vm::compile_profiling_stub(cell word_)
|
||||
code_block *factor_vm::compile_counting_profiler_stub(cell word_)
|
||||
{
|
||||
data_root<word> word(word_,this);
|
||||
|
||||
jit jit(code_block_profiling,word.value(),this);
|
||||
jit jit(code_block_counting_profiler,word.value(),this);
|
||||
jit.emit_with_literal(special_objects[JIT_PROFILING],word.value());
|
||||
|
||||
return jit.to_code_block();
|
||||
}
|
||||
|
||||
/* Allocates memory */
|
||||
void factor_vm::set_profiling(bool profiling)
|
||||
void factor_vm::set_counting_profiler(bool counting_profiler)
|
||||
{
|
||||
if(profiling == counting_profiler_p)
|
||||
if(counting_profiler == counting_profiler_p)
|
||||
return;
|
||||
|
||||
/* Push everything to tenured space so that we can heap scan
|
||||
and allocate profiling blocks if necessary */
|
||||
and allocate counting_profiler blocks if necessary */
|
||||
primitive_full_gc();
|
||||
|
||||
data_root<array> words(find_all_words(),this);
|
||||
|
||||
counting_profiler_p = profiling;
|
||||
counting_profiler_p = counting_profiler;
|
||||
|
||||
cell length = array_capacity(words.untagged());
|
||||
for(cell i = 0; i < length; i++)
|
||||
{
|
||||
tagged<word> word(array_nth(words.untagged(),i));
|
||||
|
||||
/* Note: can't do w->profiling = ... since LHS evaluates
|
||||
/* Note: can't do w->counting_profiler = ... since LHS evaluates
|
||||
before RHS, and if RHS does a GC, we will have an
|
||||
invalid pointer on the LHS */
|
||||
if(profiling)
|
||||
if(counting_profiler)
|
||||
{
|
||||
if(!word->profiling)
|
||||
if(!word->counting_profiler)
|
||||
{
|
||||
code_block *profiling_block = compile_profiling_stub(word.value());
|
||||
word->profiling = profiling_block;
|
||||
code_block *counting_profiler_block = compile_counting_profiler_stub(word.value());
|
||||
word->counting_profiler = counting_profiler_block;
|
||||
}
|
||||
|
||||
word->counter = tag_fixnum(0);
|
||||
|
@ -58,9 +58,9 @@ void factor_vm::set_profiling(bool profiling)
|
|||
update_code_heap_words(false);
|
||||
}
|
||||
|
||||
void factor_vm::primitive_profiling()
|
||||
void factor_vm::primitive_counting_profiler()
|
||||
{
|
||||
set_profiling(to_boolean(ctx->pop()));
|
||||
set_counting_profiler(to_boolean(ctx->pop()));
|
||||
}
|
||||
|
||||
}
|
|
@ -23,8 +23,8 @@ void factor_vm::c_to_factor(cell quot)
|
|||
template<typename Func> Func factor_vm::get_entry_point(cell n)
|
||||
{
|
||||
/* We return word->code->entry_point() and not word->entry_point,
|
||||
because if profiling is enabled, we don't want to go through the
|
||||
entry point's profiling stub. This clobbers registers, since entry
|
||||
because if counting_profiler is enabled, we don't want to go through the
|
||||
entry point's counting_profiler stub. This clobbers registers, since entry
|
||||
points use the C ABI and not the Factor ABI. */
|
||||
tagged<word> entry_point_word(special_objects[n]);
|
||||
return (Func)entry_point_word->code->entry_point();
|
||||
|
|
|
@ -135,7 +135,7 @@ void factor_vm::init_factor(vm_parameters *p)
|
|||
if(p->console)
|
||||
open_console();
|
||||
|
||||
init_profiler();
|
||||
init_counting_profiler();
|
||||
|
||||
special_objects[OBJ_CPU] = allot_alien(false_object,(cell)FACTOR_CPU_STRING);
|
||||
special_objects[OBJ_OS] = allot_alien(false_object,(cell)FACTOR_OS_STRING);
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace factor
|
|||
{
|
||||
|
||||
/* Simple code generator used by:
|
||||
- profiler (profiler.cpp),
|
||||
- counting_profiler (counting_profiler.cpp),
|
||||
- quotation compiler (quotations.cpp),
|
||||
- megamorphic caches (dispatch.cpp),
|
||||
- polymorphic inline caches (inline_cache.cpp) */
|
||||
|
|
|
@ -60,7 +60,7 @@ enum code_block_type
|
|||
{
|
||||
code_block_unoptimized,
|
||||
code_block_optimized,
|
||||
code_block_profiling,
|
||||
code_block_counting_profiler,
|
||||
code_block_pic
|
||||
};
|
||||
|
||||
|
@ -232,7 +232,7 @@ struct word : public object {
|
|||
cell pic_def;
|
||||
/* TAGGED alternative entry point for direct tail calls. Used for inline caching */
|
||||
cell pic_tail_def;
|
||||
/* TAGGED call count for profiling */
|
||||
/* TAGGED call count for counting_profiler */
|
||||
cell counter;
|
||||
/* TAGGED machine code for sub-primitive */
|
||||
cell subprimitive;
|
||||
|
@ -240,8 +240,8 @@ struct word : public object {
|
|||
void *entry_point;
|
||||
/* UNTAGGED compiled code block */
|
||||
code_block *code;
|
||||
/* UNTAGGED profiler stub */
|
||||
code_block *profiling;
|
||||
/* UNTAGGED counting_profiler stub */
|
||||
code_block *counting_profiler;
|
||||
};
|
||||
|
||||
/* Assembly code makes assumptions about the layout of this struct */
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace factor
|
|||
#include "contexts.hpp"
|
||||
#include "run.hpp"
|
||||
#include "objects.hpp"
|
||||
#include "profiler.hpp"
|
||||
#include "counting_profiler.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "bignumint.hpp"
|
||||
#include "bignum.hpp"
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace factor
|
|||
_(modify_code_heap) \
|
||||
_(nano_count) \
|
||||
_(optimized_p) \
|
||||
_(profiling) \
|
||||
_(counting_profiler) \
|
||||
_(quot_compiled_p) \
|
||||
_(quotation_code) \
|
||||
_(reset_dispatch_stats) \
|
||||
|
|
10
vm/vm.hpp
10
vm/vm.hpp
|
@ -180,11 +180,11 @@ struct factor_vm
|
|||
void primitive_clone();
|
||||
void primitive_become();
|
||||
|
||||
// profiler
|
||||
void init_profiler();
|
||||
code_block *compile_profiling_stub(cell word_);
|
||||
void set_profiling(bool profiling);
|
||||
void primitive_profiling();
|
||||
// counting_profiler
|
||||
void init_counting_profiler();
|
||||
code_block *compile_counting_profiler_stub(cell word_);
|
||||
void set_counting_profiler(bool counting_profiler);
|
||||
void primitive_counting_profiler();
|
||||
|
||||
// errors
|
||||
void general_error(vm_error_type error, cell arg1, cell arg2);
|
||||
|
|
16
vm/words.cpp
16
vm/words.cpp
|
@ -58,15 +58,15 @@ word *factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_)
|
|||
new_word->pic_def = false_object;
|
||||
new_word->pic_tail_def = false_object;
|
||||
new_word->subprimitive = false_object;
|
||||
new_word->profiling = NULL;
|
||||
new_word->counting_profiler = NULL;
|
||||
new_word->code = NULL;
|
||||
|
||||
jit_compile_word(new_word.value(),new_word->def,true);
|
||||
if(counting_profiler_p)
|
||||
{
|
||||
code_block *profiling_block = compile_profiling_stub(new_word.value());
|
||||
new_word->profiling = profiling_block;
|
||||
initialize_code_block(new_word->profiling);
|
||||
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());
|
||||
|
@ -91,8 +91,8 @@ void factor_vm::primitive_word_code()
|
|||
|
||||
if(counting_profiler_p)
|
||||
{
|
||||
ctx->push(from_unsigned_cell((cell)w->profiling->entry_point()));
|
||||
ctx->push(from_unsigned_cell((cell)w->profiling + w->profiling->size()));
|
||||
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
|
||||
{
|
||||
|
@ -103,8 +103,8 @@ void factor_vm::primitive_word_code()
|
|||
|
||||
void factor_vm::update_word_entry_point(word *w)
|
||||
{
|
||||
if(counting_profiler_p && w->profiling)
|
||||
w->entry_point = w->profiling->entry_point();
|
||||
if(counting_profiler_p && w->counting_profiler)
|
||||
w->entry_point = w->counting_profiler->entry_point();
|
||||
else
|
||||
w->entry_point = w->code->entry_point();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue