FSL array indexing
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
FSL array indexing         


Author: Krishna Myneni
Date: Mar 8, 2008 10:04

Anybody know a good reason for the presence of SWAP in the following word, from
fsl-util.xxx?

: } ( addr n -- addr[n]) \ word that fetches 1-D array addresses
OVER CELL- @
* SWAP +
;

Also, do the native code optimizing compilers eliminate the unnecessary SWAP in
the compiled code?

Krishna
11 Comments
Re: FSL array indexing         


Author: C. G. Montgomery
Date: Mar 8, 2008 14:38

Krishna Myneni krishnamyneni@bellsouth.net wrote:
> Anybody know a good reason for the presence of SWAP in the following
> word, from fsl-util.xxx?
>
> : } ( addr n -- addr[n]) \ word that fetches 1-D array addresses
> OVER CELL- @
> * SWAP +
> ;
>
> Also, do the native code optimizing compilers eliminate the unnecessary
> SWAP in the compiled code?
>
> Krishna

Don't know where you found that fsl-util.xxx. I (well, grep) can't
find "swap +" anywhere in the library's files. Thank heavens. ;-)

cheers cgm
no comments
Re: FSL array indexing         


Author: Krishna Myneni
Date: Mar 8, 2008 17:35

C. G. Montgomery wrote:
> Krishna Myneni krishnamyneni@bellsouth.net wrote:
>
>> Anybody know a good reason for the presence of SWAP in the following
>> word, from fsl-util.xxx?
>>
>> : } ( addr n -- addr[n]) \ word that fetches 1-D array addresses
>> OVER CELL- @
>> * SWAP +
>> ;
>>
>> Also, do the native code optimizing compilers eliminate the unnecessary
>> SWAP in the compiled code?
>>
>> Krishna
>
> Don't know where you found that fsl-util.xxx. I (well, grep) can't
> find "swap +" anywhere in the library's files. Thank heavens. ;-)
>
> cheers cgm ...
Show full article (0.73Kb)
no comments
Re: FSL array indexing         


Author: Krishna Myneni
Date: Mar 8, 2008 20:27

Krishna Myneni wrote:
> Anybody know a good reason for the presence of SWAP in the following
> word, from fsl-util.xxx?
>
> : } ( addr n -- addr[n]) \ word that fetches 1-D array addresses
> OVER CELL- @
> * SWAP +
> ;
>
> Also, do the native code optimizing compilers eliminate the unnecessary
> SWAP in the compiled code?
>
> Krishna

Recoding "}" to remove the frivolous SWAP, and manually inlining the word CELL-
gave roughly an 8%% improvement in performance, in kForth, for a curve fitting
routine which uses array indexing heavily. The above definition of "}" is
replaced by

: } OVER [ 1 CELLS ] LITERAL - @ * + ;
Show full article (1.41Kb)
no comments
Re: FSL array indexing         


Author: C. G. Montgomery
Date: Mar 8, 2008 23:18

Krishna Myneni krishnamyneni@bellsouth.net wrote:
Show full article (0.96Kb)
no comments
INLINE (was: FSL array indexing)         


Author: Anton Ertl
Date: Mar 9, 2008 03:57

Krishna Myneni bellsouth.net> writes:
>OFF THIS TOPIC: it would be nice if Forth 200x would standardize a keyword for
>denoting inline words, e.g.
>
>: CELL- [ 1 CELLS ] LITERAL - ; inline
>
>A Forth implementation could choose to ignore the keyword, or to give the marked
>word appropriate compile time behavior.

If you think it's worth the effort, go ahead and make an RfD. This
one should not be too controversial. I am sure you will find a
committee member willing to help you when you need help.

- anton
no comments
Re: INLINE (was: FSL array indexing)         


Author: Albert van der Horst
Date: Mar 9, 2008 07:56

In article <2008Mar9.115712@mips.complang.tuwien.ac.at>,
Anton Ertl mips.complang.tuwien.ac.at> wrote:
>Krishna Myneni bellsouth.net> writes:
>>OFF THIS TOPIC: it would be nice if Forth 200x would standardize a keyword for
>>denoting inline words, e.g.
>>
>>: CELL- [ 1 CELLS ] LITERAL - ; inline
>>
>>A Forth implementation could choose to ignore the keyword, or to give the marked
>>word appropriate compile time behavior.
>
>If you think it's worth the effort, go ahead and make an RfD. This
>one should not be too controversial. I am sure you will find a
>committee member willing to help you when you need help.

What would it mean? An optimizing compiler inlines that code
anyway. In my embedded renesas Forth I would just do : INLINE ;
and get over it.
Show full article (1.25Kb)
no comments
Re: INLINE         


Author: Krishna Myneni
Date: Mar 9, 2008 12:09

Albert van der Horst wrote:
> In article <2008Mar9.115712@mips.complang.tuwien.ac.at>,
> Anton Ertl mips.complang.tuwien.ac.at> wrote:
>> Krishna Myneni bellsouth.net> writes:
>>> OFF THIS TOPIC: it would be nice if Forth 200x would standardize a keyword for
>>> denoting inline words, e.g.
>>>
>>> : CELL- [ 1 CELLS ] LITERAL - ; inline
>>>
>>> A Forth implementation could choose to ignore the keyword, or to give the marked
>>> word appropriate compile time behavior.
>> If you think it's worth the effort, go ahead and make an RfD. This
>> one should not be too controversial. I am sure you will find a
>> committee member willing to help you when you need help.
>
> What would it mean? An optimizing compiler inlines that code
> anyway. In my embedded renesas Forth I would...
Show full article (1.80Kb)
no comments
Re: FSL array indexing         


Author: C. G. Montgomery
Date: Mar 9, 2008 14:24

Krishna Myneni krishnamyneni@bellsouth.net wrote:
> Anybody know a good reason for the presence of SWAP in the following
> word, from fsl-util.xxx?
>
> : } ( addr n -- addr[n]) \ word that fetches 1-D array addresses
> OVER CELL- @
> * SWAP +
> ;

The superfluous SWAPs have been removed from the various FSL auxiliary
files.

Also, the gzipped tarball with the complete Library has been updated.

[those auxiliary files will be the death of me yet :( ]

regards to all cgm
no comments
Re: INLINE         


Author: Andrew Haley
Date: Mar 10, 2008 14:46

Krishna Myneni bellsouth.net> wrote:
> Albert van der Horst wrote:
>> In article <2008Mar9.115712@mips.complang.tuwien.ac.at>,
>> Anton Ertl mips.complang.tuwien.ac.at> wrote:
>>> Krishna Myneni bellsouth.net> writes:
>>>> OFF THIS TOPIC: it would be nice if Forth 200x would standardize a keyword for
>>>> denoting inline words, e.g.
>>>>
>>>> : CELL- [ 1 CELLS ] LITERAL - ; inline
>>>>
>>>> A Forth implementation could choose to ignore the keyword, or to give the marked
>>>> word appropriate compile time behavior.
>>> If you think it's worth the effort, go ahead and make an RfD. This
>>> one should not be too controversial.

Heh! :-)
>>> I am sure you will find a committee member willing to help you
>>> when you need help.
Show full article (1.39Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: How do I use the Index Values property node with a multidimensional array.comp.lang.labview ·
how to join array into arraycomp.lang.perl.misc ·
1 2