unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: vibhavp@gmail.com
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	Eli Zaretskii <eliz@gnu.org>, Po Lu <luangruo@yahoo.com>
Cc: rms@gnu.org, akrl@sdf.org, emacs-devel@gnu.org
Subject: Re: scratch/comp-static-data 5aa3db2f11: comp: Add support for compiling elisp constants into static data.
Date: Mon, 21 Nov 2022 21:29:11 +0530	[thread overview]
Message-ID: <6735426c1ff66c639ac26e6ae9bb9fffae99f2d7.camel@gmail.com> (raw)
In-Reply-To: <jwvo7t131tu.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1672 bytes --]

On Sun, 2022-11-20 at 13:47 -0500, Stefan Monnier wrote:
> > The follow elisp snipper is an example of code that when compiled
> > under
> > this branch, crashes Emacs:
> > ;; -*- lexical-binding: t; -*-
> > (defun fault-function ()
> >   (let ((a [1 2 3]))
> >     (aset a 0 5)
> >     a))
> 
> I'm not deluded enough to think it's currently impossible to crash
> Emacs
> with a well-crafted piece of ELisp code, but we do aim for that, so
> this
> would be a significant step backwards :-(
> 
> Can we change your patch so that it makes the section writable rather
> than ".rodata"?
> 

Indeed, making static lisp data variables constants was an afterthought
before I pushed the first draft. Currently, it's line 2889 in
src/comp.c@320e9ab048. Removing the call to `gcc_jit_type_get_const'
should make them writeable as usual.

However, as part of emitting the lisp data as read only, I also made it
so that such objects have their GC mark bit set, so that GC does not
crash Emacs as it attemps to mark these objects, skipping them instead.
This property can therefore be used to check whether an object being
modified is mutable or not à la `CHECK_IMPURE'. A more general variant
of the macro, `CHECK_MUTABLE' could be defined as

(PURE_P (ptr) || object_marked_p (ptr) ? pure_wire_error (obj) : (void)
0)

This lets us keep them as read-only and preventing illegal
modifications resulting in a crash. If this sounds good, I try adding
these changes soon, otherwise remove the call to
`gcc_jit_type_get_const'.

Best,
Vibhav
-- 
Vibhav Pant
vibhavp@gmail.com
GPG: 7ED1 D48C 513C A024 BE3A  785F E3FB 28CB 6AB5 9598

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

  reply	other threads:[~2022-11-21 15:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166844679660.19180.3470364122428955894@vcs2.savannah.gnu.org>
     [not found] ` <20221114172637.78215C0E4C7@vcs2.savannah.gnu.org>
2022-11-15  0:30   ` scratch/comp-static-data 5aa3db2f11: comp: Add support for compiling elisp constants into static data Po Lu
2022-11-15  9:06     ` Andrea Corallo
2022-11-16 19:36       ` Vibhav Pant
2022-11-17 19:59         ` Andrea Corallo
2022-11-17  4:32       ` Richard Stallman
2022-11-17  8:46         ` Vibhav Pant
2022-11-18  5:07           ` Richard Stallman
2022-11-18  8:28             ` Eli Zaretskii
2022-11-20  1:15               ` Richard Stallman
2022-11-20  7:37                 ` Eli Zaretskii
2022-11-20 16:37                   ` vibhavp
2022-11-20 16:54                     ` Eli Zaretskii
2022-11-20 18:47                     ` Stefan Monnier
2022-11-21 15:59                       ` vibhavp [this message]
2022-11-21  0:37                     ` Po Lu
2022-11-16 19:26     ` Vibhav Pant
2022-11-17  4:51       ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6735426c1ff66c639ac26e6ae9bb9fffae99f2d7.camel@gmail.com \
    --to=vibhavp@gmail.com \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).