From cdfb1b1b94ec57f0050f7e55d928d8e246ccb8b9 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 28 Oct 2011 11:33:27 -0700 Subject: [PATCH] vm: change "profiler" names to "counting_profiler" --- GNUmakefile | 4 ++-- Nmakefile | 2 +- vm/code_block_visitor.hpp | 4 ++-- vm/{profiler.cpp => counting_profiler.cpp} | 28 +++++++++++----------- vm/{profiler.hpp => counting_profiler.hpp} | 0 vm/entry_points.cpp | 4 ++-- vm/factor.cpp | 2 +- vm/jit.cpp | 2 +- vm/layouts.hpp | 8 +++---- vm/master.hpp | 2 +- vm/primitives.hpp | 2 +- vm/vm.hpp | 10 ++++---- vm/words.cpp | 16 ++++++------- 13 files changed, 42 insertions(+), 42 deletions(-) rename vm/{profiler.cpp => counting_profiler.cpp} (51%) rename vm/{profiler.hpp => counting_profiler.hpp} (100%) diff --git a/GNUmakefile b/GNUmakefile index 29971775a4..c48e3a363e 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -56,14 +56,14 @@ 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 \ vm/to_tenured_collector.o \ vm/tuples.o \ vm/utilities.o \ - vm/vm.o \ + vm/vm.o \ vm/words.o EXE_OBJS = $(PLAF_EXE_OBJS) diff --git a/Nmakefile b/Nmakefile index 293f0239e8..1aa568b746 100755 --- a/Nmakefile +++ b/Nmakefile @@ -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 \ diff --git a/vm/code_block_visitor.hpp b/vm/code_block_visitor.hpp index 8b48d3672f..6246c748e9 100644 --- a/vm/code_block_visitor.hpp +++ b/vm/code_block_visitor.hpp @@ -59,8 +59,8 @@ void code_block_visitor::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; diff --git a/vm/profiler.cpp b/vm/counting_profiler.cpp similarity index 51% rename from vm/profiler.cpp rename to vm/counting_profiler.cpp index 8512230d92..9d3f390d85 100755 --- a/vm/profiler.cpp +++ b/vm/counting_profiler.cpp @@ -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_,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 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(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())); } } diff --git a/vm/profiler.hpp b/vm/counting_profiler.hpp similarity index 100% rename from vm/profiler.hpp rename to vm/counting_profiler.hpp diff --git a/vm/entry_points.cpp b/vm/entry_points.cpp index 798a4dbcbd..724874ea0e 100755 --- a/vm/entry_points.cpp +++ b/vm/entry_points.cpp @@ -23,8 +23,8 @@ void factor_vm::c_to_factor(cell quot) template 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 entry_point_word(special_objects[n]); return (Func)entry_point_word->code->entry_point(); diff --git a/vm/factor.cpp b/vm/factor.cpp index c7bb0d2fac..f861374b35 100755 --- a/vm/factor.cpp +++ b/vm/factor.cpp @@ -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); diff --git a/vm/jit.cpp b/vm/jit.cpp index 615601ecf6..77b827bef2 100644 --- a/vm/jit.cpp +++ b/vm/jit.cpp @@ -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) */ diff --git a/vm/layouts.hpp b/vm/layouts.hpp index b0edb4be16..300b819b1f 100644 --- a/vm/layouts.hpp +++ b/vm/layouts.hpp @@ -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 */ diff --git a/vm/master.hpp b/vm/master.hpp index 43e02fe4d4..c7f8836c2b 100755 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -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" diff --git a/vm/primitives.hpp b/vm/primitives.hpp index e9965c2f3b..b3a36b273a 100644 --- a/vm/primitives.hpp +++ b/vm/primitives.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) \ diff --git a/vm/vm.hpp b/vm/vm.hpp index 3cc2328880..4c92caa26f 100755 --- a/vm/vm.hpp +++ b/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); diff --git a/vm/words.cpp b/vm/words.cpp index 2fd6fa42dc..af27401935 100644 --- a/vm/words.cpp +++ b/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(); } -- 2.34.1