[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamic loading progress
From: |
Aurélien Aptel |
Subject: |
Re: Dynamic loading progress |
Date: |
Tue, 17 Mar 2015 10:28:13 +0100 |
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.
> 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.
> Any comments on the coding style? I don't think I need GCPRO on any of
There's no GC protection in the module API yet. I think there are some
place of your module that might not be safe. See below.
> the static emacs_values, because they are all declared at global level
> in elisp.
I had not thought about that: global refs can be defined in pure
elisp. That indeed removes the need for registering global values via
the module API.
I'm still not sure I understand what Daniel had in mind for
global/local value registration, I'm kind of waiting for his reply to
move forward. I'll try reading more thoroughly the JNI document he
linked in a previous message in the meantime.
> 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.
- Re: Dynamic loading progress, (continued)
Re: Dynamic loading progress, Stephen Leake, 2015/03/05
Re: Dynamic loading progress, Stephen Leake, 2015/03/05
Re: Dynamic loading progress, Stephen Leake, 2015/03/16
Re: Dynamic loading progress, Stephen Leake, 2015/03/17
Re: Dynamic loading progress, Stephen Leake, 2015/03/24