Re: [PATCH v2] slof/engine.in: refine +COMP and -COMP by not using COMPILE

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

 



Hi,

On 2024-02-23 14:57:23, Segher Boessenkool wrote:
> 
> I think both changes are bad.  They reduce abstraction, for no reason at
> all.
> 
> If you think the compiler should inline more, or do better optimisations
> even, work on *that*, don't do one unimportant case of it manually.
> 
> I never made the indirect threading engine in Paflof faster, because it
> was plenty fast already.  In SLOF, almost everything is compiled at
> runtime, and if it is important to speed that up there are some well-
> known usual caching tricks to make things *factors* faster.  The main
> focus points for SLOF were to have an engine that is easily adapted for
> different purposes (and it was! Ask me about it :-) ), and to have
> things using it as debuggable as possible (you really need some hardware
> debugging thing to make it real easy; I had one back then.  You need to
> be able to look at all memory state after a stop (a crash, perhaps), and
> seeing all CPU registers is useful as well.
> 
> If you want to improve engine.in, get rid of it completely?  Make the
> whol thing cross-compile perhaps.  Everything from source code.  The
> engine.in thing is essentially an already compiled thing (but not
> relocated yet, not fixed to some address), which is still in mostly
> obvious 1-1 correspondence to it source code, which can be easily
> "uncompiled" as well.  Like:

:-). Getting rid of it completely and making the whole thing
cross-compile would require more time that I'm not so sure that I or
even my manager would be able to spare in our project.

> 
> col(+COMP STATE @ 1 STATE +! 0BRANCH(1) EXIT HERE THERE ! COMP-BUFFER DOTO HERE COMPILE DOCOL)
> col(-COMP -1 STATE +! STATE @ 0BRANCH(1) EXIT COMPILE EXIT THERE @ DOTO HERE COMP-BUFFER EXECUTE)
> 
> : +comp  ( -- )
>   state @  1 state +!  IF exit THEN
>   here there !
>   comp-buffer to here
>   compile docol ;
> : -comp ( -- )
>   -1 state +!
>   state @ IF exit THEN
>   compile exit
>   there @ to here
>   comp-buffer execute ;
> 
> "['] semicolon compile," is not something a user would ever write.  A
> user would write "compile exit".  It is standard Forth, it works
> anywhere.  It is much more idiomatic..

Okay, I can accept the fact that maybe we should use EXIT instead of
SEMICOLON. But at least can we remove the invocation of the "COMPILE"
keyword in +COMP and -COMP ? The rest of the compiler in slof/engine.in
uses the standard "DOTICK <word> COMPILE," format so why cannot we use
this for -COMP as well as +COMP ?


> 
> 
> Segher




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux