Skip to content

Commit

Permalink
dynamic: Save original instructions only once
Browse files Browse the repository at this point in the history
Don't save instructions if they are already present in the code hmap.

Signed-off-by: Clément Guidi <cguidi@ciena.com>
  • Loading branch information
clementguidi authored and azharivs committed Aug 10, 2023
1 parent 7ee751d commit 3b6e832
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libmcount/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void mcount_save_code(struct mcount_disasm_info *info, unsigned call_size, void
struct mcount_orig_insn *orig;
int patch_size;

if (hashmap_get(code_hmap, (void *)info->addr + call_size))
return;

if (unlikely(info->modified)) {
/* it needs to save original instructions as well */
int orig_size = ALIGN(info->orig_size, 16);
Expand Down

0 comments on commit 3b6e832

Please sign in to comment.