emacs-devel
[Top][All Lists]
Advanced

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

Re: Dynamic loading progress


From: Stephen Leake
Subject: Re: Dynamic loading progress
Date: Tue, 17 Mar 2015 09:50:41 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Aurélien Aptel <address@hidden> writes:

> On Mon, Mar 16, 2015 at 7:02 PM, Stephen Leake
> <address@hidden> wrote:
>> I've implemented a test module that calls two Ada mode parser actions
>> (see below).
>>
>> The real module will call the actual parser and build the action args
>> from the parse results.
>>
>> I did not have to modify anything in the Emacs C code to make this work,
>> so it shows this module design is adquate for my use case so far.
>
> Good! I'd be interested in performance comparison between the pure
> elisp version and this module version. I suspect it's not going to be
> much unfortunately. You module doesn't seem to be resource intensive
> (as of now) anyway.

It doesn't currently do anything; it just explors how to call elisp from
the module. It will eventually call the full lexer and parser.

>> I still need to implement the lexer level, which will either need to
>> call the current elisp lexer, or access the buffer text directly.
>
> No buffer or string access yet, sorry. I guess you can work around it
> by retrieving each character as an int but that's neither practical
> nor efficient.

Right. But I'd like to try calling the ada-mode elisp lexer function
anyway; less code to port to the module, and I suspect it's faster.

>>   emacs_value tokens[] =
>>     {  /* name "A" */
>>       Fcons (env, ada_grammar_names[245], Fcons (env, env->make_fixnum (env, 
>> 24), env->make_fixnum (env, 25))),
>>
>>        /* COLON_EQUAL ":=" */
>>       Fcons (env, ada_grammar_names[ 81], Fcons (env, env->make_fixnum (env, 
>> 26), env->make_fixnum (env, 28))),
>>
>>        /* expression "1" */
>>       Fcons (env, ada_grammar_names[194], Fcons (env, env->make_fixnum (env, 
>> 29), env->make_fixnum (env, 30))),
>>
>>        /* SEMICOLON ";" */
>>       Fcons (env, ada_grammar_names[ 95], Fcons (env, env->make_fixnum (env, 
>> 30), env->make_fixnum (env, 31)))
>>     };
>
> ^^^^ all those conses can be GC'd if any of the code afterwards can
> call the GC. It might not be the case right now put it probably will
> at some point. I'm not sure about this but if you call a pure-elisp
> function the GC will trigger.

Right. This is a temporary list built as an argument to an elisp call. I
want it to be garbage collected after the call, but not during.

module_funcall in module.c copies the args (shallow copy only) and does
GCPRO1 on the copy (actually on the first element of the copy), then
does the actual funcall, followed by GCUNPRO. Is that sufficient? 

On the other hand, can we eliminate the copy to save time? I think all
we need to do is include 'fun' in 'args', as the standard lisp syntax does.

-- 
-- Stephe



reply via email to

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