public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgcc: Move cfa_how into potential padding in struct frame_state_reg_info
@ 2022-10-14 16:44 Florian Weimer
  2022-10-14 18:00 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2022-10-14 16:44 UTC (permalink / raw)
  To: gcc-patches

On many architectures, there is a padding gap after the how array
member, and cfa_how can be moved there.  This reduces the size of the
struct and the amount of memory that uw_frame_state_for has to clear.

There is no measurable performance benefit from this on x86-64 (even
though the memset goes from 120 to 112 bytes), but it seems to be a
good idea to do anyway.

libgcc/

	* unwind-dw2.h (struct frame_state_reg_info): Move cfa_how member
	and reduce its size.

---
 libgcc/unwind-dw2.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libgcc/unwind-dw2.h b/libgcc/unwind-dw2.h
index af34e000f07..a0834b18277 100644
--- a/libgcc/unwind-dw2.h
+++ b/libgcc/unwind-dw2.h
@@ -50,6 +50,12 @@ typedef struct
     } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
     unsigned char how[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 
+    enum {
+      CFA_UNSET,
+      CFA_REG_OFFSET,
+      CFA_EXP
+    } cfa_how : 8;
+
     /* Used to implement DW_CFA_remember_state.  */
     struct frame_state_reg_info *prev;
 
@@ -58,11 +64,6 @@ typedef struct
     _Unwind_Sword cfa_offset;
     _Unwind_Word cfa_reg;
     const unsigned char *cfa_exp;
-    enum {
-      CFA_UNSET,
-      CFA_REG_OFFSET,
-      CFA_EXP
-    } cfa_how;
   } regs;
 
   /* The PC described by the current frame state.  */

base-commit: 3dfeda095bd43c011fdc3834b9cec39bb9a73a1f


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libgcc: Move cfa_how into potential padding in struct frame_state_reg_info
  2022-10-14 16:44 [PATCH] libgcc: Move cfa_how into potential padding in struct frame_state_reg_info Florian Weimer
@ 2022-10-14 18:00 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2022-10-14 18:00 UTC (permalink / raw)
  To: Florian Weimer via Gcc-patches; +Cc: Florian Weimer

Florian Weimer via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On many architectures, there is a padding gap after the how array
> member, and cfa_how can be moved there.  This reduces the size of the
> struct and the amount of memory that uw_frame_state_for has to clear.
>
> There is no measurable performance benefit from this on x86-64 (even
> though the memset goes from 120 to 112 bytes), but it seems to be a
> good idea to do anyway.
>
> libgcc/
>
> 	* unwind-dw2.h (struct frame_state_reg_info): Move cfa_how member
> 	and reduce its size.

OK, thanks.

Richard

>
> ---
>  libgcc/unwind-dw2.h | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/libgcc/unwind-dw2.h b/libgcc/unwind-dw2.h
> index af34e000f07..a0834b18277 100644
> --- a/libgcc/unwind-dw2.h
> +++ b/libgcc/unwind-dw2.h
> @@ -50,6 +50,12 @@ typedef struct
>      } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
>      unsigned char how[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
>  
> +    enum {
> +      CFA_UNSET,
> +      CFA_REG_OFFSET,
> +      CFA_EXP
> +    } cfa_how : 8;
> +
>      /* Used to implement DW_CFA_remember_state.  */
>      struct frame_state_reg_info *prev;
>  
> @@ -58,11 +64,6 @@ typedef struct
>      _Unwind_Sword cfa_offset;
>      _Unwind_Word cfa_reg;
>      const unsigned char *cfa_exp;
> -    enum {
> -      CFA_UNSET,
> -      CFA_REG_OFFSET,
> -      CFA_EXP
> -    } cfa_how;
>    } regs;
>  
>    /* The PC described by the current frame state.  */
>
> base-commit: 3dfeda095bd43c011fdc3834b9cec39bb9a73a1f

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-14 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 16:44 [PATCH] libgcc: Move cfa_how into potential padding in struct frame_state_reg_info Florian Weimer
2022-10-14 18:00 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).