Mercurial > hg > release > heapstats-2.0
changeset 208:7558b2f349cb
Bug 3422: [REFACTORING] Stack and base pointer operation
Reviewed-by: ykubota
https://github.com/HeapStats/heapstats/pull/111
author | Yasumasa Suenaga <yasuenag@gmail.com> |
---|---|
date | Wed, 19 Jul 2017 17:54:36 +0900 |
parents | 11667e520491 |
children | 2ae1e303950b |
files | ChangeLog agent/src/heapstats-engines/arch/x86/overrideFunc.amd64.S |
diffstat | 2 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jul 14 12:20:28 2017 +0900 +++ b/ChangeLog Wed Jul 19 17:54:36 2017 +0900 @@ -1,3 +1,7 @@ +2017-07-19 Yasumasa Suenaga <yasuenag@gmail.com> + + * Bug 3422: [REFACTORING] Stack and base pointer operation + 2017-07-14 Yasumasa Suenaga <yasuenag@gmail.com> * Bug 3421: Override functions might crash on Fedora 26
--- a/agent/src/heapstats-engines/arch/x86/overrideFunc.amd64.S Fri Jul 14 12:20:28 2017 +0900 +++ b/agent/src/heapstats-engines/arch/x86/overrideFunc.amd64.S Wed Jul 19 17:54:36 2017 +0900 @@ -58,24 +58,20 @@ mov collectedHeap@GOTPCREL(%rip), %rdi; \ mov (%rdi), %rdi; \ mov oop_ofs(%rsp), %rsi; \ - push %rbp; \ - mov %rsp, %rbp; \ call *(%r11); \ - pop %rbp; \ test %al, %al; #define DO_JMP_TO_CALLBACK(header, ary_idx, oop_ofs) \ mov oop_ofs(%rsp), %rdi; \ mov header##_enter_hook_##ary_idx##@GOTPCREL(%rip), %r11; \ - push %rbp; \ - mov %rsp, %rbp; \ - call *(%r11); \ - pop %rbp; + call *(%r11); #define OVERRIDE_FUNC_DEFINE(header, ary_idx) \ .global header##_override_func_##ary_idx ; \ .type header##_override_func_##ary_idx, @function; \ header##_override_func_##ary_idx: ; \ + push %rbp; \ + mov %rsp, %rbp; \ /* Save argument registers. */ ; \ DO_SAVE_REG \ \ @@ -138,5 +134,11 @@ .LORIGINAL_FUNC: pop %r11; DO_LOAD_REG + + /* Restore stack pointer */ + mov %rbp, %rsp; + /* Restore base pointer */ + pop %rbp; + jmp *%r11;