Skip to content

Commit

Permalink
Even when the jump target is unknown, we should still apply tail call…
Browse files Browse the repository at this point in the history
… heuristics to check if the jump is a tail call.

This can happen when the jump targets a unparsed function entry or the jump is an indirect tail call.
  • Loading branch information
mxz297 committed Jul 26, 2016
1 parent 435f147 commit 36bd173
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions parseAPI/src/IA_x86.C
Expand Up @@ -257,7 +257,8 @@ bool IA_IAPI::isTailCall(Function * context, EdgeTypeEnum type, unsigned int, co
target = *blocks.begin();
} else if (blocks.size() == 0) {
// This case can happen when the jump target is a function entry,
// but we have not parsed the function yet
// but we have not parsed the function yet,
// or when this is an indirect jump
target = NULL;
} else {
// If this case happens, it means the jump goes into overlapping instruction streams,
Expand All @@ -272,13 +273,11 @@ bool IA_IAPI::isTailCall(Function * context, EdgeTypeEnum type, unsigned int, co
}
}

// if target is still NULL, return false
if(target == NULL) return false;

if(curInsn()->getCategory() == c_BranchInsn &&
valid &&
callee &&
callee != context &&
target &&
!context->contains(target)
)
{
Expand Down

0 comments on commit 36bd173

Please sign in to comment.