Commit 4f485b7a authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #291 from undingen/faster_unwinding

Unwinding: remember the bounds of the interpreter function
parents 0085a363 b5dc6d03
......@@ -328,6 +328,24 @@ public:
return rtn;
}
bool isMainInterpreterFunc(unw_word_t ip) {
// Remember the addr of the end of the interpreter function because unw_get_proc_info is slow and if we know
// the bounds we can replace it with pointer comparisons.
static intptr_t interpreter_instr_end = 0; // first ip NOT covered by interpreter func
if (interpreter_instr_end == 0) {
unw_proc_info_t pip;
int code = unw_get_proc_info(&this->cursor, &pip);
RELEASE_ASSERT(code == 0, "%d", code);
if (pip.start_ip == (intptr_t)interpreter_instr_addr) {
interpreter_instr_end = pip.end_ip;
return true;
}
} else if (ip >= (intptr_t)interpreter_instr_addr && ip < interpreter_instr_end) {
return true;
}
return false;
}
bool incr() {
bool was_osr = cur_is_osr;
......@@ -359,13 +377,7 @@ public:
return true;
}
// TODO shouldn't need to do this expensive-looking query, if we
// knew the bounds of the interpretFunction() function:
unw_proc_info_t pip;
int code = unw_get_proc_info(&this->cursor, &pip);
RELEASE_ASSERT(code == 0, "%d", code);
if (pip.start_ip == (intptr_t)interpreter_instr_addr) {
if (isMainInterpreterFunc(ip)) {
unw_word_t bp;
unw_get_reg(&this->cursor, UNW_TDEP_BP, &bp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment