Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: parser (was: Re: PATCH: Improved _mailboxes)



Andrej Borsenkow wrote:

> > Here is the first of the two. As I said, this mainly makes the parser
> > create wordcode directly, no more extra compilation phase.
> 
> Sounds really interesting ... Two questions.
> 
> Is the code position-independent?

Yes, I took care of that to make copying easier and allow other things 
(memory compaction?).

> Is now code-compiler separated from code-interpreter?

There is now nothing I would really call a compiler anymore.

> The main reason for these questions - is it possible to precompile Zsh
> function, store it and then execute directly? This may be intersted in many
> cases - primary use is completion. Precompile completion functions; put
> byte-code in single file; mmap this file. I do not know about speed increase
> (if any) - but it should dramatically reduce RAM footprint on multiuser
> systems. Currently every shell compiles every function on it's own and it
> goes in private memory - and that is real RAM (O.K., it is real swap on some
> systems :-) mmap'ing precompiled byte-code would mean, that just a single
> copy exists.

That would indeed be possible. The wordcode is position- and machine-
independent.

> It may be useful to generalize it to allow byte-code be the contents of
> variable. Then Zsh could simply execute the content of
> 
> mapfile[/path/to/precompiled/file] ... may be, not as directly - with
> something like imaginal zcompiler module
> 
> zcodeload file

All this also makes me think about a way to allow multiple zsh's to
share other memory bits (like the command table and so on). How
portable is anonymous shared mmap or shared mmap on /dev/null?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author