[PicForth] Re: Feature Requests
Alex Holden
alex at linuxhacker.org
Sat Nov 20 00:29:20 CET 2004
Samuel Tardieu wrote:
>>>>>>"Alex" == Alex Holden <alex at linuxhacker.org> writes:
> Alex> 1. It would be great if any words which are defined but never
> Alex> used weren't compiled into the binary (I realise this would
> Alex> require two passes to figure out how many times each word is
> Alex> used). In a similar vein, it would be nice to use the same
> Alex> information to automatically inline any words that are only used
> Alex> once.
> Mmm, I really don't want to rearchitecture everything in PicForth to
> do that. However, maybe someone could implement that in the statistics
> you suggest below and report words used only once and containing a
> simple return statement at the end as well as unused words.
Ah right, I wasn't sure how difficult it would be. The main use I can
see for the 'don't include words that aren't used' feature would be
libraries and drivers that are shared by several programs, not all of
which make use of all the words they provide. So having a list of the
library words which aren't used by the current program would be rather
less useful than somehow automatically not compiling them in. How about
doing it via two new commands- one which dumps a list of words that have
been defined but not used to a file, and another which reads the file
and uses it as a list of words to not bother compiling when it sees
them? The idea is to run picforth twice, once to create the 'ignore'
list and again to make use of it. You would only need to bother doing it
(and doubling your compile time) if you ran out of program memory. I
guess there would also need to be some way to tell it to ignore the
program memory limit on the first run (where every word is compiled in)
otherwise it defeats the object of the exercise because you would only
be able to use it if there's enough free program memory to fit
everything in anyway.
> Alex> 2. It would be extremely helpful for beginners if the
> Alex> documentation included a glossary of every picforth word with a
> Alex> brief description of what it does.
> Be my guest :-) I can help, but I don't have the resources to do
> that.
I'm willing to do this. I don't mind writing documentation actually.
I'll try to figure out what's involved in implementing the other
commands (statistics, dumping disassembly and map to a file, dumping a
list of unused words, etc.) but I've had a quick look at picforth.fs and
a lot of it went way over my head (I'm far from an expert in Forth).
--
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer
More information about the PicForth
mailing list