From owner-svn-src-all@FreeBSD.ORG Sun Apr 11 09:16:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7412106566B; Sun, 11 Apr 2010 09:16:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 79EAA8FC12; Sun, 11 Apr 2010 09:16:16 +0000 (UTC) Received: from c122-106-168-84.carlnfd1.nsw.optusnet.com.au (c122-106-168-84.carlnfd1.nsw.optusnet.com.au [122.106.168.84]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o3B9GCxI012004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 Apr 2010 19:16:14 +1000 Date: Sun, 11 Apr 2010 19:16:12 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Roman Divacky In-Reply-To: <201004091521.o39FLBqx035856@svn.freebsd.org> Message-ID: <20100411175432.S10835@delplex.bde.org> References: <201004091521.o39FLBqx035856@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206424 - head/usr.bin/xlint/lint1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2010 09:16:17 -0000 On Fri, 9 Apr 2010, Roman Divacky wrote: > Log: > Rename the ALIGN macro to LINT_ALIGN so it does not clash with machine/param.h > > Bump the alignment to 16bytes because lint1 memory allocator is used for > objects that require 16bytes alignment on amd64 (ie. val_t). This makes > lint1 work when compiled with compiler(s) that use SSE for memcpy on amd64. > (e.g. clang). This seems to be mostly backwards. xlint wants to use the system ALIGN(), since it has no way of knowing the correct alignment. However, the system might not supply ALIGN(), so it provided its own probably-incorrect ALIGN() as a fallback. FreeBSD has a system ALIGN() and it should have always been used. xlint get the includes correct for this, though this is fragile. However2, the system ALIGN() on amd64 doesn't know the correct alignment either (both essentially had 64 bits hard-coded). Now xlint uses a different hard-coded alignment (128 bits). For a non-backwards fix, you need to follow the comment in xlint which says ALIGN should go away [in xlint]. Other compilers might need a working system ALIGN() in other places. I think only memory allocator in xlint needs a working ALIGN() (just 1 instance). Perhaps the allocator should just use malloc(). The only other uses of ALIGN() are in getbound(). These seem to be all completely wrong. The all use ALIGN(1), where ALIGN() is the host or hard-coded ALIGN() which gives maximal alignment and 1 is the size of a char, where SALIGN(type), where SALIGN() is the source ALIGN() which gives the (usually non-maximal) alignment of a type and the `type' parameter must contain type info and not be just the size of the type (certainly not the size of another type) since types of the same size may have different alignment. SALIGN() is much more impossible to write as a portable macro. Bruce