aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config/s390/tpf-unwind.h
AgeCommit message (Collapse)AuthorFilesLines
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2023-01-16Update copyright years.Jakub Jelinek1-1/+1
2022-10-06libgcc: Decrease size of _Unwind_FrameState and even more size of cleared ↵Jakub Jelinek1-5/+5
area in uw_frame_state_for The following patch implements something that has Florian found as low hanging fruit in our unwinder and has been discussed in the https://gcc.gnu.org/wiki/cauldron2022#cauldron2022talks.inprocess_unwinding_bof talk. _Unwind_FrameState type seems to be (unlike the pre-GCC 3 frame_state which has been part of ABI) private to unwind-dw2.c + unwind.inc it includes, it is always defined on the stack of some entrypoints, initialized by static uw_frame_state_for and the address of it is also passed to other static functions or the static inlines handling machine dependent unwinding, but it isn't fortunately passed to any callbacks or public functions, so I think we can safely change it any time we want. Florian mentioned that the structure is large even on x86_64, 384 bytes there, starts with 328 bytes long element with frame_state_reg_info type which then starts with an array with __LIBGCC_DWARF_FRAME_REGISTERS__ + 1 elements, each of them is 16 bytes long, on x86_64 __LIBGCC_DWARF_FRAME_REGISTERS__ is just 17 but even that is big, on say riscv __LIBGCC_DWARF_FRAME_REGISTERS__ is I think 128, on powerpc 111, on sh 153 etc. And, we memset to zero the whole fs variable with the _Unwind_FrameState type at the start of the unwinding. The reason why each element is 16 byte (on 64-bit arches) is that it contains some pointer or pointer sized integer and then an enum (with just 7 different enumerators) + padding. The following patch decreases it by moving the enum into a separate array and using just one byte for each register in that second array. We could compress it even more, say 4 bits per register, but I don't want to uglify the code for it too much and make the accesses slower. Furthermore, the clearing of the object can clear only thos how array and members after it, because REG_UNSAVED enumerator (0) doesn't actually need any pointer or pointer sized integer, it is just the other kinds that need to have there something. By doing this, on x86_64 the above numbers change to _Unwind_FrameState type being now 264 bytes long, frame_state_reg_info 208 bytes and we don't clear the first 144 bytes of the object, so the memset is 120 bytes, so ~ 31% of the old clearing size. On riscv 64-bit assuming it has same structure layout rules for the few types used there that would be ~ 2160 bytes of _Unwind_FrameState type before and ~ 1264 bytes after, with the memset previously ~ 2160 bytes and after ~ 232 bytes after. We've also talked about possibly adding a number of initially initialized regs and initializing the rest lazily, but at least for x86_64 with 18 elements in the array that doesn't seem to be worth it anymore, especially because return address column is 16 there and that is usually the first thing to be touched. It might theory help with lots of registers if they are usually untouched, but would uglify and complicate any stores to how by having to check there for the not initialized yet cases and lazy initialization, and similarly for all reads of how to do there if below last initialized one, use how, otherwise imply REG_UNSAVED. The disadvantage of the patch is that touching reg[x].loc and how[x] now means 2 cachelines rather than one as before, and I admit beyond bootstrap/regtest I haven't benchmarked it in any way. 2022-10-06 Jakub Jelinek <jakub@redhat.com> * unwind-dw2.h (REG_UNSAVED, REG_SAVED_OFFSET, REG_SAVED_REG, REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, REG_SAVED_VAL_EXP, REG_UNDEFINED): New anonymous enum, moved from inside of struct frame_state_reg_info. (struct frame_state_reg_info): Remove reg[].how element and the anonymous enum there. Add how element. * unwind-dw2.c: Include stddef.h. (uw_frame_state_for): Don't clear first offsetof (_Unwind_FrameState, regs.how[0]) bytes of *fs. (execute_cfa_program, __frame_state_for, uw_update_context_1, uw_update_context): Use fs->regs.how[X] instead of fs->regs.reg[X].how or fs.regs.how[X] instead of fs.regs.reg[X].how. * config/sh/linux-unwind.h (sh_fallback_frame_state): Likewise. * config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise. * config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise. * config/pa/hpux-unwind.h (UPDATE_FS_FOR_SAR, UPDATE_FS_FOR_GR, UPDATE_FS_FOR_FR, UPDATE_FS_FOR_PC, pa_fallback_frame_state): Likewise. * config/alpha/vms-unwind.h (alpha_vms_fallback_frame_state): Likewise. * config/alpha/linux-unwind.h (alpha_fallback_frame_state): Likewise. * config/arc/linux-unwind.h (arc_fallback_frame_state, arc_frob_update_context): Likewise. * config/riscv/linux-unwind.h (riscv_fallback_frame_state): Likewise. * config/nios2/linux-unwind.h (NIOS2_REG): Likewise. * config/nds32/linux-unwind.h (NDS32_PUT_FS_REG): Likewise. * config/s390/tpf-unwind.h (s390_fallback_frame_state): Likewise. * config/s390/linux-unwind.h (s390_fallback_frame_state): Likewise. * config/sparc/sol2-unwind.h (sparc64_frob_update_context, MD_FALLBACK_FRAME_STATE_FOR): Likewise. * config/sparc/linux-unwind.h (sparc64_fallback_frame_state, sparc64_frob_update_context, sparc_fallback_frame_state): Likewise. * config/i386/sol2-unwind.h (x86_64_fallback_frame_state, x86_fallback_frame_state): Likewise. * config/i386/w32-unwind.h (i386_w32_fallback_frame_state): Likewise. * config/i386/linux-unwind.h (x86_64_fallback_frame_state, x86_fallback_frame_state): Likewise. * config/i386/freebsd-unwind.h (x86_64_freebsd_fallback_frame_state): Likewise. * config/i386/dragonfly-unwind.h (x86_64_dragonfly_fallback_frame_state): Likewise. * config/i386/gnu-unwind.h (x86_gnu_fallback_frame_state): Likewise. * config/csky/linux-unwind.h (csky_fallback_frame_state): Likewise. * config/aarch64/linux-unwind.h (aarch64_fallback_frame_state): Likewise. * config/aarch64/freebsd-unwind.h (aarch64_freebsd_fallback_frame_state): Likewise. * config/aarch64/aarch64-unwind.h (aarch64_frob_update_context): Likewise. * config/or1k/linux-unwind.h (or1k_fallback_frame_state): Likewise. * config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise. * config/loongarch/linux-unwind.h (loongarch_fallback_frame_state): Likewise. * config/m68k/linux-unwind.h (m68k_fallback_frame_state): Likewise. * config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Likewise. * config/rs6000/darwin-fallback.c (set_offset): Likewise. * config/rs6000/aix-unwind.h (MD_FROB_UPDATE_CONTEXT): Likewise. * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Likewise. * config/rs6000/freebsd-unwind.h (frob_update_context): Likewise.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-04-03S/390 zTPF: Handle skip trace addresses when unwindingJim Johnston1-57/+75
Check for and handle new skip trace addresses when unwinding on zTPF. libgcc/ChangeLog: 2020-04-03 Jim Johnston <jjohnst@us.ibm.com> * config/s390/tpf-unwind.h (MIN_PATRANGE, MAX_PATRANGE) (TPFRA_OFFSET): Macros removed. (CP_CNF, cinfc_fast, CINFC_CMRESET, CINTFC_CMCENBKST) (CINTFC_CMCENBKED, ICST_CRET, ICST_SRET, LOWCORE_PAGE3_ADDR) (PG3_SKIPPING_OFFSET): New macros. (__isPATrange): Use cinfc_fast for the check. (__isSkipResetAddr): New function. (s390_fallback_frame_state): Check for skip trace addresses. Use either ICST_CRET or ICST_SRET to calculate return address location. (__tpf_eh_return): Handle skip trace addresses.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-07-30s390.c (s390_emit_tpf_eh_return): Pass original return address as second ↵Ulrich Weigand1-22/+43
parameter to __tpf_eh_return routine. gcc/ 2014-07-30 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * config/s390/s390.c (s390_emit_tpf_eh_return): Pass original return address as second parameter to __tpf_eh_return routine. libgcc/ 2014-07-30 J. D. Johnston <jjohnst@us.ibm.com> * config/s390/tpf-unwind.h: Include <stdbool.h>. (__tpf_eh_return): Add original return address as second parameter. Handle cases where unwinder routines were called directly, instead of from within the C++ library. From-SVN: r213305
2014-01-02Update copyright years in libgcc/Richard Sandiford1-1/+1
From-SVN: r206295
2013-02-04Update copyright in libgcc.Richard Sandiford1-1/+1
From-SVN: r195731
2011-06-03linux.h (MD_UNWIND_SUPPORT): Remove.Rainer Orth1-0/+252
gcc: * config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove. * config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove. * config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove. * config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove. * config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove. * config/i386/linux.h (MD_UNWIND_SUPPORT): Remove. * config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove. * config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove. * config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove. * config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove. * config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove. * config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove. * config/mips/linux.h (MD_UNWIND_SUPPORT): Remove. * config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove. * config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove. * config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove. * config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove. * config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove. * config/s390/linux.h (MD_UNWIND_SUPPORT): Remove. * config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove. * config/sh/linux.h (MD_UNWIND_SUPPORT): Remove. * config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove. * config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove. * config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove. * config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove. * config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha. * config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha. * config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha. * config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin. * config/i386/linux-unwind.h: Move to ../libgcc/config/i386. * config/i386/sol2-unwind.h: Move to ../libgcc/config/i386. * config/i386/w32-unwind.h: Move to ../libgcc/config/i386. * config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64. * config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64. * config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k. * config/mips/linux-unwind.h: Move to ../libgcc/config/mips. * config/pa/hpux-unwind.h: Move to ../libgcc/config/pa. * config/pa/linux-unwind.h: Move to ../libgcc/config/pa. * config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000. * config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000. * config/s390/linux-unwind.h: Move to ../libgcc/config/s390. * config/s390/tpf-unwind.h: Move to ../libgcc/config/s390. * config/sh/linux-unwind.h: Move to ../libgcc/config/sh. * config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc. * config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc. * config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa. * config/darwin9.h (DARWIN_LIBSYSTEM_HAS_UNWIND): Remove. * system.h (MD_UNWIND_SUPPORT): Poison. * doc/tm.texi.in (Exception Handling, MD_UNWIND_SUPPORT): Remove. * doc/tm.texi: Regenerate. * unwind-dw2.c: Include md-unwind-support.h instead of MD_UNWIND_SUPPORT. * config/ia64/unwind-ia64.c: Likewise. * config/xtensa/unwind-dw2-xtensa.c: Likewise. libgcc: * config/alpha/linux-unwind.h: Move from ../gcc/config/alpha. * config/alpha/osf5-unwind.h: Move from ../gcc/config/alpha. * config/alpha/vms-unwind.h: Move from ../gcc/config/alpha. * config/bfin/linux-unwind.h: Move from ../gcc/config/bfin. * config/i386/linux-unwind.h: Move from ../gcc/config/i386. * config/i386/sol2-unwind.h: Move from ../gcc/config/i386. * config/i386/w32-unwind.h: Move from ../gcc/config/i386. Wrap in !__MINGW64__. * config/ia64/linux-unwind.h: Move from ../gcc/config/ia64. * config/ia64/vms-unwind.h: Move from ../gcc/config/ia64. * config/m68k/linux-unwind.h: Move from ../gcc/config/m68k. * config/mips/linux-unwind.h: Move from ../gcc/config/mips. * config/pa/hpux-unwind.h: Move from ../gcc/config/pa. * config/pa/linux-unwind.h: Move from ../gcc/config/pa. * config/rs6000/darwin-unwind.h: Move from ../gcc/config/rs6000. Wrap in !__LP64__. * config/rs6000/linux-unwind.h: Move from ../gcc/config/rs6000. * config/s390/linux-unwind.h: Move from ../gcc/config/s390. * config/s390/tpf-unwind.h: Move from ../gcc/config/s390. * config/sh/linux-unwind.h: Move from ../gcc/config/sh. * config/sparc/linux-unwind.h: Move from ../gcc/config/sparc. * config/sparc/sol2-unwind.h: Move from ../gcc/config/sparc. * config/xtensa/linux-unwind.h: Move from ../gcc/config/xtensa. * config/no-unwind.h: New file. * config.host (md_unwind_header): Document. Define. (alpha*-*-linux*, alpha*-dec-osf5.1*, alpha64-dec-*vms*, alpha*-dec-*vms*, bfin*-uclinux*, bfin*-linux-uclibc*, hppa*-*-linux*, hppa[12]*-*-hpux10*, hppa*64*-*-hpux11*, hppa[12]*-*-hpux11*): Set md_unwind_header. (i[34567]86-*-linux*): Handle i[34567]86-*-kopensolaris*-gnu. Set md_unwind_header. (x86_64-*-linux*, i[34567]86-*-solaris2*): Set md_unwind_header. (i[34567]86-*-cygwin*): Split from i[34567]86-*-mingw*. (i[34567]86-*-mingw*, ia64*-*-linux*, ia64-hp-*vms*, m68k-*-uclinux*, m68k-*-linux*, mips64*-*-linux*, mips*-*-linux*, powerpc-*-darwin*, powerpc-*-linux*, s390-*-linux*, s390x-*-linux*, s390x-ibm-tpf*, sh*-*-linux*, sparc-*-linux*, sparc*-*-solaris2*, sparc64-*-linux*, xtensa*-*-linux*): Set md_unwind_header. * configure.ac: Link md-unwind-support.h to $md_unwind_header. * configure: Regenerate. From-SVN: r174613