]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: change "profiler" names to "counting_profiler"
authorJoe Groff <arcata@gmail.com>
Fri, 28 Oct 2011 18:33:27 +0000 (11:33 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 20:23:05 +0000 (13:23 -0700)
15 files changed:
GNUmakefile
Nmakefile
vm/code_block_visitor.hpp
vm/counting_profiler.cpp [new file with mode: 0755]
vm/counting_profiler.hpp [new file with mode: 0755]
vm/entry_points.cpp
vm/factor.cpp
vm/jit.cpp
vm/layouts.hpp
vm/master.hpp
vm/primitives.hpp
vm/profiler.cpp [deleted file]
vm/profiler.hpp [deleted file]
vm/vm.hpp
vm/words.cpp

index 29971775a46e670dff78fb1bafb9d3e3878c8639..c48e3a363e5a7fce5feb07ad3a15654f0c7b0f5b 100755 (executable)
@@ -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)
index 293f0239e8b9dca7244e8181cd9613a7b13383b3..1aa568b746d8f9c233101ae876fa975e94b1678a 100755 (executable)
--- 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 \
index 8b48d3672f8f38a142fcefaed54e606bd5eac72e..6246c748e9956698f746f199471be4c1dedca4b0 100644 (file)
@@ -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;
diff --git a/vm/counting_profiler.cpp b/vm/counting_profiler.cpp
new file mode 100755 (executable)
index 0000000..9d3f390
--- /dev/null
@@ -0,0 +1,66 @@
+#include "master.hpp"
+
+namespace factor
+{
+
+void factor_vm::init_counting_profiler()
+{
+       counting_profiler_p = false;
+}
+
+/* Allocates memory */
+code_block *factor_vm::compile_counting_profiler_stub(cell word_)
+{
+       data_root<word> word(word_,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_counting_profiler(bool counting_profiler)
+{
+       if(counting_profiler == counting_profiler_p)
+               return;
+
+       /* Push everything to tenured space so that we can heap scan
+       and allocate counting_profiler blocks if necessary */
+       primitive_full_gc();
+
+       data_root<array> words(find_all_words(),this);
+
+       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->counting_profiler = ... since LHS evaluates
+               before RHS, and if RHS does a GC, we will have an
+               invalid pointer on the LHS */
+               if(counting_profiler)
+               {
+                       if(!word->counting_profiler)
+                       {
+                               code_block *counting_profiler_block = compile_counting_profiler_stub(word.value());
+                               word->counting_profiler = counting_profiler_block;
+                       }
+
+                       word->counter = tag_fixnum(0);
+               }
+
+               update_word_entry_point(word.untagged());
+       }
+
+       update_code_heap_words(false);
+}
+
+void factor_vm::primitive_counting_profiler()
+{
+       set_counting_profiler(to_boolean(ctx->pop()));
+}
+
+}
diff --git a/vm/counting_profiler.hpp b/vm/counting_profiler.hpp
new file mode 100755 (executable)
index 0000000..412ef35
--- /dev/null
@@ -0,0 +1,4 @@
+namespace factor
+{
+
+}
index 798a4dbcbd82dffeb1d6187041cc9db36a231a78..724874ea0ec62912a1d83fdbdf3855da1196bc62 100755 (executable)
@@ -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();
index c7bb0d2fac686539e29e12ad3f32c6a8d5deb38e..f861374b35079d948cc9d5707d35091a7d5a42c5 100755 (executable)
@@ -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);
index 615601ecf64ed566d6abcb6412ed2cc1a1d47cde..77b827bef2c290a3ceb8c3b64072f515adc744f2 100644 (file)
@@ -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) */
index b0edb4be164d7691e6446cf80334859af555fcfc..300b819b1fadcc96d612781959fe0d9220ce1072 100644 (file)
@@ -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 */
index 43e02fe4d48151e5a7f5a6d5a55745bd6131d152..c7f8836c2b5daca4f274559ef0ba526bbb9da248 100755 (executable)
@@ -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"
index e9965c2f3b98a63f12acd87b6eb13a98b447d4e2..b3a36b273a7b9d1cc6aac35387fb29d392f7d1af 100644 (file)
@@ -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/profiler.cpp b/vm/profiler.cpp
deleted file mode 100755 (executable)
index 8512230..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "master.hpp"
-
-namespace factor
-{
-
-void factor_vm::init_profiler()
-{
-       counting_profiler_p = false;
-}
-
-/* Allocates memory */
-code_block *factor_vm::compile_profiling_stub(cell word_)
-{
-       data_root<word> word(word_,this);
-
-       jit jit(code_block_profiling,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)
-{
-       if(profiling == counting_profiler_p)
-               return;
-
-       /* Push everything to tenured space so that we can heap scan
-       and allocate profiling blocks if necessary */
-       primitive_full_gc();
-
-       data_root<array> words(find_all_words(),this);
-
-       counting_profiler_p = profiling;
-
-       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
-               before RHS, and if RHS does a GC, we will have an
-               invalid pointer on the LHS */
-               if(profiling)
-               {
-                       if(!word->profiling)
-                       {
-                               code_block *profiling_block = compile_profiling_stub(word.value());
-                               word->profiling = profiling_block;
-                       }
-
-                       word->counter = tag_fixnum(0);
-               }
-
-               update_word_entry_point(word.untagged());
-       }
-
-       update_code_heap_words(false);
-}
-
-void factor_vm::primitive_profiling()
-{
-       set_profiling(to_boolean(ctx->pop()));
-}
-
-}
diff --git a/vm/profiler.hpp b/vm/profiler.hpp
deleted file mode 100755 (executable)
index 412ef35..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-namespace factor
-{
-
-}
index 3cc232888070bb33b447626d71cfa26ccd0b1e03..4c92caa26f6fde412ce9ba3e1aa3053419d43daa 100755 (executable)
--- 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);
index 2fd6fa42dcc05a507c89970a816052d00e5e8b84..af27401935406217d447c9c068f67f16403bdc70 100644 (file)
@@ -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();
 }