From owner-freebsd-current Thu Nov 7 22:53: 6 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02CBB37B401 for ; Thu, 7 Nov 2002 22:53:05 -0800 (PST) Received: from clover.kientzle.com (user-112uh9a.biz.mindspring.com [66.47.69.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF4FF43E3B for ; Thu, 7 Nov 2002 22:53:03 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org (c43 [66.47.69.43]) by clover.kientzle.com (8.11.3/8.11.3) with ESMTP id gA86r2E40050 for ; Thu, 7 Nov 2002 22:53:02 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <3DCB5F4E.6050203@acm.org> Date: Thu, 07 Nov 2002 22:53:02 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: current@freebsd.org Subject: Minor size optimization Content-Type: multipart/mixed; boundary="------------010405020706070809020902" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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