From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. Date: Wed, 02 Jul 2014 19:13:24 +0400 Message-ID: <53B42194.2040003@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1404314065 29219 80.91.229.3 (2 Jul 2014 15:14:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jul 2014 15:14:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 02 17:14:16 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X2MEi-0007yh-6T for ged-emacs-devel@m.gmane.org; Wed, 02 Jul 2014 17:14:16 +0200 Original-Received: from localhost ([::1]:54539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2MEh-0005p8-7I for ged-emacs-devel@m.gmane.org; Wed, 02 Jul 2014 11:14:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2MEP-0005Wn-DN for emacs-devel@gnu.org; Wed, 02 Jul 2014 11:14:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2MEH-0004iw-GS for emacs-devel@gnu.org; Wed, 02 Jul 2014 11:13:57 -0400 Original-Received: from forward7.mail.yandex.net ([77.88.61.37]:60059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2MEH-0004dq-6t for emacs-devel@gnu.org; Wed, 02 Jul 2014 11:13:49 -0400 Original-Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward7.mail.yandex.net (Yandex) with ESMTP id 018871C0CA8; Wed, 2 Jul 2014 19:13:25 +0400 (MSK) Original-Received: from smtp6.mail.yandex.net (localhost [127.0.0.1]) by smtp6.mail.yandex.net (Yandex) with ESMTP id 213371640784; Wed, 2 Jul 2014 19:13:25 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp6.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3hBqWhROrN-DORSAsHq; Wed, 2 Jul 2014 19:13:24 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: b8627abe-0662-462b-8b4a-28134e092d56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1404314004; bh=TWxzS1ea9gSaYemktM2e1qz+DXXfDiVUkz6M723qXes=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=eGBWDdhudKWs38+073I/V7Q0IAqYVroFj230uXTkwyFyHR2ghvRMZDVm5H9x67PQq uDlWjeJPLOk4fogGCtKQAFlf/YdKhTkrHtUxQO8gxkk4wEbF7AqKdOxoozUQ9Yax3m 8Au7GrVwGksLcwtL4tmqrAEZAQ1aLr/CD0OXaWH0= Authentication-Results: smtp6.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 77.88.61.37 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:172850 Archived-At: On 07/02/2014 06:30 PM, Stefan Monnier wrote: > Are we sure this SUB_CHAR_TABLE_OFFSET exists? I don't see any reason > why `contents' should necessarily be aligned on a multiple of Lisp_Objects. Strictly speaking, you're right. ISO C99 says (6.7.2.1) just: "Each non-bit-field member of a structure or union object is aligned in an implementation-defined manner appropriate to its type." In fact, on a 64-bit system and 32-bit system with --with-wide-int, sizeof (int) is 4 and sizeof (Lisp_Object) is 8. On a 64-bit system, any reasonable compiler should pack 2 integers to 8-byte area, so SUB_CHAR_TABLE_OFFSET is 1; if the compiler is stupid and packs each field to 8-byte slot, SUB_CHAR_TABLE_OFFSET is 2. On a 32-bit system, SUB_CHAR_TABLE_OFFSET is 2 if sizeof (Lisp_Object) is 4 and 1 if sizeof(Lisp_Object) is 8; anyway, it should be aligned (unless some packing tricks are in effect?) > So, I think it's unsafe to cast your new "struct Lisp_Sub_Char_Table" > to a "struct Lisp_Vector". Maybe it does work on current existing > systems, but it's too fragile. I'll install verify() to catch future (broken) systems. Dmitry