Hello Erich,

Erich Waelde <ew.fo...@nassur.net> writes:

> Hi Enoch,
>
> On 12/19/2013 03:25 PM, Enoch wrote:
>> Hello AmForth-ers:
>> 
>> I don't think that people look for speed when considering any Forth --
>> modern optimizing C compilers will do better.
>> 
>> Nevertheless, I think that we need to rid AmForth kernel ASAP of VM
>> instruction calls (those pesky XT_'s) and leave them for compiled code
>> output only. Let's start with a common construct such as the "do
>> ... loop" (words/do.asm).
>
> What exactly are you trying to achieve?

Make AmForth a bit faster by imlementing popular words in AVR
instruction set rather than in AmForth VM instruction set.

Let's pick an easy example at random. This is currently abs ( n -- u )
implementation:

XT_ABS:
    .dw DO_COLON
PFA_ABS:
    .dw XT_DUP
    .dw XT_LESSZERO
    .dw XT_DOCONDBRANCH
    .dw PFA_ABS1
    .dw XT_NEGATE
PFA_ABS1:
    .dw XT_EXIT

In my opinion it should be implemented as follows:

XT_ABS:
    .dw PFA_ABS
PFA_ABS:
    TST TOSH
    BRPL PFA_ABS1
    COM TOSL
    COM TOSH
    ADIW TOSH:TOSL, 1
PFA_ABS1:
    JMP_ DO_NEXT

> To be honest, in my eyes, amForth used to be a very simple system.
> minimal core written in assembly, rest written in Forth --- thats
> what the calls to XT_* amount to. This I can understand and modify.
> If all those "pesky XT_*" calls are replaced by assembly, then the
> simplicity for my eyes goes away. So, no, I'm not convinced that
> this gains anything I would prefer. I prefer code readability over
> speed.

"Simplicity" is in the eyes of the beholder :-)

Frankly, I get along better with the AVR instruction set than with those
XT_* -s.  As for the speed improvement, wouldn't the above asm run at
least X5 faster?

> optimization: one round through the inner interpreter takes some
> 50 clock cycles. That is the figure I use. If I need anything
> faster than that, asm is called for.
>
> Happy hacking,

I was suggesting a group hacking effort where Matthias marks which words
to rewrite. Alone it is too much time consuming. I just did in asm what
I felt was absolutely necessary and missing from AmForth. For example,
soft interrupts handler (aka, second-level interrupts), interrupt based
RTS/CTS/DTR serial communication and some more bits and pieces.

Cheers, Enoch.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to