]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: include quots and profile stubs in leaf search
authorJoe Groff <arcata@gmail.com>
Wed, 26 Oct 2011 18:00:13 +0000 (11:00 -0700)
committerJoe Groff <arcata@gmail.com>
Fri, 28 Oct 2011 04:18:19 +0000 (21:18 -0700)
vm/callstack.cpp
vm/errors.cpp

index 79cee091f6945cdd91ae74f1b989870a40ecf709..47499c56484037ca2e73fbc5b0015c6c9b869714 100755 (executable)
@@ -25,17 +25,34 @@ struct word_finder {
 
        word_finder(cell address) : address(address), found_word(0) {}
 
-       // XXX keep a map of word names in the code heap so we don't need this
+       bool in_code_block_p(code_block *code, cell address)
+       {
+               return ((cell)code->entry_point() <= address 
+                               && address - (cell)code->entry_point() < code->size());
+       }
+
+       void save_found_word(cell entry_point)
+       {
+               assert(found_word == 0);
+               found_word = entry_point;
+       }
+
+       // XXX keep a map of code blocks in the code heap so we don't need this
        void operator()(object *obj)
        {
                if (obj->type() == WORD_TYPE)
                {
                        word *w = static_cast<word*>(obj);
-                       if ((cell)w->code->entry_point() <= address 
-                               && address - (cell)w->code->entry_point() < w->code->size()) {
-                               assert(found_word == 0);
-                               found_word = (cell)w->code->entry_point();
-                       }
+                       if (in_code_block_p(w->code, address))
+                               save_found_word((cell)w->code->entry_point());
+                       if (w->profiling && in_code_block_p(w->profiling, address))
+                               save_found_word((cell)w->profiling->entry_point());
+               }
+               else if (obj->type() == QUOTATION_TYPE)
+               {
+                       quotation *q = static_cast<quotation*>(obj);
+                       if (in_code_block_p(q->code, address))
+                               save_found_word((cell)q->code->entry_point());
                }
        }
 };
index 5345e3d91c3e0e6fab587b907933e9d47b62be6c..8df77cf21cc77d1019f1f1e530083aa31d9c4f24 100755 (executable)
@@ -195,8 +195,6 @@ void factor_vm::handle_safepoint()
                safepoint_fep = false;
                return;
        }
-       // XXX handle sample count
-       // XXX handle queued signals
 }
 
 }