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

Re: Question about ingetc() vs. word-code

On 08.07.2017 at 23:42:59, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> > Why the compiled, not-eval source still exist in hunks in ingetc() input? Many times.  
> The eval-code also appears, but this is probably expected.
> The compiled wordcode includes all the original text of most strings
> and identifiers, so that XTRACE and VERBOSE output can be properly
> reproduced. Only shell lexical tokens are turned into numeric codes.
> Identifiers that are referenced as well as assigned will appear at
> each $NAME expansion or function name call.

Ok, got it. I also think that I understand why stringsubst(), prefork(), etc. are called that often – to decode flags, perform substitution, obtain actual value.

> A possible optimization for compiling whole digests of related
> functions would be to build an identifier dictionary and refer to the
> identifiers by a wordcode value followed by an offset into the
> dictionary, but this would be wasteful for most small/single-function
> compilations and would complicate the XTRACE playback.

I'm thinking about converting WC_SUBLIST to WC_SUBLIST_SIMPLE. Comment in parse.c says *_SIMPLE lists are executed faster. But the topic is difficult, and I'm not having much time, so my tempo for this is low. I think this might be related to has_token(), to simple actions (not sure if could write "simple lists" here) instead of prefork(), etc. But unsure if current token-detection is over-possitive. If I could simplify word-code, it would lead to situation, where normal Zsh compilation does things in stable way, while Zplugin's compilation would do things in hackish way, possibly for specific functions only. So both ways would be meaningful, could exist concurrently.

Sebastian Gniazdowski
psprint /at/ zdharma.org

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