[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Update on scratch/comp-static-data

From: Vibhav Pant
Subject: Update on scratch/comp-static-data
Date: Fri, 10 Feb 2023 18:30:09 +0530
User-agent: Evolution 3.46.3


I've done some more work on scratch/comp-static-data, and the branch
should be more readable and useable as a daily driver. To recap, the
branch adds code to the native compiler to compile self-evaluating
forms/literal objects as static consts inside the eln itself with the
goal of reducing heap pressure, GC times, and making eln loads faster.

Eli and Richard had pointed out that emitting lisp data as const would
make it easy to crash Emacs, so one of the few changes I've made is to
add an additional check to `CHECK_IMPURE` to see if the object in
question is statically emitted. These objects are perma-marked, so the
check just consists of reading the mark bit on the object. Aside from
not making Emacs crash, it also enforces the immutability of self-
evaluting forms more stringently, something that the elisp reference
manual also indicates is a likely future direction for the language:

The code has already helped me unearth a few instances of read-only
objects being incorrectly modified in cconv
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60974), gnus, and
shortdoc. As such, it should be okay to daily-drive.

While I'm still working on a way to benchmark and measure performance
improvements, one clear indicator is the reduction in the heap size as
reported by `garbage-collect`/`memory-report`, the output of which I've
attached (running on my config, as memory-report on `emacs -Q` consumes
little memory to begin with).

I have also attached the psuedo-C output from libgccjit for a sample
elisp file that demos the error raised when an immutable literal is

While there are still a couple of small TODOs to be addressed, I would
love any and all feedback on the code.


Vibhav Pant
GPG: 7ED1 D48C 513C A024 BE3A  785F E3FB 28CB 6AB5 9598

Attachment: memory-report-comp-static-data.txt
Description: Text document

Attachment: memory-report-master.txt
Description: Text document

Attachment: literal-modify.c
Description: Text Data

Attachment: literal-modify.el
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]