diff options
author | Björn Gustavsson <[email protected]> | 2019-04-12 12:58:31 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-04-12 15:07:38 +0200 |
commit | f8d1787cd7accb1e6aabeec43bb7eaec66467852 (patch) | |
tree | 6981f78887943bc4c6f2ba9918c6daa8f172c269 /erts/emulator/beam/macros.tab | |
parent | 2263ba94602fa204981254b143eb722bf8ab81b3 (diff) | |
download | otp-f8d1787cd7accb1e6aabeec43bb7eaec66467852.tar.gz otp-f8d1787cd7accb1e6aabeec43bb7eaec66467852.tar.bz2 otp-f8d1787cd7accb1e6aabeec43bb7eaec66467852.zip |
crash dump: Include correct IP for a garbing process
Make sure that the instruction pointer is correct for a garbing
process in a crash dump.
Diffstat (limited to 'erts/emulator/beam/macros.tab')
-rw-r--r-- | erts/emulator/beam/macros.tab | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/erts/emulator/beam/macros.tab b/erts/emulator/beam/macros.tab index 494fe8961e..1b5e5f66b0 100644 --- a/erts/emulator/beam/macros.tab +++ b/erts/emulator/beam/macros.tab @@ -63,10 +63,21 @@ JUMP(Fail) { Goto(*I); } +GC_SWAPOUT() { + // + // Since a garbage collection is expensive anyway, we can afford + // to save the instruction counter so that the correct function will + // be pointed in the crash dump if the garbage collection fails + // because of insufficient memory. + // + SWAPOUT; + c_p->i = I; +} + GC_TEST(Ns, Nh, Live) { Uint need = $Nh + $Ns; if (ERTS_UNLIKELY(E - HTOP < need)) { - SWAPOUT; + $GC_SWAPOUT(); PROCESS_MAIN_CHK_LOCKS(c_p); FCALLS -= erts_garbage_collect_nobump(c_p, need, reg, $Live, FCALLS); ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); @@ -79,7 +90,7 @@ GC_TEST(Ns, Nh, Live) { GC_TEST_PRESERVE(NeedHeap, Live, PreserveTerm) { Uint need = $NeedHeap; if (ERTS_UNLIKELY(E - HTOP < need)) { - SWAPOUT; + $GC_SWAPOUT(); reg[$Live] = $PreserveTerm; PROCESS_MAIN_CHK_LOCKS(c_p); FCALLS -= erts_garbage_collect_nobump(c_p, need, reg, $Live+1, FCALLS); |