From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Wed, 14 Oct 2015 15:38:27 -0700 Message-ID: <561ED963.4050207@dancol.org> References: <87vbj8tow4.fsf@lifelogs.com> <87r3twtagf.fsf@lifelogs.com> <85siebl7ws.fsf@stephe-leake.org> <85a90ilwmm.fsf@stephe-leake.org> <83386a6f7z.fsf@gnu.org> <85h9upjz7v.fsf@stephe-leake.org> <83wq3k3kl4.fsf@gnu.org> <85bnkwil1c.fsf@stephe-leake.org> <83pp9cwky8.fsf@gnu.org> <85a90ggf2d.fsf@stephe-leake.org> <54E0A40F.5080603@dancol.org> <83sie7un20.fsf@gnu.org> <54E0D181.2080802@dancol.org> <83r3trulse.fsf@gnu.org> <54E0D7E0.305@[87.69.4.28]> <83h9unukbg.fsf@gnu.org> <54E0DEF8.7020901@dancol> <83egpruiyp.fsf@gnu.org> <54E0FF93.2000104@dancol.org> <5610ED13.1010406@dancol.org> <56117F37.9060808@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bhE04dvbAD6Hb07TnG8RESvHMHi7p2XCE" X-Trace: ger.gmane.org 1444862410 16668 80.91.229.3 (14 Oct 2015 22:40:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Oct 2015 22:40:10 +0000 (UTC) Cc: =?UTF-8?Q?Aur=c3=a9lien_Aptel?= , stephen_leake@stephe-leake.org, emacs-devel@gnu.org To: Philipp Stephani , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 15 00:40:02 2015 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 1ZmUiF-0005f0-Us for ged-emacs-devel@m.gmane.org; Thu, 15 Oct 2015 00:40:00 +0200 Original-Received: from localhost ([::1]:44820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmUiF-0003eQ-6n for ged-emacs-devel@m.gmane.org; Wed, 14 Oct 2015 18:39:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmUgz-0003Z4-FZ for emacs-devel@gnu.org; Wed, 14 Oct 2015 18:38:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmUgy-0008OQ-FP for emacs-devel@gnu.org; Wed, 14 Oct 2015 18:38:41 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:49943) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmUgy-0008OK-3x; Wed, 14 Oct 2015 18:38:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject; bh=JpZHqPKDYrEtQhtS2tCF81swl4okQSI0nEUpbnmTI8k=; b=ndS33TQeibq5GnsfHuqNjG8u1g1hHnmT1GRulmQKKZx7yts2+2BjDLbOKGnGPqLgE5zYrSxzQUnFzwhJpBCq6O+iUQWrAlbxjIqXgoyi+uLzq9uMo/j1PaKktwGS2KSxb9nsQ2IJaZ2ObUoZh0TZFjl9yjssIFMiP+xXDxgQYkg0sEi/BZj8DrA+MOncjHk1x1q1mjZ9//m3Ks7QPPI+5JLd8Gw7URCCOGilwEsMjJ85oBH6sRdZWkkq6joyEvlkS3bzIOsrm2+OlJ2530IIfO28Zo+5HxbDoemYcVuq3FUS0O3HmrRIV4DxOdZI+CXeK2UQLnflZci/Lb/uWytIaQ==; Original-Received: from [2620:10d:c090:200::6:7b22] (helo=[IPv6:2620:10d:c083:10fb:2ab2:bdff:fe1c:db58]) by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1ZmUgt-0007Rf-7N; Wed, 14 Oct 2015 15:38:35 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 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:191595 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bhE04dvbAD6Hb07TnG8RESvHMHi7p2XCE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/14/2015 03:34 PM, Philipp Stephani wrote: >=20 >=20 > Daniel Colascione > schrie= b > am So., 4. Okt. 2015 um 21:34 Uhr: >=20 > On 10/04/2015 02:41 AM, Philipp Stephani wrote: > > > > > > > > > typedef struct emacs_value_tag* emacs_value; > > > > > > > > > I think it's important that this is a pointer to a struct > (for type > > > safety and size correctness) rather than just an arbitrary = type. > > > > A typedef is exactly as typesafe. The question of whether to = use a > > struct or a typedef is aesthetic. I strongly prefer a typedef= , > just like > > pthreads, and I believe that the people who advocate using st= ructs > > directly are simply wrong. > > > > > > Ah, I'm not against the typedef, I'm just asking whether you woul= d > make > > it part of the API contract that it's a typedef of a struct > pointer, or > > whether it can be any type. >=20 > The problem with defining it as a pointer type is that NULL is now = the > invalid sentinel value, which seems incompatible with both making t= his > thing literally a Lisp_Object and Qnil having all zero bits. >=20 > That's why I strongly prefer making emacs_value a _pointer_ to a > Lisp_Object, where we store the Lisp_Object in an array owned by th= e > emacs_env. This way, allocating local values is very cheap. >=20 >=20 > A simple fixed array however puts a fixed upper bound on the number of > local values used. That might be undesirable, especially for plugins > dealing with large data structures. Right. That's why we have multiple such arrays, each of a pretty decent size, linked together. Something like this: struct emacs_value_frame { Lisp_Object objects[512]; struct emacs_value_frame* next; }; struct emacs_env_guts { ... struct emacs_value_frame initial_frame; struct emacs_value_frame* current_frame; }; We get 512 local references for free just as a side effect of having an emacs_env, and if we need more references, we can heap-allocate another emacs_value_frame and make it current. This way, a reasonable number of local references is free, but if you need more, you can have them. This is exactly the approach Java uses. --bhE04dvbAD6Hb07TnG8RESvHMHi7p2XCE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJWHtljAAoJEN4WImmbpWBlRFUQAItFTriaU1i3/OZuLh5F7DPi dSewUolREJZSfpDmnYOIZvtxUF4v/WWpMP+2mZqNo8bGuq3Ul2s88JXNWIkulbw3 5wN9a2DK6j8k+n2RjYI+pbbDOCrfqusITsdk+1VSM7vJZM2FTD6PlrburX55BwKB 6jvJzwM8gtWFP0ZOZ/4Wb6/3l9rlbiqTGeTuVPvLkMoB36RdyNYnMJvh8SmADhS7 F3Mxb4GpjNjPXBKKYITjorDMB+Tb2hzOhhuiiadd8xqERitmbJjtxYZ7iUBQ9Uxs Vwm1scLFbT2Bznq4GEf1jXLajtuU0v5G9Ro9ZZsVI1gmRNuAp8NrAkL5vrTscae4 nl8VSNy2PNyPWX+yg5DjrvjaS/u3/bpN54fXXP7WmA61QCd2u63ktf5rRawfYp5B zgKzbarOWwUpzVdJH40GRscq7EbJ1mkNuewynwyQRUim/IytjnaXVr+XiLyz6Jan vI4JTgYOg/4XVm1G1jx3IfAOOeD3gIAolqWun8ToY+o1ZcUm1f50wWf2/0S6fZqN h2JrqxaxLJV9WQMhlrCvY4i+g0QKmVmdpx0czrFiZ5w9HGq6DkaN3ZgQXNDrCOqI 0s3TBfJtAIeszJ7MqX0wPJXiwadNPAevmSD35tBVwO6su5aNFswCE9FyeXZLT6NG Brhn4ghzpH/FlBfT1NJQ =AfBo -----END PGP SIGNATURE----- --bhE04dvbAD6Hb07TnG8RESvHMHi7p2XCE--