vm: include quots and profile stubs in leaf search
parent
ff2d480d98
commit
126bf22c16
|
@ -25,17 +25,34 @@ struct word_finder {
|
||||||
|
|
||||||
word_finder(cell address) : address(address), found_word(0) {}
|
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)
|
void operator()(object *obj)
|
||||||
{
|
{
|
||||||
if (obj->type() == WORD_TYPE)
|
if (obj->type() == WORD_TYPE)
|
||||||
{
|
{
|
||||||
word *w = static_cast<word*>(obj);
|
word *w = static_cast<word*>(obj);
|
||||||
if ((cell)w->code->entry_point() <= address
|
if (in_code_block_p(w->code, address))
|
||||||
&& address - (cell)w->code->entry_point() < w->code->size()) {
|
save_found_word((cell)w->code->entry_point());
|
||||||
assert(found_word == 0);
|
if (w->profiling && in_code_block_p(w->profiling, address))
|
||||||
found_word = (cell)w->code->entry_point();
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -195,8 +195,6 @@ void factor_vm::handle_safepoint()
|
||||||
safepoint_fep = false;
|
safepoint_fep = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// XXX handle sample count
|
|
||||||
// XXX handle queued signals
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue