Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Nov 2002 22:53:02 -0800
From:      Tim Kientzle <kientzle@acm.org>
To:        current@freebsd.org
Subject:   Minor size optimization
Message-ID:  <3DCB5F4E.6050203@acm.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010405020706070809020902
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

The attached diff shaves four bytes
from every syscall wrapper (e.g., __sys_write, etc.)

In looking carefully at library sizes, I became
curious why a simple system call required 20
bytes; turns out a lot
of that was alignment padding.

Tim Kientzle

--------------010405020706070809020902
Content-Type: text/plain;
 name="kientzle_rsyscall.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="kientzle_rsyscall.diff"

Index: lib/libc/i386/SYS.h
===================================================================
RCS file: /mnt/cvs/src/lib/libc/i386/SYS.h,v
retrieving revision 1.24
diff -c -r1.24 SYS.h
*** lib/libc/i386/SYS.h	17 Sep 2002 01:48:51 -0000	1.24
--- lib/libc/i386/SYS.h	8 Nov 2002 06:15:21 -0000
***************
*** 48,54 ****
  			.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
  			mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b
  
! #define	RSYSCALL(x)	SYSCALL(x); ret
  
  #define	PSEUDO(x)	ENTRY(__CONCAT(__sys_,x));			\
  			.weak CNAME(__CONCAT(_,x));			\
--- 48,63 ----
  			.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
  			mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2b
  
! /* Version 1: More compact source */
! /* #define	RSYSCALL(x)	SYSCALL(x); ret */
! /* Version 2: More compact object code (fewer alignment requirements) */
! #define	RSYSCALL(x) 	ENTRY(__CONCAT(__sys_,x));			\
! 			.weak CNAME(x);					\
! 			.set CNAME(x),CNAME(__CONCAT(__sys_,x));	\
! 			.weak CNAME(__CONCAT(_,x));			\
! 			.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
! 			mov __CONCAT($SYS_,x),%eax; KERNCALL; jb 2f; ret; \
! 			2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror))
  
  #define	PSEUDO(x)	ENTRY(__CONCAT(__sys_,x));			\
  			.weak CNAME(__CONCAT(_,x));			\

--------------010405020706070809020902--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DCB5F4E.6050203>