emacs-devel
[Top][All Lists]
Advanced

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

Re: How to add pseudo vector types


From: Stephen Leake
Subject: Re: How to add pseudo vector types
Date: Sun, 25 Jul 2021 22:10:12 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stephen Leake <stephen_leake@stephe-leake.org>
>> Cc: Yuan Fu <casouri@gmail.com>,  cpitclaudel@gmail.com,
>>   monnier@iro.umontreal.ca,  emacs-devel@gnu.org
>> Date: Sun, 25 Jul 2021 11:01:22 -0700
>> 
>> >> How do we handle such thing in Emacs?
>> >
>> > We use xmalloc, which calls memory_full when allocation fails, which
>> > releases some spare memory we have for this purpose, and tells the
>> > user to save the session and exit.
>> 
>> I'm thinking about how this applies to wisi, when migrating to a module.
>> 
>> Ada has a built-in allocator; it's probably possible to change that, but
>> I'd like to understand exactly why we need to do that.
>
> We need that to allow the user to save the session while he/she can.
>
>> The Ada allocator throws an exception on allocation fail; is it
>> sufficient to turn that exception into an elisp signal, and arrange for
>> elisp to call memory_full (or take some other action, like killing the
>> parser)?
>
> What is a "lisp signal" in this context?

The module interface layer of wisi.el would do:

    (signal 'error "parser ran out of memory")

>> Another possible reason to change the Ada allocator is if we want to
>> expose Ada memory pointers directly to elisp, as Yuan Fu wants to do for
>> tree-sitter (I don't plan to do this for wisi). Does that require that
>> the pointers be allocated by the same allocator?
>
> Same allocator as what?

As other lisp symbols.

>> I'm not clear what that would mean for the garbage collector; is it
>> then expected to recover the tree-sitter-allocated memory for the
>> tree? or does it ignore those lisp objects?
>
> It depends on which Lisp object you wrap those pointers.  User-pointer
> object allow you to provide your own "finalizer" function.

Ok, that would work.

-- 
-- Stephe



reply via email to

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