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: [RFC] temporary Lisp_Strings Date: Tue, 02 Sep 2014 17:47:15 +0400 Message-ID: <5405CA63.9090405@yandex.ru> References: <5405BE5D.1090003@yandex.ru> 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 1409665661 4371 80.91.229.3 (2 Sep 2014 13:47:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Sep 2014 13:47:41 +0000 (UTC) Cc: Emacs development discussions To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 02 15:47:35 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 1XOoQo-0001ks-Sr for ged-emacs-devel@m.gmane.org; Tue, 02 Sep 2014 15:47:35 +0200 Original-Received: from localhost ([::1]:38236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOoQo-0004dJ-GG for ged-emacs-devel@m.gmane.org; Tue, 02 Sep 2014 09:47:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOoQf-0004dD-Mz for emacs-devel@gnu.org; Tue, 02 Sep 2014 09:47:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOoQZ-00060e-Ky for emacs-devel@gnu.org; Tue, 02 Sep 2014 09:47:25 -0400 Original-Received: from forward5j.cmail.yandex.net ([5.255.227.23]:59287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOoQZ-00060M-Aw for emacs-devel@gnu.org; Tue, 02 Sep 2014 09:47:19 -0400 Original-Received: from smtp11.mail.yandex.net (smtp11.mail.yandex.net [95.108.130.67]) by forward5j.cmail.yandex.net (Yandex) with ESMTP id 4D5021850; Tue, 2 Sep 2014 17:47:16 +0400 (MSK) Original-Received: from smtp11.mail.yandex.net (localhost [127.0.0.1]) by smtp11.mail.yandex.net (Yandex) with ESMTP id 14C707E0249; Tue, 2 Sep 2014 17:47:15 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp11.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id dSWdOnP2r4-lFR0XEZu; Tue, 2 Sep 2014 17:47:15 +0400 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 31319e9e-f570-41d3-b327-8a5c78f126fb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1409665635; bh=QLJP0/XMCL7ntdGmBqMrJSHAOnrccU7PDF/jj31MSnI=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=VQZArjqCbzlix8N6jYtKPGMaAtA1BtJC3Xq+a8q3KIIKRmKSyw33M6iXr6Y8L8dyt Opi5YmtmmMOSUyObR8nV2A/a9uSf4PnW6PzGVqmz6wGbyW9BbdbttJoYf8u0c8DLwQ vgnzqZ8SihzYOwS8l9Fb2C2I7pLprYwjQQl6aLuE= Authentication-Results: smtp11.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.255.227.23 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:173949 Archived-At: On 09/02/2014 05:21 PM, Andreas Schwab wrote: > There is none. The stack could be in a completely different address > region that may not be suitable in non-USE_LSB_TAG configurations. IIUC non-USE_LSB_TAG configurations are not widely used, so this is a tier-2 problem. >> +#define alloca_string(str) \ >> + ({ Lisp_Object string; \ >> + struct Lisp_String *s; \ >> + ptrdiff_t nchars, nbytes, size = strlen (str); \ >> + parse_str_as_multibyte ((const unsigned char *) str, \ >> + size, &nchars, &nbytes); \ >> + s = alloca (sizeof *s + nbytes + 1); \ >> + s->data = (unsigned char *) s + sizeof (*s); \ >> + memcpy (s->data, str, nbytes); \ >> + s->data[size] = '\0'; \ >> + s->intervals = NULL; \ >> + if (nbytes == nchars || nbytes != size) \ >> + s->size = size, s->size_byte = -1; \ >> + else \ >> + s->size = nchars, s->size_byte = nbytes; \ >> + XSETSTRING (string, s); string; }) > > This will eventually fail with USE_LSB_TAG, since you don't enforce > alignment. What about alignment guaranteed by alloca? IIUC compilers tends to align it enough to US_LSB_TAG: http://msdn.microsoft.com/en-us/library/x9sx5da1.aspx https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55945 Dmitry